FileDocCategorySizeDatePackage
DynAnyImpl.javaAPI DocJava SE 5 API5830Fri Aug 26 14:54:20 BST 2005com.sun.corba.se.impl.dynamicany

DynAnyImpl

public abstract class DynAnyImpl extends org.omg.CORBA.LocalObject implements DynAny

Fields Summary
protected static final int
NO_INDEX
protected static final byte
STATUS_DESTROYABLE
protected static final byte
STATUS_UNDESTROYABLE
protected static final byte
STATUS_DESTROYED
protected com.sun.corba.se.spi.orb.ORB
orb
protected com.sun.corba.se.impl.logging.ORBUtilSystemException
wrapper
protected org.omg.CORBA.Any
any
protected byte
status
protected int
index
private String[]
__ids
Constructors Summary
protected DynAnyImpl()


    //
    // Constructors
    //

      
	wrapper = ORBUtilSystemException.get( 
            CORBALogDomains.RPC_PRESENTATION ) ;
    
protected DynAnyImpl(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.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(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.TypeCode typeCode)

        this.orb = orb;
	wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PRESENTATION ) ;
        this.any = DynAnyUtil.createDefaultAnyOfType(typeCode, orb);
    
Methods Summary
public java.lang.String[]_ids()


       
        return __ids;
    
public voidassign(org.omg.DynamicAny.DynAny dyn_any)

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        if ((any != null) && (! any.type().equal(dyn_any.type()))) {
            throw new TypeMismatch();
        }
        any = dyn_any.to_any();
    
protected voidclearData()

        // This clears the data part of the Any while keeping the TypeCode info.
        any.type(any.type());
    
public abstract org.omg.DynamicAny.DynAnycopy()

public abstract voiddestroy()

public abstract booleanequal(org.omg.DynamicAny.DynAny dyn_any)

protected DynAnyFactoryfactory()

        try {
            return (DynAnyFactory)orb.resolve_initial_references( 
		ORBConstants.DYN_ANY_FACTORY_NAME );
        } catch (InvalidName in) {
            throw new RuntimeException("Unable to find DynAnyFactory");
        }
    
public voidfrom_any(org.omg.CORBA.Any value)

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        if ((any != null) && (! any.type().equal(value.type()))) {
            throw new TypeMismatch();
        }
        // If the passed 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;
   
protected org.omg.CORBA.AnygetAny()

        return any;
    
protected org.omg.CORBA.AnygetAny(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 voidsetStatus(byte newStatus)

        status = newStatus;
    
public abstract org.omg.CORBA.Anyto_any()

public org.omg.CORBA.TypeCodetype()

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        return any.type();
    
protected voidwriteAny(org.omg.CORBA.portable.OutputStream out)

        //System.out.println(this + " writeAny of type " + type().kind().value());
        any.write_value(out);