Here are the examples of the java api org.omg.CORBA.Any taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
98 Examples
19
Source : ORBSingleton.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public Policy create_policy(int type, Any val) throws PolicyError {
throw new NO_IMPLEMENT();
}
19
Source : ORBSingleton.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public org.omg.CORBA.NamedValue create_named_value(String s, Any any, int flags) {
return new NamedValueImpl(this, s, any, flags);
}
19
Source : SlotTable.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* SlotTable is used internally by PICurrent to store the slot information.
*/
public clreplaced SlotTable {
// The vector where all the slot data for the current thread is stored
private Any[] theSlotData;
// Required for instantiating Any object.
private ORB orb;
// The flag to check whether there are any updates in the current SlotTable.
// The slots will be reset to null, only if this flag is set.
private boolean dirtyFlag;
/**
* The constructor instantiates an Array of Any[] of size given by slotSize
* parameter.
*/
SlotTable(ORB orb, int slotSize) {
dirtyFlag = false;
this.orb = orb;
theSlotData = new Any[slotSize];
}
/**
* This method sets the slot data at the given slot id (index).
*/
public void set_slot(int id, Any data) throws InvalidSlot {
// First check whether the slot is allocated
// If not, raise the invalid slot exception
if (id >= theSlotData.length) {
throw new InvalidSlot();
}
dirtyFlag = true;
theSlotData[id] = data;
}
/**
* This method get the slot data for the given slot id (index).
*/
public Any get_slot(int id) throws InvalidSlot {
// First check whether the slot is allocated
// If not, raise the invalid slot exception
if (id >= theSlotData.length) {
throw new InvalidSlot();
}
if (theSlotData[id] == null) {
theSlotData[id] = new AnyImpl(orb);
}
return theSlotData[id];
}
/**
* This method resets all the slot data to null if dirtyFlag is set.
*/
void resetSlots() {
if (dirtyFlag == true) {
for (int i = 0; i < theSlotData.length; i++) {
theSlotData[i] = null;
}
}
}
/**
* This method returns the size of the allocated slots.
*/
int getSize() {
return theSlotData.length;
}
}
19
Source : SlotTable.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* This method sets the slot data at the given slot id (index).
*/
public void set_slot(int id, Any data) throws InvalidSlot {
// First check whether the slot is allocated
// If not, raise the invalid slot exception
if (id >= theSlotData.length) {
throw new InvalidSlot();
}
dirtyFlag = true;
theSlotData[id] = data;
}
19
Source : ServerRequestInfoImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Stores the various sources of information used for this info object.
*/
protected void setDSIResult(Any result) {
this.dsiResult = result;
}
19
Source : ServerRequestInfoImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Stores the various sources of information used for this info object.
*/
protected void setDSIException(Any exception) {
this.dsiException = exception;
// Clear cached exception value:
cachedSendingException = null;
}
19
Source : ServerRequestInfoImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Allows an Interceptor to set a slot in the Current that is in the scope
* of the request. If data already exists in that slot, it will be
* overwritten. If the ID does not define an allocated slot, InvalidSlot
* is raised.
*/
public void set_slot(int id, Any data) throws InvalidSlot {
// access is currently valid for all states:
// checkAccess( MID_SET_SLOT );
slotTable.set_slot(id, data);
}
19
Source : ServerRequestInfoImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Any containing the exception to be returned to the client.
*/
public Any sending_exception() {
checkAccess(MID_SENDING_EXCEPTION);
if (cachedSendingException == null) {
Any result = null;
if (dsiException != null) {
result = dsiException;
} else if (exception != null) {
result = exceptionToAny(exception);
} else {
// sending_exception should not be callable if both dsiException
// and exception are null.
throw wrapper.exceptionUnavailable();
}
cachedSendingException = result;
}
return cachedSendingException;
}
19
Source : RequestInfoImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Inserts the UserException into the given Any.
* Throws an UNKNOWN with minor code
* OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper clreplaced could not be
* found to insert it with.
*/
private void insertUserException(UserException userException, Any result) throws UNKNOWN {
try {
// Insert this UserException into the provided Any using the
// helper clreplaced.
if (userException != null) {
Clreplaced exceptionClreplaced = userException.getClreplaced();
String clreplacedName = exceptionClreplaced.getName();
String helperClreplacedName = clreplacedName + "Helper";
Clreplaced<?> helperClreplaced = SharedSecrets.getJavaCorbaAccess().loadClreplaced(helperClreplacedName);
// Find insert( Any, clreplaced ) method
Clreplaced[] insertMethodParams = new Clreplaced[2];
insertMethodParams[0] = org.omg.CORBA.Any.clreplaced;
insertMethodParams[1] = exceptionClreplaced;
Method insertMethod = helperClreplaced.getMethod("insert", insertMethodParams);
// Call helper.insert( result, userException ):
java.lang.Object[] insertMethodArguments = new java.lang.Object[2];
insertMethodArguments[0] = result;
insertMethodArguments[1] = userException;
insertMethod.invoke(null, insertMethodArguments);
}
} catch (ClreplacedNotFoundException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
} catch (NoSuchMethodException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
} catch (SecurityException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
} catch (IllegalAccessException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
} catch (IllegalArgumentException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
} catch (InvocationTargetException e) {
throw stdWrapper.unknownUserException(CompletionStatus.COMPLETED_MAYBE, e);
}
}
19
Source : PINoOpHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError {
return null;
}
19
Source : PINoOpHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void setServerPIInfo(Any result) {
}
19
Source : PINoOpHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void setServerPIExceptionInfo(Any exception) {
}
19
Source : PIHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void setServerPIInfo(Any result) {
if (!hreplacederverInterceptors)
return;
ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
info.setDSIResult(result);
}
19
Source : PIHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void setServerPIExceptionInfo(Any exception) {
if (!hreplacederverInterceptors)
return;
ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
info.setDSIException(exception);
}
19
Source : PIHandlerImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* This is the implementation of standard API defined in org.omg.CORBA.ORB
* clreplaced. This method finds the Policy Factory for the given Policy Type
* and instantiates the Policy object from the Factory. It will throw
* PolicyError exception, If the PolicyFactory for the given type is
* not registered.
* _REVISIT_, Once Policy Framework work is completed, Reorganize
* this method to com.sun.corba.se.spi.orb.ORB.
*/
public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError {
if (val == null) {
nullParam();
}
if (policyFactoryTable == null) {
throw new org.omg.CORBA.PolicyError("There is no PolicyFactory Registered for type " + type, BAD_POLICY.value);
}
PolicyFactory factory = (PolicyFactory) policyFactoryTable.get(new Integer(type));
if (factory == null) {
throw new org.omg.CORBA.PolicyError(" Could Not Find PolicyFactory for the Type " + type, BAD_POLICY.value);
}
org.omg.CORBA.Policy policy = factory.create_policy(type, val);
return policy;
}
19
Source : PICurrent.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* This method sets the slot data at the given slot id (index) in the
* Slot Table which is on the top of the SlotTableStack.
*/
public void set_slot(int id, Any data) throws InvalidSlot {
if (orbInitializing) {
// As per ptc/00-08-06 if the ORB is still initializing, disallow
// calls to get_slot and set_slot. If an attempt is made to call,
// throw a BAD_INV_ORDER.
throw wrapper.invalidPiCall3();
}
getSlotTable().set_slot(id, data);
}
19
Source : CDREncapsCodec.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Convert the given any into a CDR encapsulated octet sequence. Only
* the data is stored. The type code is not.
*/
public byte[] encode_value(Any data) throws InvalidTypeForEncoding {
if (data == null)
throw wrapper.nullParam();
return encodeImpl(data, false);
}
19
Source : CDREncapsCodec.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Convert the given any into a CDR encapsulated octet sequence.
* If sendTypeCode is true, the type code is sent with the message, as in
* a standard encapsulation. If it is false, only the data is sent.
* Either way, the endian type is sent as the first part of the message.
*/
private byte[] encodeImpl(Any data, boolean sendTypeCode) throws InvalidTypeForEncoding {
if (data == null)
throw wrapper.nullParam();
// _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
// the body of this method. This is due to the fact that CDR*Stream
// will never throw an exception if the encoding is invalid. To
// fix this, the CDROutputStream must know the version of GIOP it
// is encoding for and it must check to ensure that, for example,
// wstring cannot be encoded in GIOP 1.0.
//
// As part of the GIOP 1.2 work, the CDRInput and OutputStream will
// be versioned. This can be handled once this work is complete.
// Create output stream with default endianness.
EncapsOutputStream cdrOut = sun.corba.OutputStreamFactory.newEncapsOutputStream((com.sun.corba.se.spi.orb.ORB) orb, giopVersion);
// This is an encapsulation, so put out the endian:
cdrOut.putEndian();
// Sometimes encode type code:
if (sendTypeCode) {
cdrOut.write_TypeCode(data.type());
}
// Encode value and return.
data.write_value(cdrOut);
return cdrOut.toByteArray();
}
19
Source : CDREncapsCodec.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/**
* Convert the given any into a CDR encapsulated octet sequence
*/
public byte[] encode(Any data) throws InvalidTypeForEncoding {
if (data == null)
throw wrapper.nullParam();
return encodeImpl(data, true);
}
19
Source : IDLJavaSerializationOutputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public final void write_any(Any any) {
if (any == null) {
throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
}
write_TypeCode(any.type());
any.write_value(parent);
}
19
Source : IDLJavaSerializationOutputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public final void write_any_array(org.omg.CORBA.Any[] value, int offset, int length) {
for (int i = 0; i < length; i++) {
write_any(value[offset + i]);
}
}
19
Source : IDLJavaSerializationInputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
private final void read_any_array(org.omg.CORBA.Any[] value, int offset, int length) {
for (int i = 0; i < length; i++) {
value[i + offset] = read_any();
}
}
19
Source : IDLJavaSerializationInputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public Any read_any() {
Any any = orb.create_any();
TypeCodeImpl tc = new TypeCodeImpl(orb);
// read off the typecode
// REVISIT We could avoid this try-catch if we could peek the typecode
// kind off this stream and see if it is a tk_value.
// Looking at the code we know that for tk_value the Any.read_value()
// below ignores the tc argument anyway (except for the kind field).
// But still we would need to make sure that the whole typecode,
// including encapsulations, is read off.
try {
tc.read_value(parent);
} catch (org.omg.CORBA.MARSHAL ex) {
if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) {
throw ex;
}
// We can be sure that the whole typecode encapsulation has been
// read off.
ex.printStackTrace();
}
// read off the value of the any.
any.read_value(parent, tc);
return any;
}
19
Source : CDROutputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
impl.write_any_array(seq, offset, length);
}
19
Source : CDROutputStream.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public final void write_any(Any value) {
impl.write_any(value);
}
19
Source : DynValueBoxImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void set_boxed_value(org.omg.CORBA.Any boxed) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch {
if (!isNull && !boxed.type().equal(this.type())) {
throw new TypeMismatch();
}
clearData();
any = boxed;
representations = REPRESENTATION_ANY;
index = 0;
isNull = false;
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
private int currentUnionMemberIndex(Any discriminatorValue) {
int memberCount = memberCount();
Any memberLabel;
for (int i = 0; i < memberCount; i++) {
memberLabel = memberLabel(i);
if (memberLabel.equal(discriminatorValue)) {
return i;
}
}
if (defaultIndex() != -1) {
return defaultIndex();
}
return NO_INDEX;
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
private Any memberLabel(int i) {
Any memberLabel = null;
try {
memberLabel = any.type().member_label(i);
} catch (BadKind bad) {
} catch (Bounds bounds) {
}
return memberLabel;
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Sets the discriminator of the DynUnion to the specified value.
// If the TypeCode of the parameter is not equivalent
// to the TypeCode of the unions discriminator, the operation raises TypeMismatch.
//
// Setting the discriminator to a value that is consistent with the currently
// active union member does not affect the currently active member.
// Setting the discriminator to a value that is inconsistent with the currently
// active member deactivates the member and activates the member that is consistent
// with the new discriminator value (if there is a member for that value)
// by initializing the member to its default value.
//
// If the discriminator value indicates a non-existent union member
// this operation sets the current position to 0
// (has_no_active_member returns true in this case).
// Otherwise the current position is set to 1 (has_no_active_member returns false and
// component_count returns 2 in this case).
public void set_discriminator(org.omg.DynamicAny.DynAny newDiscriminator) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
if (!newDiscriminator.type().equal(discriminatorType())) {
throw new TypeMismatch();
}
newDiscriminator = DynAnyUtil.convertToNative(newDiscriminator, orb);
Any newDiscriminatorAny = getAny(newDiscriminator);
int newCurrentMemberIndex = currentUnionMemberIndex(newDiscriminatorAny);
if (newCurrentMemberIndex == NO_INDEX) {
clearData();
index = 0;
} else {
// _REVISIT_ Could possibly optimize here if we don't need to initialize components
checkInitComponents();
if (currentMemberIndex == NO_INDEX || newCurrentMemberIndex != currentMemberIndex) {
clearData();
index = 1;
currentMemberIndex = newCurrentMemberIndex;
try {
currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(currentMemberIndex), orb);
} catch (InconsistentTypeCode ictc) {
}
discriminator = newDiscriminator;
components = new DynAny[] { discriminator, currentMember };
representations = REPRESENTATION_COMPONENTS;
}
}
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Sets the discriminator to a value that does not correspond
// to any of the unions case labels.
// It sets the current position to zero and causes component_count to return 1.
// Calling set_to_no_active_member on a union that has an explicit default case
// or on a union that uses the entire range of discriminator values
// for explicit case labels raises TypeMismatch.
public void set_to_no_active_member() throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
// _REVISIT_ How does one check for "entire range of discriminator values"?
if (defaultIndex() != -1) {
throw new TypeMismatch();
}
checkInitComponents();
Any discriminatorAny = getAny(discriminator);
// erase the discriminators value so that it does not correspond
// to any of the unions case labels
discriminatorAny.type(discriminatorAny.type());
index = 0;
currentMemberIndex = NO_INDEX;
// Necessary to guarantee OBJECT_NOT_EXIST in member()
currentMember.destroy();
currentMember = null;
components[0] = discriminator;
representations = REPRESENTATION_COMPONENTS;
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Sets the discriminator to a value that is consistent with the value
// of the default case of a union; it sets the current position to
// zero and causes component_count to return 2.
// Calling set_to_default_member on a union that does not have an explicit
// default case raises TypeMismatch.
public void set_to_default_member() throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
int defaultIndex = defaultIndex();
if (defaultIndex == -1) {
throw new TypeMismatch();
}
try {
clearData();
index = 1;
currentMemberIndex = defaultIndex;
currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
components = new DynAny[] { discriminator, currentMember };
Any discriminatorAny = orb.create_any();
discriminatorAny.insert_octet((byte) 0);
discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
representations = REPRESENTATION_COMPONENTS;
} catch (InconsistentTypeCode ictc) {
}
}
19
Source : DynUnionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
protected boolean initializeComponentsFromAny() {
try {
InputStream input = any.create_input_stream();
Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb);
discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
currentMemberIndex = currentUnionMemberIndex(discriminatorAny);
Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb);
currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
components = new DynAny[] { discriminator, currentMember };
} catch (InconsistentTypeCode ictc) {
// impossible
}
return true;
}
19
Source : DynSequenceImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Sets the length of the sequence. Increasing the length of a sequence
// adds new elements at the tail without affecting the values of already
// existing elements. Newly added elements are default-initialized.
//
// Increasing the length of a sequence sets the current position to the first
// newly-added element if the previous current position was -1.
// Otherwise, if the previous current position was not -1,
// the current position is not affected.
//
// Increasing the length of a bounded sequence to a value larger than the bound
// raises InvalidValue.
//
// Decreasing the length of a sequence removes elements from the tail
// without affecting the value of those elements that remain.
// The new current position after decreasing the length of a sequence is determined
// as follows:
// ?f the length of the sequence is set to zero, the current position is set to -1.
// ?f the current position is -1 before decreasing the length, it remains at -1.
// ?f the current position indicates a valid element and that element is not removed
// when the length is decreased, the current position remains unaffected.
// ?f the current position indicates a valid element and that element is removed, the
// current position is set to -1.
public void set_length(int len) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
int bound = getBound();
if (bound > 0 && len > bound) {
throw new InvalidValue();
}
checkInitComponents();
int oldLength = components.length;
if (len > oldLength) {
// Increase length
DynAny[] newComponents = new DynAny[len];
Any[] newAnys = new Any[len];
System.arraycopy(components, 0, newComponents, 0, oldLength);
System.arraycopy(anys, 0, newAnys, 0, oldLength);
components = newComponents;
anys = newAnys;
// Newly added elements are default-initialized
TypeCode contentType = getContentType();
for (int i = oldLength; i < len; i++) {
createDefaultComponentAt(i, contentType);
}
// Increasing the length of a sequence sets the current position to the first
// newly-added element if the previous current position was -1.
if (index == NO_INDEX)
index = oldLength;
} else if (len < oldLength) {
// Decrease length
DynAny[] newComponents = new DynAny[len];
Any[] newAnys = new Any[len];
System.arraycopy(components, 0, newComponents, 0, len);
System.arraycopy(anys, 0, newAnys, 0, len);
// It is probably right not to destroy the released component DynAnys.
// Some other DynAny or a user variable might still hold onto them
// and if not then the garbage collector will take care of it.
// for (int i=len; i<oldLength; i++) {
// components[i].destroy();
// }
components = newComponents;
anys = newAnys;
// ?f the length of the sequence is set to zero, the current position is set to -1.
// ?f the current position is -1 before decreasing the length, it remains at -1.
// ?f the current position indicates a valid element and that element is not removed
// when the length is decreased, the current position remains unaffected.
// ?f the current position indicates a valid element and that element is removed,
// the current position is set to -1.
if (len == 0 || index >= len) {
index = NO_INDEX;
}
} else {
// Length unchanged
// Maybe components is now default initialized from type code
if (index == NO_INDEX && len > 0) {
index = 0;
}
}
}
19
Source : DynAnyUtil.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Creates a default Any of the given type.
static Any createDefaultAnyOfType(TypeCode typeCode, ORB orb) {
ORBUtilSystemException wrapper = ORBUtilSystemException.get(orb, CORBALogDomains.RPC_PRESENTATION);
Any returnValue = orb.create_any();
// The spec for DynAny differs from Any on initialization via type code:
// - false for boolean
// - zero for numeric types
// - zero for types octet, char, and wchar
// - the empty string for string and wstring
// - nil for object references
// - a type code with a TCKind value of tk_null for type codes
// - for Any values, an Any containing a type code with a TCKind value of tk_null
// type and no value
switch(typeCode.kind().value()) {
case TCKind._tk_boolean:
// false for boolean
returnValue.insert_boolean(false);
break;
case TCKind._tk_short:
// zero for numeric types
returnValue.insert_short((short) 0);
break;
case TCKind._tk_ushort:
// zero for numeric types
returnValue.insert_ushort((short) 0);
break;
case TCKind._tk_long:
// zero for numeric types
returnValue.insert_long(0);
break;
case TCKind._tk_ulong:
// zero for numeric types
returnValue.insert_ulong(0);
break;
case TCKind._tk_longlong:
// zero for numeric types
returnValue.insert_longlong((long) 0);
break;
case TCKind._tk_ulonglong:
// zero for numeric types
returnValue.insert_ulonglong((long) 0);
break;
case TCKind._tk_float:
// zero for numeric types
returnValue.insert_float((float) 0.0);
break;
case TCKind._tk_double:
// zero for numeric types
returnValue.insert_double((double) 0.0);
break;
case TCKind._tk_octet:
// zero for types octet, char, and wchar
returnValue.insert_octet((byte) 0);
break;
case TCKind._tk_char:
// zero for types octet, char, and wchar
returnValue.insert_char((char) 0);
break;
case TCKind._tk_wchar:
// zero for types octet, char, and wchar
returnValue.insert_wchar((char) 0);
break;
case TCKind._tk_string:
// the empty string for string and wstring
// Make sure that type code for bounded strings gets respected
returnValue.type(typeCode);
// Doesn't erase the type of bounded string
returnValue.insert_string("");
break;
case TCKind._tk_wstring:
// the empty string for string and wstring
// Make sure that type code for bounded strings gets respected
returnValue.type(typeCode);
// Doesn't erase the type of bounded string
returnValue.insert_wstring("");
break;
case TCKind._tk_objref:
// nil for object references
returnValue.insert_Object(null);
break;
case TCKind._tk_TypeCode:
// a type code with a TCKind value of tk_null for type codes
// We can reuse the type code that's already in the any.
returnValue.insert_TypeCode(returnValue.type());
break;
case TCKind._tk_any:
// for Any values, an Any containing a type code with a TCKind value
// of tk_null type and no value.
// This is exactly what the default AnyImpl constructor provides.
// _REVISIT_ Note that this inner Any is considered uninitialized.
returnValue.insert_any(orb.create_any());
break;
case TCKind._tk_struct:
case TCKind._tk_union:
case TCKind._tk_enum:
case TCKind._tk_sequence:
case TCKind._tk_array:
case TCKind._tk_except:
case TCKind._tk_value:
case TCKind._tk_value_box:
// There are no default value for complex types since there is no
// concept of a hierarchy of Anys. Only DynAnys can be arrange in
// a hierarchy to mirror the TypeCode hierarchy.
// See DynAnyConstructedImpl.initializeComponentsFromTypeCode()
// on how this DynAny hierarchy is created from TypeCodes.
returnValue.type(typeCode);
break;
case TCKind._tk_fixed:
returnValue.insert_fixed(new BigDecimal("0.0"), typeCode);
break;
case TCKind._tk_native:
case TCKind._tk_alias:
case TCKind._tk_void:
case TCKind._tk_Principal:
case TCKind._tk_abstract_interface:
returnValue.type(typeCode);
break;
case TCKind._tk_null:
// Any is already initialized to null
break;
case TCKind._tk_longdouble:
// Unspecified for Java
throw wrapper.tkLongDoubleNotSupported();
default:
throw wrapper.typecodeNotSupported();
}
return returnValue;
}
19
Source : DynAnyUtil.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
static boolean isInitialized(Any any) {
// Returning simply the value of Any.isInitialized() is not enough.
// The DynAny spec says that Anys containing null strings do not contain
// a "legal value" (see ptc 99-10-07, 9.2.3.3)
boolean isInitialized = ((AnyImpl) any).isInitialized();
switch(any.type().kind().value()) {
case TCKind._tk_string:
return (isInitialized && (any.extract_string() != null));
case TCKind._tk_wstring:
return (isInitialized && (any.extract_wstring() != null));
}
return isInitialized;
}
19
Source : DynAnyUtil.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
/*
static Any setTypeOfAny(TypeCode typeCode, Any value) {
if (value != null) {
value.read_value(value.create_input_stream(), typeCode);
}
return value;
}
*/
static Any copy(Any inAny, ORB orb) {
return new AnyImpl(orb, inAny);
}
19
Source : DynAnyUtil.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode {
if (any == null || !DynAnyUtil.isConsistentType(any.type()))
throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
switch(any.type().kind().value()) {
case TCKind._tk_sequence:
return new DynSequenceImpl(orb, any, copyValue);
case TCKind._tk_struct:
return new DynStructImpl(orb, any, copyValue);
case TCKind._tk_array:
return new DynArrayImpl(orb, any, copyValue);
case TCKind._tk_union:
return new DynUnionImpl(orb, any, copyValue);
case TCKind._tk_enum:
return new DynEnumImpl(orb, any, copyValue);
case TCKind._tk_fixed:
return new DynFixedImpl(orb, any, copyValue);
case TCKind._tk_value:
return new DynValueImpl(orb, any, copyValue);
case TCKind._tk_value_box:
return new DynValueBoxImpl(orb, any, copyValue);
default:
return new DynAnyBasicImpl(orb, any, copyValue);
}
}
19
Source : DynAnyImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
abstract clreplaced DynAnyImpl extends org.omg.CORBA.LocalObject implements DynAny {
protected static final int NO_INDEX = -1;
// A DynAny is destroyable if it is the root of a DynAny hierarchy.
protected static final byte STATUS_DESTROYABLE = 0;
// A DynAny is undestroyable if it is a node in a DynAny hierarchy other than the root.
protected static final byte STATUS_UNDESTROYABLE = 1;
// A DynAny is destroyed if its root has been destroyed.
protected static final byte STATUS_DESTROYED = 2;
//
// Instance variables
//
protected ORB orb = null;
protected ORBUtilSystemException wrapper;
// An Any is used internally to implement the basic DynAny.
// It stores the DynAnys TypeCode.
// For primitive types it is the only representation.
// For complex types it is the streamed representation.
protected Any any = null;
// Destroyable is the default status for free standing DynAnys.
protected byte status = STATUS_DESTROYABLE;
protected int index = NO_INDEX;
//
// Constructors
//
protected DynAnyImpl() {
wrapper = ORBUtilSystemException.get(CORBALogDomains.RPC_PRESENTATION);
}
protected DynAnyImpl(ORB orb, Any any, boolean copyValue) {
this.orb = orb;
wrapper = ORBUtilSystemException.get(orb, CORBALogDomains.RPC_PRESENTATION);
if (copyValue)
this.any = DynAnyUtil.copy(any, orb);
else
this.any = any;
// set the current position to 0 if any has components, otherwise to -1.
index = NO_INDEX;
}
protected DynAnyImpl(ORB orb, TypeCode typeCode) {
this.orb = orb;
wrapper = ORBUtilSystemException.get(orb, CORBALogDomains.RPC_PRESENTATION);
this.any = DynAnyUtil.createDefaultAnyOfType(typeCode, orb);
}
protected DynAnyFactory factory() {
try {
return (DynAnyFactory) orb.resolve_initial_references(ORBConstants.DYN_ANY_FACTORY_NAME);
} catch (InvalidName in) {
throw new RuntimeException("Unable to find DynAnyFactory");
}
}
protected Any getAny() {
return any;
}
// Uses getAny() if this is our implementation, otherwise uses to_any()
// which copies the Any.
protected Any getAny(DynAny dynAny) {
if (dynAny instanceof DynAnyImpl)
return ((DynAnyImpl) dynAny).getAny();
else
// _REVISIT_ Nothing we can do about copying at this point
// if this is not our implementation of DynAny.
// To prevent this we would need another representation,
// one where component DynAnys are initialized but not the component Anys.
return dynAny.to_any();
}
protected void writeAny(OutputStream out) {
// System.out.println(this + " writeAny of type " + type().kind().value());
any.write_value(out);
}
protected void setStatus(byte newStatus) {
status = newStatus;
}
protected void clearData() {
// This clears the data part of the Any while keeping the TypeCode info.
any.type(any.type());
}
//
// DynAny interface methods
//
public org.omg.CORBA.TypeCode type() {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
return any.type();
}
// Makes a copy of the Any value inside the parameter
public void replacedign(org.omg.DynamicAny.DynAny dyn_any) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
if ((any != null) && (!any.type().equal(dyn_any.type()))) {
throw new TypeMismatch();
}
any = dyn_any.to_any();
}
// Makes a copy of the Any parameter
public void from_any(org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
if ((any != null) && (!any.type().equal(value.type()))) {
throw new TypeMismatch();
}
// If the preplaceded Any does not contain a legal value
// (such as a null string), the operation raises InvalidValue.
Any tempAny = null;
try {
tempAny = DynAnyUtil.copy(value, orb);
} catch (Exception e) {
throw new InvalidValue();
}
if (!DynAnyUtil.isInitialized(tempAny)) {
throw new InvalidValue();
}
any = tempAny;
}
public abstract org.omg.CORBA.Any to_any();
public abstract boolean equal(org.omg.DynamicAny.DynAny dyn_any);
public abstract void destroy();
public abstract org.omg.DynamicAny.DynAny copy();
// Needed for org.omg.CORBA.Object
private String[] __ids = { "IDL:omg.org/DynamicAny/DynAny:1.0" };
public String[] _ids() {
return (String[]) __ids.clone();
}
}
19
Source : DynAnyFactoryImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
//
// DynAnyFactory interface methods
//
// Returns the most derived DynAny type based on the Anys TypeCode.
public org.omg.DynamicAny.DynAny create_dyn_any(org.omg.CORBA.Any any) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode {
return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
}
19
Source : DynAnyConstructedImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void from_any(org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
clearData();
super.from_any(value);
representations = REPRESENTATION_ANY;
index = 0;
}
19
Source : DynAnyConstructedImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void insert_any(org.omg.CORBA.Any 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_any(value);
}
19
Source : DynAnyComplexImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
private void addComponent(int i, String memberName, Any memberAny, DynAny memberDynAny) {
components[i] = memberDynAny;
names[i] = (memberName != null ? memberName : "");
nameValuePairs[i].id = memberName;
nameValuePairs[i].value = memberAny;
nameDynAnyPairs[i].id = memberName;
nameDynAnyPairs[i].value = memberDynAny;
if (memberDynAny instanceof DynAnyImpl)
((DynAnyImpl) memberDynAny).setStatus(STATUS_UNDESTROYABLE);
}
19
Source : DynAnyComplexImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Initializes components, names, nameValuePairs and nameDynAnyPairs representation
// from the Any representation
protected boolean initializeComponentsFromAny() {
// This typeCode is of kind tk_struct.
TypeCode typeCode = any.type();
TypeCode memberType = null;
Any memberAny;
DynAny memberDynAny = null;
String memberName = null;
int length = 0;
try {
length = typeCode.member_count();
} catch (BadKind badKind) {
// impossible
}
InputStream input = any.create_input_stream();
allocComponents(length);
for (int i = 0; i < length; i++) {
try {
memberName = typeCode.member_name(i);
memberType = typeCode.member_type(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
memberAny = DynAnyUtil.extractAnyFromStream(memberType, input, orb);
try {
// Creates the appropriate subtype without copying the Any
memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
// _DEBUG_
// System.out.println("Created DynAny for " + memberName +
// ", type " + memberType.kind().value());
} catch (InconsistentTypeCode itc) {
// impossible
}
addComponent(i, memberName, memberAny, memberDynAny);
}
return true;
}
19
Source : DynAnyComplexImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Initializes components, names, nameValuePairs and nameDynAnyPairs representation
// from the internal TypeCode information with default values
// This is not done recursively, only one level.
// More levels are initialized lazily, on demand.
protected boolean initializeComponentsFromTypeCode() {
// This typeCode is of kind tk_struct.
TypeCode typeCode = any.type();
TypeCode memberType = null;
Any memberAny;
DynAny memberDynAny = null;
String memberName;
int length = 0;
try {
length = typeCode.member_count();
} catch (BadKind badKind) {
// impossible
}
allocComponents(length);
for (int i = 0; i < length; i++) {
memberName = null;
try {
memberName = typeCode.member_name(i);
memberType = typeCode.member_type(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
try {
memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberType, orb);
// _DEBUG_
// System.out.println("Created DynAny for " + memberName +
// ", type " + memberType.kind().value());
/*
if (memberDynAny instanceof DynAnyConstructedImpl) {
if ( ! ((DynAnyConstructedImpl)memberDynAny).isRecursive()) {
// This is the recursive part
((DynAnyConstructedImpl)memberDynAny).initializeComponentsFromTypeCode();
}
} // Other implementations have their own way of dealing with implementing the spec.
*/
} catch (InconsistentTypeCode itc) {
// impossible
}
// get a hold of the default initialized Any without copying
memberAny = getAny(memberDynAny);
addComponent(i, memberName, memberAny, memberDynAny);
}
return true;
}
19
Source : DynAnyComplexImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Creates references to the parameter instead of copying it.
public void set_members(org.omg.DynamicAny.NameValuePair[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
if (value == null || value.length == 0) {
clearData();
return;
}
Any memberAny;
DynAny memberDynAny = null;
String memberName;
// We know that this is of kind tk_struct
TypeCode expectedTypeCode = any.type();
int expectedMemberCount = 0;
try {
expectedMemberCount = expectedTypeCode.member_count();
} catch (BadKind badKind) {
// impossible
}
if (expectedMemberCount != value.length) {
clearData();
throw new InvalidValue();
}
allocComponents(value);
for (int i = 0; i < value.length; i++) {
if (value[i] != null) {
memberName = value[i].id;
String expectedMemberName = null;
try {
expectedMemberName = expectedTypeCode.member_name(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
if (!(expectedMemberName.equals(memberName) || memberName.equals(""))) {
clearData();
// _REVISIT_ More info
throw new TypeMismatch();
}
memberAny = value[i].value;
TypeCode expectedMemberType = null;
try {
expectedMemberType = expectedTypeCode.member_type(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
if (!expectedMemberType.equal(memberAny.type())) {
clearData();
// _REVISIT_ More info
throw new TypeMismatch();
}
try {
// Creates the appropriate subtype without copying the Any
memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
} catch (InconsistentTypeCode itc) {
throw new InvalidValue();
}
addComponent(i, memberName, memberAny, memberDynAny);
} else {
clearData();
// _REVISIT_ More info
throw new InvalidValue();
}
}
index = (value.length == 0 ? NO_INDEX : 0);
representations = REPRESENTATION_COMPONENTS;
}
19
Source : DynAnyComplexImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Creates references to the parameter instead of copying it.
public void set_members_as_dyn_any(org.omg.DynamicAny.NameDynAnyPair[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
if (value == null || value.length == 0) {
clearData();
return;
}
Any memberAny;
DynAny memberDynAny;
String memberName;
// We know that this is of kind tk_struct
TypeCode expectedTypeCode = any.type();
int expectedMemberCount = 0;
try {
expectedMemberCount = expectedTypeCode.member_count();
} catch (BadKind badKind) {
// impossible
}
if (expectedMemberCount != value.length) {
clearData();
throw new InvalidValue();
}
allocComponents(value);
for (int i = 0; i < value.length; i++) {
if (value[i] != null) {
memberName = value[i].id;
String expectedMemberName = null;
try {
expectedMemberName = expectedTypeCode.member_name(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
if (!(expectedMemberName.equals(memberName) || memberName.equals(""))) {
clearData();
// _REVISIT_ More info
throw new TypeMismatch();
}
memberDynAny = value[i].value;
memberAny = getAny(memberDynAny);
TypeCode expectedMemberType = null;
try {
expectedMemberType = expectedTypeCode.member_type(i);
} catch (BadKind badKind) {
// impossible
} catch (Bounds bounds) {
// impossible
}
if (!expectedMemberType.equal(memberAny.type())) {
clearData();
// _REVISIT_ More info
throw new TypeMismatch();
}
addComponent(i, memberName, memberAny, memberDynAny);
} else {
clearData();
// _REVISIT_ More info
throw new InvalidValue();
}
}
index = (value.length == 0 ? NO_INDEX : 0);
representations = REPRESENTATION_COMPONENTS;
}
19
Source : DynAnyCollectionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
abstract clreplaced DynAnyCollectionImpl extends DynAnyConstructedImpl {
//
// Instance variables
//
// Keep in sync with DynAny[] components at all times.
Any[] anys = null;
//
// Constructors
//
private DynAnyCollectionImpl() {
this(null, (Any) null, false);
}
protected DynAnyCollectionImpl(ORB orb, Any any, boolean copyValue) {
super(orb, any, copyValue);
}
protected DynAnyCollectionImpl(ORB orb, TypeCode typeCode) {
super(orb, typeCode);
}
//
// Utility methods
//
protected void createDefaultComponentAt(int i, TypeCode contentType) {
try {
components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb);
} catch (InconsistentTypeCode itc) {
// impossible
}
// get a hold of the default initialized Any without copying
anys[i] = getAny(components[i]);
}
protected TypeCode getContentType() {
try {
return any.type().content_type();
} catch (BadKind badKind) {
// impossible
return null;
}
}
// This method has a different meaning for sequence and array:
// For sequence value of 0 indicates an unbounded sequence,
// values > 0 indicate a bounded sequence.
// For array any value indicates the boundary.
protected int getBound() {
try {
return any.type().length();
} catch (BadKind badKind) {
// impossible
return 0;
}
}
//
// DynAny interface methods
//
// _REVISIT_ More efficient copy operation
//
// Collection methods
//
public org.omg.CORBA.Any[] get_elements() {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
return (checkInitComponents() ? anys : null);
}
protected abstract void checkValue(Object[] value) throws org.omg.DynamicAny.DynAnyPackage.InvalidValue;
// Initializes the elements of the ordered collection.
// If value does not contain the same number of elements as the array dimension,
// the operation raises InvalidValue.
// If one or more elements have a type that is inconsistent with the collections TypeCode,
// the operation raises TypeMismatch.
// This operation does not change the current position.
public void set_elements(org.omg.CORBA.Any[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
checkValue(value);
components = new DynAny[value.length];
anys = value;
// 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();
}
try {
// Creates the appropriate subtype without copying the Any
components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false);
// System.out.println(this + " created component " + components[i]);
} catch (InconsistentTypeCode itc) {
throw new InvalidValue();
}
} 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;
}
public org.omg.DynamicAny.DynAny[] get_elements_as_dyn_any() {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
return (checkInitComponents() ? components : null);
}
// Same semantics as set_elements(Any[])
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;
}
}
19
Source : DynAnyCollectionImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
// Initializes the elements of the ordered collection.
// If value does not contain the same number of elements as the array dimension,
// the operation raises InvalidValue.
// If one or more elements have a type that is inconsistent with the collections TypeCode,
// the operation raises TypeMismatch.
// This operation does not change the current position.
public void set_elements(org.omg.CORBA.Any[] value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
checkValue(value);
components = new DynAny[value.length];
anys = value;
// 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();
}
try {
// Creates the appropriate subtype without copying the Any
components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false);
// System.out.println(this + " created component " + components[i]);
} catch (InconsistentTypeCode itc) {
throw new InvalidValue();
}
} 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;
}
19
Source : DynAnyBasicImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void insert_any(org.omg.CORBA.Any value) 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_any)
throw new TypeMismatch();
any.insert_any(value);
}
19
Source : DynAnyBasicImpl.java
with MIT License
from wupeixuan
with MIT License
from wupeixuan
public void from_any(org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue {
if (status == STATUS_DESTROYED) {
throw wrapper.dynAnyDestroyed();
}
super.from_any(value);
index = NO_INDEX;
}
See More Examples