/**
* A variant of the insertion operation that takes a typecode
* argument as well.
*/
public void insert_Object(org.omg.CORBA.Object o, TypeCode tc)
{
//debug.log ("insert_Object2");
try {
if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) )
{
typeCode = TypeCodeImpl.convertToNative(orb, tc);
object = o;
}
else {
throw wrapper.insertObjectIncompatible() ;
}
} catch ( Exception ex ) {
throw wrapper.insertObjectFailed(ex) ;
}
isInitialized = true;
}
java类org.omg.CORBA.TypeCode的实例源码
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 19
收藏 0
点赞 0
评论 0
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
{
try {
if (TypeCodeImpl.digits(value) > type.fixed_digits() ||
TypeCodeImpl.scale(value) > type.fixed_scale())
{
throw wrapper.fixedNotMatch() ;
}
} catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
// type isn't even of kind fixed
throw wrapper.fixedBadTypecode( bk ) ;
}
typeCode = TypeCodeImpl.convertToNative(orb, type);
object = value;
isInitialized = true;
}
AnyImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
/**
* A variant of the insertion operation that takes a typecode
* argument as well.
*/
public void insert_Object(org.omg.CORBA.Object o, TypeCode tc)
{
//debug.log ("insert_Object2");
try {
if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) )
{
typeCode = TypeCodeImpl.convertToNative(orb, tc);
object = o;
}
else {
throw wrapper.insertObjectIncompatible() ;
}
} catch ( Exception ex ) {
throw wrapper.insertObjectFailed(ex) ;
}
isInitialized = true;
}
TypeCodeImpl.java 文件源码
项目:OpenJSharp
阅读 26
收藏 0
点赞 0
评论 0
public TypeCodeImpl(ORB orb,
int creationKind,
String id,
String name,
TypeCode original_type)
// for aliases and value boxes
{
this(orb) ;
if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box )
{
_kind = creationKind;
setId(id);
_name = name;
_contentType = convertToNative(_orb, original_type);
}
// else initializes to null
}
AnyImpl.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
public void insert_Value(Serializable v)
{
//debug.log ("insert_Value");
object = v;
TypeCode tc;
if ( v == null ) {
tc = orb.get_primitive_tc (TCKind.tk_value);
} else {
// See note in getPrimitiveTypeCodeForClass. We
// have to use the latest type code fixes in this
// case since there is no way to know what ORB will
// actually send this Any. In RMI-IIOP, when using
// Util.writeAny, we can do the versioning correctly,
// and use the insert_Value(Serializable, TypeCode)
// method.
//
// The ORB singleton uses the latest version.
tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
}
typeCode = TypeCodeImpl.convertToNative(orb, tc);
isInitialized = true;
}
TypeCodeImpl.java 文件源码
项目:openjdk-jdk10
阅读 36
收藏 0
点赞 0
评论 0
public TypeCode member_type(int index)
throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
switch (_kind) {
case tk_indirect:
return indirectType().member_type(index);
case TCKind._tk_except:
case TCKind._tk_struct:
case TCKind._tk_union:
case TCKind._tk_value:
try {
return _memberTypes[index];
} catch (ArrayIndexOutOfBoundsException e) {
throw new org.omg.CORBA.TypeCodePackage.Bounds();
}
default:
throw new BadKind();
}
}
ValueUtility.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
private static TypeCode createTypeCodeForClassInternal (ORB orb,
java.lang.Class c,
ValueHandler vh,
IdentityKeyValueStack createdIDs)
{
// This wrapper method is the protection against infinite recursion.
TypeCode tc = null;
String id = (String)createdIDs.get(c);
if (id != null) {
return orb.create_recursive_tc(id);
} else {
id = vh.getRMIRepositoryID(c);
if (id == null) id = "";
// cache the rep id BEFORE creating a new typecode.
// so that recursive tc can look up the rep id.
createdIDs.push(c, id);
tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
createdIDs.pop();
return tc;
}
}
Util.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
/**
* When using our own ORB and Any implementations, we need to get
* the ORB version and create the type code appropriately. This is
* to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
* rather than a tk_wchar to describe a Java char field.
*
* This only works in RMI-IIOP with Util.writeAny since we actually
* know what ORB and stream we're writing with when we insert
* the value.
*
* Returns null if it wasn't possible to create the TypeCode (means
* it wasn't our ORB or Any implementation).
*
* This does not handle null objs.
*/
private TypeCode createTypeCode(Serializable obj,
org.omg.CORBA.Any any,
org.omg.CORBA.ORB orb) {
if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
orb instanceof ORB) {
com.sun.corba.se.impl.corba.AnyImpl anyImpl
= (com.sun.corba.se.impl.corba.AnyImpl)any;
ORB ourORB = (ORB)orb;
return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
} else
return null;
}
Util.java 文件源码
项目:OpenJSharp
阅读 18
收藏 0
点赞 0
评论 0
/**
* This is used to create the TypeCode for a null reference.
* It also handles backwards compatibility with JDK 1.3.x.
*
* This method will not return null.
*/
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
if (orb instanceof ORB) {
ORB ourORB = (ORB)orb;
// Preserve backwards compatibility with Kestrel and Ladybird
// by not fully implementing interop issue resolution 3857,
// and returning a null TypeCode with a tk_value TCKind.
// If we're not talking to Kestrel or Ladybird, fall through
// to the abstract interface case (also used for foreign ORBs).
if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {
return orb.get_primitive_tc(TCKind.tk_value);
}
}
// Use tk_abstract_interface as detailed in the resolution
// REVISIT: Define this in IDL and get the ID in generated code
String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";
return orb.create_abstract_interface_tc(abstractBaseID, "");
}
TypeCodeImpl.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
public TypeCode content_type()
throws BadKind
{
switch (_kind) {
case tk_indirect:
return indirectType().content_type();
case TCKind._tk_sequence:
return lazy_content_type();
case TCKind._tk_array:
case TCKind._tk_alias:
case TCKind._tk_value_box:
return _contentType;
default:
throw new BadKind();
}
}
ValueUtility.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
Class c,
ValueHandler vh) {
if (c == Integer.TYPE) {
return orb.get_primitive_tc (TCKind.tk_long);
} else if (c == Byte.TYPE) {
return orb.get_primitive_tc (TCKind.tk_octet);
} else if (c == Long.TYPE) {
return orb.get_primitive_tc (TCKind.tk_longlong);
} else if (c == Float.TYPE) {
return orb.get_primitive_tc (TCKind.tk_float);
} else if (c == Double.TYPE) {
return orb.get_primitive_tc (TCKind.tk_double);
} else if (c == Short.TYPE) {
return orb.get_primitive_tc (TCKind.tk_short);
} else if (c == Character.TYPE) {
return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
} else if (c == Boolean.TYPE) {
return orb.get_primitive_tc (TCKind.tk_boolean);
} else {
// _REVISIT_ Not sure if this is right.
return orb.get_primitive_tc (TCKind.tk_any);
}
}
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
/**
* sets the type of the element to be contained in the Any.
*
* @param tc the TypeCode for the element in the Any
*/
public void type(TypeCode tc)
{
//debug.log ("type2");
// set the typecode
typeCode = TypeCodeImpl.convertToNative(orb, tc);
stream = null;
value = 0;
object = null;
// null is the only legal value this Any can have after resetting the type code
isInitialized = (tc.kind().value() == TCKind._tk_null);
}
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
/**
* See the description of the <a href="#anyOps">general Any operations.</a>
*/
public void insert_TypeCode(TypeCode tc)
{
//debug.log ("insert_TypeCode");
typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode);
object = tc;
isInitialized = true;
}
AnyImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
/**
* See the description of the <a href="#anyOps">general Any operations.</a>
*/
public TypeCode extract_TypeCode()
{
//debug.log ("extract_TypeCode");
checkExtractBadOperation( TCKind._tk_TypeCode ) ;
return (TypeCode)object;
}
TypeCodeImpl.java 文件源码
项目:OpenJSharp
阅读 19
收藏 0
点赞 0
评论 0
public TypeCodeImpl(ORB orb,
int creationKind,
String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
// for unions
{
this(orb) ;
if (creationKind == TCKind._tk_union) {
_kind = creationKind;
setId(id);
_name = name;
_memberCount = members.length;
_discriminator = convertToNative(_orb, discriminator_type);
_memberNames = new String[_memberCount];
_memberTypes = new TypeCodeImpl[_memberCount];
_unionLabels = new AnyImpl[_memberCount];
for (int i = 0 ; i < _memberCount ; i++) {
_memberNames[i] = members[i].name;
_memberTypes[i] = convertToNative(_orb, members[i].type);
_memberTypes[i].setParent(this);
_unionLabels[i] = new AnyImpl(_orb, members[i].label);
// check whether this is the default branch.
if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
if (_unionLabels[i].extract_octet() == (byte)0) {
_defaultIndex = i;
}
}
}
} // else initializes to null
}
TypeCodeImpl.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
public TypeCodeImpl(ORB orb,
int creationKind,
String id,
String name,
short type_modifier,
TypeCode concrete_base,
ValueMember[] members)
// for value types
{
this(orb) ;
if (creationKind == TCKind._tk_value) {
_kind = creationKind;
setId(id);
_name = name;
_type_modifier = type_modifier;
if (concrete_base != null) {
_concrete_base = convertToNative(_orb, concrete_base);
}
_memberCount = members.length;
_memberNames = new String[_memberCount];
_memberTypes = new TypeCodeImpl[_memberCount];
_memberAccess = new short[_memberCount];
for (int i = 0 ; i < _memberCount ; i++) {
_memberNames[i] = members[i].name;
_memberTypes[i] = convertToNative(_orb, members[i].type);
_memberTypes[i].setParent(this);
_memberAccess[i] = members[i].access;
}
} // else initializes to null
}
ValueUtility.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) {
// Maps classes to repositoryIDs strings. This is used to detect recursive types.
IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
// Stores all types created for resolving indirect types at the end.
TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs);
return tc;
}
ExceptionListImpl.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
public TypeCode item(int index)
throws Bounds
{
try {
return (TypeCode) _exceptions.elementAt(index);
} catch (ArrayIndexOutOfBoundsException e) {
throw new Bounds();
}
}
DynAnyConstructedImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
protected boolean isRecursive() {
if (isRecursive == RECURSIVE_UNDEF) {
TypeCode typeCode = any.type();
if (typeCode instanceof TypeCodeImpl) {
if (((TypeCodeImpl)typeCode).is_recursive())
isRecursive = RECURSIVE_YES;
else
isRecursive = RECURSIVE_NO;
} else {
// No way to find out unless the TypeCode spec changes.
isRecursive = RECURSIVE_NO;
}
}
return (isRecursive == RECURSIVE_YES);
}
DynAnyConstructedImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
public void insert_typecode(org.omg.CORBA.TypeCode value)
throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed() ;
}
if (index == NO_INDEX)
throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
DynAny currentComponent = current_component();
if (DynAnyUtil.isConstructedDynAny(currentComponent))
throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
currentComponent.insert_typecode(value);
}
DynAnyConstructedImpl.java 文件源码
项目:openjdk-jdk10
阅读 18
收藏 0
点赞 0
评论 0
protected boolean isRecursive() {
if (isRecursive == RECURSIVE_UNDEF) {
TypeCode typeCode = any.type();
if (typeCode instanceof TypeCodeImpl) {
if (((TypeCodeImpl)typeCode).is_recursive())
isRecursive = RECURSIVE_YES;
else
isRecursive = RECURSIVE_NO;
} else {
// No way to find out unless the TypeCode spec changes.
isRecursive = RECURSIVE_NO;
}
}
return (isRecursive == RECURSIVE_YES);
}
AnyImpl.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
/**
* sets the type of the element to be contained in the Any.
*
* @param tc the TypeCode for the element in the Any
*/
public void type(TypeCode tc)
{
//debug.log ("type2");
// set the typecode
typeCode = TypeCodeImpl.convertToNative(orb, tc);
stream = null;
value = 0;
object = null;
// null is the only legal value this Any can have after resetting the type code
isInitialized = (tc.kind().value() == TCKind._tk_null);
}
ORBSingleton.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
public TypeCode create_union_tc(String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
{
return new TypeCodeImpl(this,
TCKind._tk_union,
id,
name,
discriminator_type,
members);
}
ServerRequestInfoImpl.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
/**
* See ServerRequestInfo for javadocs.
*/
public TypeCode[] exceptions (){
checkAccess( MID_EXCEPTIONS );
// _REVISIT_ PI RTF Issue: No exception list on server side.
throw stdWrapper.piOperationNotSupported2() ;
}
DynAnyCollectionImpl.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
protected TypeCode getContentType() {
try {
return any.type().content_type();
} catch (BadKind badKind) { // impossible
return null;
}
}
DynAnyCollectionImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
public void set_elements_as_dyn_any (org.omg.DynamicAny.DynAny[] value)
throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed() ;
}
checkValue(value);
components = (value == null ? emptyComponents : value);
anys = new Any[value.length];
// We know that this is of kind tk_sequence or tk_array
TypeCode expectedTypeCode = getContentType();
for (int i=0; i<value.length; i++) {
if (value[i] != null) {
if (! value[i].type().equal(expectedTypeCode)) {
clearData();
// _REVISIT_ More info
throw new TypeMismatch();
}
anys[i] = getAny(value[i]);
} else {
clearData();
// _REVISIT_ More info
throw new InvalidValue();
}
}
index = (value.length == 0 ? NO_INDEX : 0);
// Other representations are invalidated by this operation
representations = REPRESENTATION_COMPONENTS;
}
DynStructImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
protected DynStructImpl(ORB orb, TypeCode typeCode) {
// We can be sure that typeCode is of kind tk_struct
super(orb, typeCode);
// For DynStruct, the operation sets the current position to -1
// for empty exceptions and to zero for all other TypeCodes.
// The members (if any) are (recursively) initialized to their default values.
index = 0;
}
DynSequenceImpl.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
protected boolean initializeComponentsFromAny() {
// This typeCode is of kind tk_sequence.
TypeCode typeCode = any.type();
int length;
TypeCode contentType = getContentType();
InputStream input;
try {
input = any.create_input_stream();
} catch (BAD_OPERATION e) {
return false;
}
length = input.read_long();
components = new DynAny[length];
anys = new Any[length];
for (int i=0; i<length; i++) {
// _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
// but only for primitive types
anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
try {
// Creates the appropriate subtype without copying the Any
components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
} catch (InconsistentTypeCode itc) { // impossible
}
}
return true;
}
DynAnyBasicImpl.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
public org.omg.CORBA.TypeCode get_typecode()
throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed() ;
}
if (any.type().kind().value() != TCKind._tk_TypeCode)
throw new TypeMismatch();
return any.extract_TypeCode();
}
ServerRequestImpl.java 文件源码
项目:openjdk-jdk10
阅读 21
收藏 0
点赞 0
评论 0
/** This is called from the ORB after the DynamicImplementation.invoke
* returns. Here we set the result if result() has not already been called.
* @return the exception if there is one (then ORB will not call
* marshalReplyParams()) otherwise return null.
*/
public Any checkResultCalled()
{
// Two things to be checked (CORBA 2.2 spec, section 6.3):
// 1. Unless it calls set_exception(), the DIR must call arguments()
// exactly once, even if the operation signature contains
// no parameters.
// 2. Unless set_exception() is called, if the invoked operation has a
// non-void result type, set_result() must be called exactly once
// before the DIR returns.
if ( _paramsCalled && _resultSet ) // normal invocation return
return null;
else if ( _paramsCalled && !_resultSet && !_exceptionSet ) {
try {
// Neither a result nor an exception has been set.
// Assume that the return type is void. If this is not so,
// the client will throw a MARSHAL exception while
// unmarshaling the return value.
TypeCode result_tc = _orb.get_primitive_tc(
org.omg.CORBA.TCKind.tk_void);
_resultAny = _orb.create_any();
_resultAny.type(result_tc);
_resultSet = true;
return null;
} catch ( Exception ex ) {
throw _wrapper.dsiResultException(
CompletionStatus.COMPLETED_MAYBE, ex ) ;
}
} else if ( _exceptionSet )
return _exception;
else {
throw _wrapper.dsimethodNotcalled(
CompletionStatus.COMPLETED_MAYBE ) ;
}
}