org.omg.CORBA.Any - java examples

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.

74 Examples 7

19 View Complete Implementation : IDLJavaSerializationInputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : PIHandlerImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * 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 View Complete Implementation : DynAnyUtil.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : CDROutputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
    impl.write_any_array(seq, offset, length);
}

19 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynAnyConstructedImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : CDREncapsCodec.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * 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 View Complete Implementation : DynAnyCollectionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : PINoOpHandlerImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError {
    return null;
}

19 View Complete Implementation : DynAnyComplexImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynValueBoxImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynAnyComplexImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : CDROutputStreamBase.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public abstract void write_any(Any value);

19 View Complete Implementation : DynAnyBasicImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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;
}

19 View Complete Implementation : IDLJavaSerializationOutputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : DynAnyImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : PICurrent.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * 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 View Complete Implementation : RequestImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// REVISIT -  make protected after development - so xgiop can get it.
public void unmarshalReply(InputStream is) {
    // First unmarshal the return value if it is not void
    if (_result != null) {
        Any returnAny = _result.value();
        TypeCode returnType = returnAny.type();
        if (returnType.kind().value() != TCKind._tk_void)
            returnAny.read_value(is, returnType);
    }
    // Now unmarshal the out/inout args
    try {
        for (int i = 0; i < _arguments.count(); i++) {
            NamedValue nv = _arguments.item(i);
            switch(nv.flags()) {
                case ARG_IN.value:
                    break;
                case ARG_OUT.value:
                case ARG_INOUT.value:
                    Any any = nv.value();
                    any.read_value(is, any.type());
                    break;
            }
        }
    } catch (org.omg.CORBA.Bounds ex) {
    // Cannot happen since we only iterate till _arguments.count()
    }
}

19 View Complete Implementation : PINoOpHandlerImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void setServerPIInfo(Any result) {
}

19 View Complete Implementation : DynAnyUtil.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/*
    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 View Complete Implementation : DynSequenceImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : ServerRequestImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void set_exception(Any exc) {
    // except can be called by the DIR at any time (CORBA 2.2 section 6.3).
    if (exc == null)
        throw _wrapper.setExceptionCalledNullArgs();
    // Ensure that the Any contains a SystemException or a
    // UserException. If the UserException is not a declared exception,
    // the client will get an UNKNOWN exception.
    TCKind kind = exc.type().kind();
    if (kind != TCKind.tk_except)
        throw _wrapper.setExceptionCalledBadType();
    _exception = exc;
    // Inform Portable interceptors of the exception that was set
    // so sending_exception can return the right value.
    _orb.getPIHandler().setServerPIExceptionInfo(_exception);
    // The user can only call arguments once and not at all after
    // set_exception.  (internal flags ensure this).  However, the user
    // can call set_exception multiple times.  Therefore, we only
    // invoke receive_request the first time set_exception is
    // called (if they haven't already called arguments).
    if (!_exceptionSet && !_paramsCalled) {
        // We need to invoke intermediate points here.
        _orb.getPIHandler().invokeServerPIIntermediatePoint();
    }
    _exceptionSet = true;
// actual marshaling of the reply msg header and exception takes place
// after the DSI returns control to the ORB.
}

19 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynAnyComplexImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
private Any memberLabel(int i) {
    Any memberLabel = null;
    try {
        memberLabel = any.type().member_label(i);
    } catch (BadKind bad) {
    } catch (Bounds bounds) {
    }
    return memberLabel;
}

19 View Complete Implementation : DynAnyComplexImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : CDROutputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public final void write_any(Any value) {
    impl.write_any(value);
}

19 View Complete Implementation : ServerRequestImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public clreplaced ServerRequestImpl extends ServerRequest {

    // /////////////////////////////////////////////////////////////////////////
    // data members
    private ORB _orb = null;

    private ORBUtilSystemException _wrapper = null;

    private String _opName = null;

    private NVList _arguments = null;

    private Context _ctx = null;

    private InputStream _ins = null;

    // booleans to check for various operation invocation restrictions
    private boolean _paramsCalled = false;

    private boolean _resultSet = false;

    private boolean _exceptionSet = false;

    private Any _resultAny = null;

    private Any _exception = null;

    public ServerRequestImpl(CorbaMessageMediator req, ORB orb) {
        _opName = req.getOperationName();
        _ins = (InputStream) req.getInputObject();
        // if we support contexts, this would
        _ctx = null;
        // presumably also  be available on
        // the server invocation
        _orb = orb;
        _wrapper = ORBUtilSystemException.get(orb, CORBALogDomains.OA_INVOCATION);
    }

    public String operation() {
        return _opName;
    }

    public void arguments(NVList args) {
        if (_paramsCalled)
            throw _wrapper.argumentsCalledMultiple();
        if (_exceptionSet)
            throw _wrapper.argumentsCalledAfterException();
        if (args == null)
            throw _wrapper.argumentsCalledNullArgs();
        _paramsCalled = true;
        NamedValue arg = null;
        for (int i = 0; i < args.count(); i++) {
            try {
                arg = args.item(i);
            } catch (Bounds e) {
                throw _wrapper.boundsCannotOccur(e);
            }
            try {
                if ((arg.flags() == org.omg.CORBA.ARG_IN.value) || (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
                    // unmarshal the value into the Any
                    arg.value().read_value(_ins, arg.value().type());
                }
            } catch (Exception ex) {
                throw _wrapper.badArgumentsNvlist(ex);
            }
        }
        // hang on to the NVList for marshaling the result
        _arguments = args;
        _orb.getPIHandler().setServerPIInfo(_arguments);
        _orb.getPIHandler().invokeServerPIIntermediatePoint();
    }

    public void set_result(Any res) {
        // check for invocation restrictions
        if (!_paramsCalled)
            throw _wrapper.argumentsNotCalled();
        if (_resultSet)
            throw _wrapper.setResultCalledMultiple();
        if (_exceptionSet)
            throw _wrapper.setResultAfterException();
        if (res == null)
            throw _wrapper.setResultCalledNullArgs();
        _resultAny = res;
        _resultSet = true;
        // Notify portable interceptors of the result so that
        // ServerRequestInfo.result() functions as desired.
        _orb.getPIHandler().setServerPIInfo(_resultAny);
    // actual marshaling of the reply msg header and params takes place
    // after the DSI returns control to the ORB.
    }

    public void set_exception(Any exc) {
        // except can be called by the DIR at any time (CORBA 2.2 section 6.3).
        if (exc == null)
            throw _wrapper.setExceptionCalledNullArgs();
        // Ensure that the Any contains a SystemException or a
        // UserException. If the UserException is not a declared exception,
        // the client will get an UNKNOWN exception.
        TCKind kind = exc.type().kind();
        if (kind != TCKind.tk_except)
            throw _wrapper.setExceptionCalledBadType();
        _exception = exc;
        // Inform Portable interceptors of the exception that was set
        // so sending_exception can return the right value.
        _orb.getPIHandler().setServerPIExceptionInfo(_exception);
        // The user can only call arguments once and not at all after
        // set_exception.  (internal flags ensure this).  However, the user
        // can call set_exception multiple times.  Therefore, we only
        // invoke receive_request the first time set_exception is
        // called (if they haven't already called arguments).
        if (!_exceptionSet && !_paramsCalled) {
            // We need to invoke intermediate points here.
            _orb.getPIHandler().invokeServerPIIntermediatePoint();
        }
        _exceptionSet = true;
    // actual marshaling of the reply msg header and exception takes place
    // after the DSI returns control to the ORB.
    }

    /**
     * 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 (// normal invocation return
        _paramsCalled && _resultSet)
            return null;
        else if (_paramsCalled && !_resultSet && !_exceptionSet) {
            try {
                // Neither a result nor an exception has been set.
                // replacedume 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);
        }
    }

    /**
     * This is called from the ORB after the DynamicImplementation.invoke
     *  returns. Here we marshal the return value and inout/out params.
     */
    public void marshalReplyParams(OutputStream os) {
        // marshal the operation return value
        _resultAny.write_value(os);
        // marshal the inouts/outs
        NamedValue arg = null;
        for (int i = 0; i < _arguments.count(); i++) {
            try {
                arg = _arguments.item(i);
            } catch (Bounds e) {
            }
            if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) || (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
                arg.value().write_value(os);
            }
        }
    }

    public Context ctx() {
        if (!_paramsCalled || _resultSet || _exceptionSet)
            throw _wrapper.contextCalledOutOfOrder();
        throw _wrapper.contextNotImplemented();
    }
}

19 View Complete Implementation : CDROutputStreamBase.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public abstract void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length);

19 View Complete Implementation : DynAnyConstructedImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : IDLJavaSerializationInputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : NamedValueImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public clreplaced NamedValueImpl extends NamedValue {

    private String _name;

    private Any _value;

    private int _flags;

    private ORB _orb;

    public NamedValueImpl(ORB orb) {
        // Note: This orb could be an instanceof ORBSingleton or ORB
        _orb = orb;
        _value = new AnyImpl(_orb);
    }

    public NamedValueImpl(ORB orb, String name, Any value, int flags) {
        // Note: This orb could be an instanceof ORBSingleton or ORB
        _orb = orb;
        _name = name;
        _value = value;
        _flags = flags;
    }

    public String name() {
        return _name;
    }

    public Any value() {
        return _value;
    }

    public int flags() {
        return _flags;
    }
}

19 View Complete Implementation : IDLJavaSerializationOutputStream.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : DynAnyFactoryImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 
// 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 View Complete Implementation : CDREncapsCodec.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * 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 View Complete Implementation : DynAnyBasicImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : CDREncapsCodec.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * 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 View Complete Implementation : DynAnyUtil.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : PIHandlerImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void setServerPIExceptionInfo(Any exception) {
    if (!hreplacederverInterceptors)
        return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
    info.setDSIException(exception);
}

19 View Complete Implementation : AnyImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
static AnyImpl convertToNative(ORB orb, Any any) {
    if (any instanceof AnyImpl) {
        return (AnyImpl) any;
    } else {
        AnyImpl anyImpl = new AnyImpl(orb, any);
        anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode);
        return anyImpl;
    }
}

19 View Complete Implementation : PIHandlerImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void setServerPIInfo(Any result) {
    if (!hreplacederverInterceptors)
        return;
    ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
    info.setDSIResult(result);
}

19 View Complete Implementation : DynAnyUtil.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : DynAnyCollectionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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 View Complete Implementation : AnyImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_any(Any a) {
    // debug.log ("insert_any");
    typeCode = orb.get_primitive_tc(TCKind._tk_any);
    object = a;
    stream = null;
    isInitialized = true;
}

19 View Complete Implementation : ContextImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void set_one_value(String propName, Any propValue) {
    throw wrapper.contextNotImplemented();
}

19 View Complete Implementation : ServerRequestImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
public void set_result(Any res) {
    // check for invocation restrictions
    if (!_paramsCalled)
        throw _wrapper.argumentsNotCalled();
    if (_resultSet)
        throw _wrapper.setResultCalledMultiple();
    if (_exceptionSet)
        throw _wrapper.setResultAfterException();
    if (res == null)
        throw _wrapper.setResultCalledNullArgs();
    _resultAny = res;
    _resultSet = true;
    // Notify portable interceptors of the result so that
    // ServerRequestInfo.result() functions as desired.
    _orb.getPIHandler().setServerPIInfo(_resultAny);
// actual marshaling of the reply msg header and params takes place
// after the DSI returns control to the ORB.
}

19 View Complete Implementation : DynAnyComplexImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
// 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 View Complete Implementation : DynUnionImpl.java
Copyright GNU General Public License v2.0
Author : AdoptOpenJDK
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;
}