Java Code Examples for com.sun.corba.se.spi.presentation.rmi.StubAdapter#isStub()
The following examples show how to use
com.sun.corba.se.spi.presentation.rmi.StubAdapter#isStub() .
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: ORBUtility.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** Obtains an IOR for the object reference obj, first connecting it to * the ORB if necessary. * @return IOR the IOR that represents this objref. This will * never be null. * @exception BAD_OPERATION if the object could not be connected, * if a connection attempt was needed. * @exception BAD_PARAM if obj is a local object, or else was * created by a foreign ORB. */ public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj ) { IOR result ; try { result = getIOR( obj ) ; } catch (BAD_OPERATION bop) { if (StubAdapter.isStub(obj)) { try { StubAdapter.connect( obj, orb ) ; } catch (java.rmi.RemoteException exc) { throw wrapper.connectingServant( exc ) ; } } else { orb.connect( obj ) ; } result = getIOR( obj ) ; } return result ; }
Example 2
Source File: PortableRemoteObject.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Deregisters a server object from the runtime, allowing the object to become * available for garbage collection. * @param obj the object to unexport. * @exception NoSuchObjectException if the remote object is not * currently exported. */ public void unexportObject(Remote obj) throws NoSuchObjectException { if (obj == null) { throw new NullPointerException("invalid argument"); } if (StubAdapter.isStub(obj) || obj instanceof java.rmi.server.RemoteStub) { throw new NoSuchObjectException( "Can only unexport a server object."); } Tie theTie = Util.getTie(obj); if (theTie != null) { Util.unexportObject(obj); } else { if (Utility.loadTie(obj) == null) { UnicastRemoteObject.unexportObject(obj,true); } else { throw new NoSuchObjectException("Object not exported."); } } }
Example 3
Source File: ORBUtility.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** Obtains an IOR for the object reference obj, first connecting it to * the ORB if necessary. * @return IOR the IOR that represents this objref. This will * never be null. * @exception BAD_OPERATION if the object could not be connected, * if a connection attempt was needed. * @exception BAD_PARAM if obj is a local object, or else was * created by a foreign ORB. */ public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj ) { IOR result ; try { result = getIOR( obj ) ; } catch (BAD_OPERATION bop) { if (StubAdapter.isStub(obj)) { try { StubAdapter.connect( obj, orb ) ; } catch (java.rmi.RemoteException exc) { throw wrapper.connectingServant( exc ) ; } } else { orb.connect( obj ) ; } result = getIOR( obj ) ; } return result ; }
Example 4
Source File: AnyImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_Object(org.omg.CORBA.Object o) { //debug.log ("insert_Object"); if ( o == null ) { typeCode = orb.get_primitive_tc(TCKind._tk_objref); } else { if (StubAdapter.isStub(o)) { String[] ids = StubAdapter.getTypeIds( o ) ; typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], ""); } else { throw wrapper.badInsertobjParam( CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ; } } object = o; isInitialized = true; }
Example 5
Source File: IDLJavaSerializationInputStream.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Connect the Stub to the ORB. */ protected final Object resolveObject(Object obj) throws IOException { try { if (StubAdapter.isStub(obj)) { StubAdapter.connect(obj, orb); } } catch (java.rmi.RemoteException re) { IOException ie = new IOException("resolveObject failed"); ie.initCause(re); throw ie; } return obj; }
Example 6
Source File: ServerRequestInfoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 7
Source File: IDLJavaSerializationInputStream.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Connect the Stub to the ORB. */ protected final Object resolveObject(Object obj) throws IOException { try { if (StubAdapter.isStub(obj)) { StubAdapter.connect(obj, orb); } } catch (java.rmi.RemoteException re) { IOException ie = new IOException("resolveObject failed"); ie.initCause(re); throw ie; } return obj; }
Example 8
Source File: ServerRequestInfoImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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 9
Source File: IDLJavaSerializationInputStream.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Connect the Stub to the ORB. */ protected final Object resolveObject(Object obj) throws IOException { try { if (StubAdapter.isStub(obj)) { StubAdapter.connect(obj, orb); } } catch (java.rmi.RemoteException re) { IOException ie = new IOException("resolveObject failed"); ie.initCause(re); throw ie; } return obj; }
Example 10
Source File: IDLJavaSerializationOutputStream.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Checks for objects that are instances of java.rmi.Remote * that need to be serialized as proxy (Stub) objects. */ protected final Object replaceObject(Object obj) throws IOException { try { if ((obj instanceof java.rmi.Remote) && !(StubAdapter.isStub(obj))) { return Utility.autoConnect(obj, orb, true); } } catch (Exception e) { IOException ie = new IOException("replaceObject failed"); ie.initCause(e); throw ie; } return obj; }
Example 11
Source File: ORBImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * If this operation is called with an id, <code>"Y"</code>, and an * object, <code>YY</code>, then a subsequent call to * <code>ORB.resolve_initial_references( "Y" )</code> will * return object <code>YY</code>. * * @param id The ID by which the initial reference will be known. * @param obj The initial reference itself. * @throws InvalidName if this operation is called with an empty string id * or this operation is called with an id that is already registered, * including the default names defined by OMG. * @throws BAD_PARAM if the obj parameter is null. */ public void register_initial_reference( String id, org.omg.CORBA.Object obj ) throws InvalidName { CorbaServerRequestDispatcher insnd ; synchronized (this) { checkShutdownState(); } if ((id == null) || (id.length() == 0)) throw new InvalidName() ; synchronized (this) { checkShutdownState(); } synchronized (resolverLock) { insnd = insNamingDelegate ; java.lang.Object obj2 = localResolver.resolve( id ) ; if (obj2 != null) throw new InvalidName(id + " already registered") ; localResolver.register( id, ClosureFactory.makeConstant( obj )) ; } synchronized (this) { if (StubAdapter.isStub(obj)) // Make all remote object references available for INS. requestDispatcherRegistry.registerServerRequestDispatcher( insnd, id ) ; } }
Example 12
Source File: CorbaClientDelegateImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public boolean is_equivalent(org.omg.CORBA.Object obj, org.omg.CORBA.Object ref) { if ( ref == null ) return false; // If ref is a local object, it is not a Stub! if (!StubAdapter.isStub(ref)) return false ; Delegate del = StubAdapter.getDelegate(ref) ; if (del == null) return false ; // Optimize the x.is_equivalent( x ) case if (del == this) return true; // If delegate was created by a different ORB, return false if (!(del instanceof CorbaClientDelegateImpl)) return false ; CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ; CorbaContactInfoList ccil = (CorbaContactInfoList)corbaDelegate.getContactInfoList() ; return this.contactInfoList.getTargetIOR().isEquivalent( ccil.getTargetIOR() ); }
Example 13
Source File: IDLJavaSerializationInputStream.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Connect the Stub to the ORB. */ protected final Object resolveObject(Object obj) throws IOException { try { if (StubAdapter.isStub(obj)) { StubAdapter.connect(obj, orb); } } catch (java.rmi.RemoteException re) { IOException ie = new IOException("resolveObject failed"); ie.initCause(re); throw ie; } return obj; }
Example 14
Source File: ServerRequestInfoImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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: IDLJavaSerializationOutputStream.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Checks for objects that are instances of java.rmi.Remote * that need to be serialized as proxy (Stub) objects. */ protected final Object replaceObject(Object obj) throws IOException { try { if ((obj instanceof java.rmi.Remote) && !(StubAdapter.isStub(obj))) { return Utility.autoConnect(obj, orb, true); } } catch (Exception e) { IOException ie = new IOException("replaceObject failed"); ie.initCause(e); throw ie; } return obj; }
Example 16
Source File: ServerRequestInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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 17
Source File: ServerRequestInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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: CorbaClientDelegateImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public boolean is_equivalent(org.omg.CORBA.Object obj, org.omg.CORBA.Object ref) { if ( ref == null ) return false; // If ref is a local object, it is not a Stub! if (!StubAdapter.isStub(ref)) return false ; Delegate del = StubAdapter.getDelegate(ref) ; if (del == null) return false ; // Optimize the x.is_equivalent( x ) case if (del == this) return true; // If delegate was created by a different ORB, return false if (!(del instanceof CorbaClientDelegateImpl)) return false ; CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ; CorbaContactInfoList ccil = (CorbaContactInfoList)corbaDelegate.getContactInfoList() ; return this.contactInfoList.getTargetIOR().isEquivalent( ccil.getTargetIOR() ); }
Example 19
Source File: ORBUtility.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** This method obtains an IOR from a CORBA object reference. * It will return null if obj is a local object, a null object, * or an object implemented by a different ORB. It will * throw BAD_OPERATION if obj is an unconnected RMI-IIOP object. * @return IOR the IOR that represents this objref. This will * never be null. * @exception BAD_OPERATION (from oi._get_delegate) if obj is a * normal objref, but does not have a delegate set. * @exception BAD_PARAM if obj is a local object, or else was * created by a foreign ORB. */ public static IOR getIOR( org.omg.CORBA.Object obj ) { if (obj == null) throw wrapper.nullObjectReference() ; IOR ior = null ; if (StubAdapter.isStub(obj)) { org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( obj ) ; if (del instanceof CorbaClientDelegate) { CorbaClientDelegate cdel = (CorbaClientDelegate)del ; ContactInfoList cil = cdel.getContactInfoList() ; if (cil instanceof CorbaContactInfoList) { CorbaContactInfoList ccil = (CorbaContactInfoList)cil ; ior = ccil.getTargetIOR() ; if (ior == null) throw wrapper.nullIor() ; return ior ; } else { // This is our code, but the ContactInfoList is not a // CorbaContactInfoList. This should not happen, because // we are in the CORBA application of the DCSA framework. // This is a coding error, and thus an INTERNAL exception // should be thrown. // XXX needs minor code throw new INTERNAL() ; } } // obj is implemented by a foreign ORB, because the Delegate is not a // ClientDelegate. // XXX this case could be handled by marshalling and // unmarshalling. However, object_to_string cannot be used // here, as it is implemented with getIOR. Note that this // will require access to an ORB, so that we can create streams // as needed. The ORB is available simply as io._orb(). throw wrapper.objrefFromForeignOrb() ; } else throw wrapper.localObjectNotAllowed() ; }
Example 20
Source File: ORBUtility.java From hottub with GNU General Public License v2.0 | 4 votes |
/** This method obtains an IOR from a CORBA object reference. * It will return null if obj is a local object, a null object, * or an object implemented by a different ORB. It will * throw BAD_OPERATION if obj is an unconnected RMI-IIOP object. * @return IOR the IOR that represents this objref. This will * never be null. * @exception BAD_OPERATION (from oi._get_delegate) if obj is a * normal objref, but does not have a delegate set. * @exception BAD_PARAM if obj is a local object, or else was * created by a foreign ORB. */ public static IOR getIOR( org.omg.CORBA.Object obj ) { if (obj == null) throw wrapper.nullObjectReference() ; IOR ior = null ; if (StubAdapter.isStub(obj)) { org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( obj ) ; if (del instanceof CorbaClientDelegate) { CorbaClientDelegate cdel = (CorbaClientDelegate)del ; ContactInfoList cil = cdel.getContactInfoList() ; if (cil instanceof CorbaContactInfoList) { CorbaContactInfoList ccil = (CorbaContactInfoList)cil ; ior = ccil.getTargetIOR() ; if (ior == null) throw wrapper.nullIor() ; return ior ; } else { // This is our code, but the ContactInfoList is not a // CorbaContactInfoList. This should not happen, because // we are in the CORBA application of the DCSA framework. // This is a coding error, and thus an INTERNAL exception // should be thrown. // XXX needs minor code throw new INTERNAL() ; } } // obj is implemented by a foreign ORB, because the Delegate is not a // ClientDelegate. // XXX this case could be handled by marshalling and // unmarshalling. However, object_to_string cannot be used // here, as it is implemented with getIOR. Note that this // will require access to an ORB, so that we can create streams // as needed. The ORB is available simply as io._orb(). throw wrapper.objrefFromForeignOrb() ; } else throw wrapper.localObjectNotAllowed() ; }