当前位置: 首页>>代码示例>>Java>>正文


Java Any类代码示例

本文整理汇总了Java中org.omg.CORBA.Any的典型用法代码示例。如果您正苦于以下问题:Java Any类的具体用法?Java Any怎么用?Java Any使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Any类属于org.omg.CORBA包,在下文中一共展示了Any类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AnyImpl

import org.omg.CORBA.Any; //导入依赖的package包/类
public AnyImpl(ORB orb, Any obj) {
    this(orb);

    if ((obj instanceof AnyImpl)) {
        AnyImpl objImpl = (AnyImpl)obj;
        typeCode = objImpl.typeCode;
        value = objImpl.value;
        object = objImpl.object;
        isInitialized = objImpl.isInitialized;

        if (objImpl.stream != null)
            stream = objImpl.stream.dup();

    } else {
        read_value(obj.create_input_stream(), obj.type());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:AnyImpl.java

示例2: set_to_default_member

import org.omg.CORBA.Any; //导入依赖的package包/类
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) {}
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:DynUnionImpl.java

示例3: createTypeCode

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * When using our own ORB and Any implementations, we need to get
 * the ORB version and create the type code appropriately.  This is
 * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char
 * rather than a tk_wchar to describe a Java char field.
 *
 * This only works in RMI-IIOP with Util.writeAny since we actually
 * know what ORB and stream we're writing with when we insert
 * the value.
 *
 * Returns null if it wasn't possible to create the TypeCode (means
 * it wasn't our ORB or Any implementation).
 *
 * This does not handle null objs.
 */
private TypeCode createTypeCode(Serializable obj,
                                org.omg.CORBA.Any any,
                                org.omg.CORBA.ORB orb) {

    if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
        orb instanceof ORB) {

        com.sun.corba.se.impl.corba.AnyImpl anyImpl
            = (com.sun.corba.se.impl.corba.AnyImpl)any;

        ORB ourORB = (ORB)orb;

        return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);

    } else
        return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:Util.java

示例4: result

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ClientRequestInfoImpl.java

示例5: set_to_no_active_member

import org.omg.CORBA.Any; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:DynUnionImpl.java

示例6: create_policy

import org.omg.CORBA.Any; //导入依赖的package包/类
/** This is the implementation of standard API defined in org.omg.CORBA.ORB
 *  class. 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:PIHandlerImpl.java

示例7: from_any

import org.omg.CORBA.Any; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:DynAnyBasicImpl.java

示例8: initializeComponentsFromAny

import org.omg.CORBA.Any; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:DynUnionImpl.java

示例9: convertToNative

import org.omg.CORBA.Any; //导入依赖的package包/类
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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:AnyImpl.java

示例10: insertSystemException

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:ORBUtility.java

示例11: extract_any

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public Any extract_any()
{
    //debug.log ("extract_any");
    checkExtractBadOperation( TCKind._tk_any ) ;
    return (Any)object;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:AnyImpl.java

示例12: encodeImpl

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:CDREncapsCodec.java

示例13: create_policy

import org.omg.CORBA.Any; //导入依赖的package包/类
public synchronized org.omg.CORBA.Policy create_policy( int type,
    org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError
{
    checkShutdownState() ;

    return pihandler.create_policy( type, val ) ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ORBImpl.java

示例14: set_slot

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:SlotTable.java

示例15: received_exception

import org.omg.CORBA.Any; //导入依赖的package包/类
/**
 * Contains the exception to be returned to the client.
 */
public Any received_exception (){
    checkAccess( MID_RECEIVED_EXCEPTION );

    if( cachedReceivedException == null ) {
        cachedReceivedException = exceptionToAny( exception );
    }

    // Good citizen: In the interest of efficiency, we assume interceptors
    // will not modify the returned Any in any way so we need
    // not make a deep copy of it.

    return cachedReceivedException;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:ClientRequestInfoImpl.java


注:本文中的org.omg.CORBA.Any类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。