org.omg.CORBA.Object Java Examples

The following examples show how to use org.omg.CORBA.Object. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransientNamingContext.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new TransientNamingContext object.
 * @param orb an orb object.
 * @param initial the initial naming context.
 * @exception Exception a Java exception thrown of the base class cannot
 * initialize.
 */
public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
    org.omg.CORBA.Object initial,
    POA nsPOA )
    throws java.lang.Exception
{
    super(orb, nsPOA );
    wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;

    this.localRoot = initial;
    readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
    updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
    lifecycleLogger = orb.getLogger(
        CORBALogDomains.NAMING_LIFECYCLE);
    lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
}
 
Example #2
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
    }
    org.omg.CosNaming.NameComponent[] theNameComponents =
            getINSImpl().convertToNameComponent( sn );
    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #3
Source File: CDROutputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public void write_Object(org.omg.CORBA.Object ref)
{
    if (ref == null) {
        IOR nullIOR = IORFactories.makeIOR( orb ) ;
        nullIOR.write(parent);
        return;
    }

    // IDL to Java formal 01-06-06 1.21.4.2
    if (ref instanceof org.omg.CORBA.LocalObject)
        throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);

    IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
    ior.write(parent);
    return;
}
 
Example #4
Source File: ClientRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * The actual object on which the operation will be invoked.  If the
 * reply_status is LOCATION_FORWARD, then on subsequent requests,
 * effective_target will contain the forwarded IOR while target will
 * remain unchanged.
 */
public org.omg.CORBA.Object effective_target() {
    // access is currently valid for all states:
    //checkAccess( MID_EFFECTIVE_TARGET );

    // Note: This is not necessarily the same as locatedIOR.
    // Reason: See the way we handle COMM_FAILURES in
    // ClientRequestDispatcher.createRequest, v1.32

    if (cachedEffectiveTargetObject == null) {
        CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
            messageMediator.getContactInfo();
        // REVISIT - get through chain like getLocatedIOR helper below.
        cachedEffectiveTargetObject =
            iorToObject(corbaContactInfo.getEffectiveTargetIOR());
    }
    return cachedEffectiveTargetObject;
}
 
Example #5
Source File: ClientRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Object forward_reference (){
    checkAccess( MID_FORWARD_REFERENCE );
    // Check to make sure we are in LOCATION_FORWARD
    // state as per ptc/00-08-06, table 21-1
    // footnote 2.
    if( replyStatus != LOCATION_FORWARD.value ) {
        throw stdWrapper.invalidPiCall1() ;
    }

    // Do not cache this value since if an interceptor raises
    // forward request then the next interceptor in the
    // list should see the new value.
    IOR ior = getLocatedIOR();
    return iorToObject(ior);
}
 
Example #6
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #7
Source File: TransientNamingContext.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example #8
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * This operation resolves the Stringified name into the object
 * reference.
 * @param sn Stringified Name of the object <p>
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 * Indicates there is no object reference for the given name. <p>
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 * Indicates that the given compound name is incorrect <p>
 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 * Indicates the name does not identify a binding.<p>
 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 * Indicates the name is already bound.<p>
 *
 */
public org.omg.CORBA.Object resolve_str(String sn)
    throws org.omg.CosNaming.NamingContextPackage.NotFound,
           org.omg.CosNaming.NamingContextPackage.CannotProceed,
           org.omg.CosNaming.NamingContextPackage.InvalidName
{
    org.omg.CORBA.Object theObject = null;
    // Name valid?
    if  ( (sn == null ) || (sn.length() == 0) )
    {
            throw new InvalidName();
    }
    NamingContextDataStore impl = (NamingContextDataStore)this;
    org.omg.CosNaming.NameComponent[] theNameComponents =
            insImpl.convertToNameComponent( sn );

    if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
    {
            throw new InvalidName();
    }
    theObject = resolve( theNameComponents );
    return theObject;
}
 
Example #9
Source File: ClientRequestInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Object forward_reference (){
    checkAccess( MID_FORWARD_REFERENCE );
    // Check to make sure we are in LOCATION_FORWARD
    // state as per ptc/00-08-06, table 21-1
    // footnote 2.
    if( replyStatus != LOCATION_FORWARD.value ) {
        throw stdWrapper.invalidPiCall1() ;
    }

    // Do not cache this value since if an interceptor raises
    // forward request then the next interceptor in the
    // list should see the new value.
    IOR ior = getLocatedIOR();
    return iorToObject(ior);
}
 
Example #10
Source File: TransientNamingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new TransientNamingContext object.
 * @param orb an orb object.
 * @param initial the initial naming context.
 * @exception Exception a Java exception thrown of the base class cannot
 * initialize.
 */
public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
    org.omg.CORBA.Object initial,
    POA nsPOA )
    throws java.lang.Exception
{
    super(orb, nsPOA );
    wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;

    this.localRoot = initial;
    readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
    updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
    lifecycleLogger = orb.getLogger(
        CORBALogDomains.NAMING_LIFECYCLE);
    lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
}
 
Example #11
Source File: TransientNamingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Binds the object to the name component as the specified binding type.
 * It creates a InternalBindingKey object and a InternalBindingValue
 * object and inserts them in the hash table.
 * @param n A single org.omg.CosNaming::NameComponent under which the
 * object will be bound.
 * @param obj An object reference to be bound under the supplied name.
 * @param bt The type of the binding (i.e., as object or as context).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
                       BindingType bt)
    throws org.omg.CORBA.SystemException
{
    // Create a key and a value
    InternalBindingKey key = new InternalBindingKey(n);
    NameComponent[] name = new NameComponent[1];
    name[0] = n;
    Binding b = new Binding(name,bt);
    InternalBindingValue value = new InternalBindingValue(b,null);
    value.theObjectRef = obj;
    // insert it
    InternalBindingValue oldValue =
        (InternalBindingValue)this.theHashtable.put(key,value);

    if (oldValue != null) {
        updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
            getName( n ) + " Was Already Bound" );
        throw wrapper.transNcBindAlreadyBound() ;
    }
    if( updateLogger.isLoggable( Level.FINE ) ) {
        updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
            "Name Component: " + n.id + "." + n.kind );
    }
}
 
Example #12
Source File: TransientNamingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deletes the binding with the supplied name. It creates a
 * InternalBindingKey and uses it to remove the value associated
 * with the key. If nothing is found an exception is thrown, otherwise
 * the element is removed from the hash table.
 * @param n a NameComponent which is the name to unbind
 * @return the object reference bound to the name, or null if not found.
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 */
public final org.omg.CORBA.Object Unbind(NameComponent n)
    throws org.omg.CORBA.SystemException
{
    // Create a key and remove it from the hashtable
    InternalBindingKey key = new InternalBindingKey(n);
    InternalBindingValue value =
        (InternalBindingValue)this.theHashtable.remove(key);

    // Return what was found
    if (value == null) {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
                " There was no binding with the name " + getName( n ) +
                " to Unbind " );
        }
        return null;
    } else {
        if( updateLogger.isLoggable( Level.FINE ) ) {
            updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
                " NameComponent:  " + getName( n ) );
        }
        return value.theObjectRef;
   }
}
 
Example #13
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void write_Object(org.omg.CORBA.Object ref)
{
    if (ref == null) {
        IOR nullIOR = IORFactories.makeIOR( orb ) ;
        nullIOR.write(parent);
        return;
    }

    // IDL to Java formal 01-06-06 1.21.4.2
    if (ref instanceof org.omg.CORBA.LocalObject)
        throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);

    IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
    ior.write(parent);
    return;
}
 
Example #14
Source File: ServerRequestInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example #15
Source File: CDRInputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example #16
Source File: CDRInputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void restoreInternalState(java.lang.Object streamMemento) {

        StreamMemento mem = (StreamMemento)streamMemento;

        blockLength = mem.blockLength_;
        end_flag = mem.end_flag_;
        chunkedValueNestingLevel = mem.chunkedValueNestingLevel_;
        valueIndirection = mem.valueIndirection_;
        stringIndirection = mem.stringIndirection_;
        isChunked = mem.isChunked_;
        valueHandler = mem.valueHandler_;
        specialNoOptionalDataState = mem.specialNoOptionalDataState_;
        bbwi = mem.bbwi_;
    }
 
Example #17
Source File: ServerRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if the servant is the given RepositoryId, false if it is
 * not.
 */
public boolean target_is_a (String id) {
    checkAccess( MID_TARGET_IS_A );

    boolean result = false ;
    if( servant instanceof Servant ) {
        result = ((Servant)servant)._is_a( id );
    } else if (StubAdapter.isStub( servant )) {
        result = ((org.omg.CORBA.Object)servant)._is_a( id );
    } else {
        throw wrapper.servantInvalid() ;
    }

    return result;
}
 
Example #18
Source File: CDRInputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public java.lang.Object read_abstract_interface(java.lang.Class clz)
{
    boolean object = read_boolean();

    if (object) {
        return read_Object(clz);
    } else {
        return read_value();
    }
}
 
Example #19
Source File: NamingContextImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference bound under the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
* components was supplied, but the first component could not be
* resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
* is invalid (i.e., has length less than 1).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();

     // Length must be greater than 0
     if (n.length < 1)
         throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
             throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         return context.resolve(tail);
     }
 }
 
Example #20
Source File: ServerRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * See ServerRequestInfo for javadocs.
 */
public Object forward_reference (){
    checkAccess( MID_FORWARD_REFERENCE );
    // Check to make sure we are in LOCATION_FORWARD
    // state as per ptc/00-08-06, table 21-2
    // footnote 2.
    if( replyStatus != LOCATION_FORWARD.value ) {
        throw stdWrapper.invalidPiCall1() ;
    }

    return getForwardRequestException().forward;
}
 
Example #21
Source File: CDROutputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void write_abstract_interface(java.lang.Object obj) {
    boolean corbaObject = false; // Assume value type.
    org.omg.CORBA.Object theObject = null;

    // Is it a CORBA.Object?

    if (obj != null && obj instanceof org.omg.CORBA.Object) {

        // Yes.

        theObject = (org.omg.CORBA.Object)obj;
        corbaObject = true;
    }

    // Write our flag...

    write_boolean(corbaObject);

    // Now write out the object...

    if (corbaObject) {
        write_Object(theObject);
    } else {
        try {
            write_value((java.io.Serializable)obj);
        } catch(ClassCastException cce) {
            if (obj instanceof java.io.Serializable)
                throw cce;
            else
                ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
        }
    }
}
 
Example #22
Source File: ServerRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Stores the various sources of information used for this info object.
 */
protected void setInfo( java.lang.Object servant,
                        String targetMostDerivedInterface )
{
    this.servant = servant;
    this.targetMostDerivedInterface = targetMostDerivedInterface;
    this.isDynamic =
        (servant instanceof
        org.omg.PortableServer.DynamicImplementation) ||
        (servant instanceof org.omg.CORBA.DynamicImplementation);
}
 
Example #23
Source File: RequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the ForwardRequest object as a ForwardRequest exception.
 */
protected ForwardRequest getForwardRequestException() {
    if( this.forwardRequest == null ) {
        if( this.forwardRequestIOR != null ) {
            // Convert the internal IOR to a forward request exception
            // by creating an object reference.
            org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR);
            this.forwardRequest = new ForwardRequest( obj );
        }
    }

    return this.forwardRequest;
}
 
Example #24
Source File: ClientRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * The object which the client called to perform the operation.
 */
public org.omg.CORBA.Object target (){
    // access is currently valid for all states:
    //checkAccess( MID_TARGET );
    if (cachedTargetObject == null) {
        CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
            messageMediator.getContactInfo();
        cachedTargetObject =
            iorToObject(corbaContactInfo.getTargetIOR());
    }
    return cachedTargetObject;
}
 
Example #25
Source File: ServerRequestInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * See ServerRequestInfo for javadocs.
 */
public Object forward_reference (){
    checkAccess( MID_FORWARD_REFERENCE );
    // Check to make sure we are in LOCATION_FORWARD
    // state as per ptc/00-08-06, table 21-2
    // footnote 2.
    if( replyStatus != LOCATION_FORWARD.value ) {
        throw stdWrapper.invalidPiCall1() ;
    }

    return getForwardRequestException().forward;
}
 
Example #26
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Bind an object under a name in this NamingContext. If the name
 * contains multiple (n) components, n-1 will be resolved in this
 * NamingContext and the object bound in resulting NamingContext.
 * If a binding under the supplied name already exists it will be
 * unbound first. If the
 * object to be bound is a NamingContext it will not participate in
 * a recursive resolve.
 * @param n a sequence of NameComponents which is the name under which
 * the object will be bound.
 * @param obj the object reference to be bound.
 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 * multiple components was supplied, but the first component could not be
 * resolved.
 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 * proceed in resolving the n-1 components of the supplied name.
 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 * supplied name is invalid (i.e., has length less than 1).
 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 * system exceptions.
 * @see doBind
 */
public  void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
    throws       org.omg.CosNaming.NamingContextPackage.NotFound,
                 org.omg.CosNaming.NamingContextPackage.CannotProceed,
                 org.omg.CosNaming.NamingContextPackage.InvalidName
{
    if( obj == null )
    {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            " NULL Object cannot be Bound " );
        throw wrapper.objectIsNull() ;
    }
    try {
        // doBind implements all four flavors of binding
        NamingContextDataStore impl = (NamingContextDataStore)this;
        doBind(impl,n,obj,true,BindingType.nobject);
    } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
        updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
            NamingUtils.getDirectoryStructuredName( n ) +
            " is already bound to a Naming Context" );
        // This should not happen
        throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
    }
    if( updateLogger.isLoggable( Level.FINE  ) ) {
        // isLoggable call to make sure that we save some precious
        // processor cycles, if there is no need to log.
        updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
            NamingUtils.getDirectoryStructuredName( n ) );
    }
}
 
Example #27
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #28
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving names in this NamingContext. The first component
* of the supplied name is resolved in this NamingContext by calling
* Resolve(). If there are no more components in the name, the
* resulting object reference is returned. Otherwise, the resulting object
* reference must have been bound as a context and be narrowable to
* a NamingContext. If this is the case, the remaining
* components of the name is resolved in the resulting NamingContext.
* This method is static for maximal reuse - even for extended naming
* context implementations where the recursive semantics still apply.
* @param impl an implementation of NamingContextDataStore
* @param n a sequence of NameComponents which is the name to be resolved.
* @return the object reference bound under the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
* components was supplied, but the first component could not be
* resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
* is invalid (i.e., has length less than 1).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
                                              NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound,
            org.omg.CosNaming.NamingContextPackage.CannotProceed,
            org.omg.CosNaming.NamingContextPackage.InvalidName
 {
     org.omg.CORBA.Object obj = null;
     BindingTypeHolder bth = new BindingTypeHolder();

     // Length must be greater than 0
     if (n.length < 1)
         throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

     // The identifier must be set
     if (n.length == 1) {
         synchronized (impl) {
             // Resolve first level in this context
             obj = impl.Resolve(n[0],bth);
         }
         if (obj == null) {
             // Object was not found
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
         return obj;
     } else {
         // n.length > 1
         if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
             throw new org.omg.CosNaming.NamingContextPackage.InvalidName();

         NamingContext context = resolveFirstAsContext(impl,n);

         // Compute restOfName = name[1..length]
         NameComponent[] tail = new NameComponent[n.length -1];
         System.arraycopy(n,1,tail,0,n.length-1);

         // Resolve rest of name in context
         return context.resolve(tail);
     }
 }
 
Example #29
Source File: NamingContextImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
* Implements resolving a NameComponent in this context and
* narrowing it to CosNaming::NamingContext. It will throw appropriate
* exceptions if not found or not narrowable.
* @param impl an implementation of NamingContextDataStore
* @param n a NameComponents which is the name to be found.
* @exception org.omg.CosNaming.NamingContextPackage.NotFound The
* first component could not be resolved.
* @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
* in resolving the first component of the supplied name.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
* @see resolve
*/
 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
                                                      NameComponent[] n)
     throws org.omg.CosNaming.NamingContextPackage.NotFound {
     org.omg.CORBA.Object topRef = null;
     BindingTypeHolder bth = new BindingTypeHolder();
     NamingContext context = null;

     synchronized (impl) {
         // Resolve first  - must be resolveable
         topRef = impl.Resolve(n[0],bth);
         if (topRef == null) {
             // It was not bound
             throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
         }
     }

     // Was it bound as a context?
     if (bth.value != BindingType.ncontext) {
         // It was not a context
         throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
     }

     // Narrow to a naming context
     try {
         context = NamingContextHelper.narrow(topRef);
     } catch (org.omg.CORBA.BAD_PARAM ex) {
         // It was not a context
         throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
     }

     // Hmm. must be ok
     return context;
 }
 
Example #30
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void write_abstract_interface(java.lang.Object obj) {
    boolean corbaObject = false; // Assume value type.
    org.omg.CORBA.Object theObject = null;

    // Is it a CORBA.Object?

    if (obj != null && obj instanceof org.omg.CORBA.Object) {

        // Yes.

        theObject = (org.omg.CORBA.Object)obj;
        corbaObject = true;
    }

    // Write our flag...

    write_boolean(corbaObject);

    // Now write out the object...

    if (corbaObject) {
        write_Object(theObject);
    } else {
        try {
            write_value((java.io.Serializable)obj);
        } catch(ClassCastException cce) {
            if (obj instanceof java.io.Serializable)
                throw cce;
            else
                ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
        }
    }
}