public synchronized POA getRootPOA() { if (rootPOA == null) { // See if we are trying to getRootPOA while shutting down the ORB. if (isShuttingDown) { throw omgWrapper.noObjectAdaptor( ) ; } try { Object obj = orb.resolve_initial_references( ORBConstants.ROOT_POA_NAME ) ; rootPOA = (POAImpl)obj ; } catch (InvalidName inv) { throw wrapper.cantResolveRootPoa( inv ) ; } } return rootPOA; }
/** * Resolve the stringified reference of one of the initially * available CORBA services. * @param identifier The stringified object reference of the * desired service. * @return An object reference for the desired service. * @exception InvalidName The supplied identifier is not associated * with a known service. * @exception SystemException One of a fixed set of Corba system exceptions. */ public org.omg.CORBA.Object resolve_initial_references( String identifier) throws InvalidName { Resolver res ; synchronized( this ) { checkShutdownState(); res = resolver ; } synchronized (resolverLock) { org.omg.CORBA.Object result = res.resolve( identifier ) ; if (result == null) throw new InvalidName() ; else return result ; } }
/** * Find and return the easily accessible CORBA object, addressed by name. * * @param name the object name. * @return the object * * @throws org.omg.CORBA.ORBPackage.InvalidName if the given name is not * associated with the known object. */ public org.omg.CORBA.Object resolve_initial_references(String name) throws InvalidName { org.omg.CORBA.Object object = null; try { object = (org.omg.CORBA.Object) initial_references.get(name); if (object == null && name.equals(NAME_SERVICE)) { object = getDefaultNameService(); if (object != null) initial_references.put(NAME_SERVICE, object); } } catch (Exception ex) { InvalidName err = new InvalidName(name); err.initCause(ex); throw err; } if (object != null) return object; else throw new InvalidName("Not found: '" + name + "'"); }
public CommunicationDelegate createDelegate(String url) throws CommunicationException { CommunicationDelegate delegate; if ( this.accepts( url ) ){ IOR ior; try { if ( url.startsWith( "corbaloc:tidorb:" ) ){ ior = Corbaloc.getIOR( url ); } else if(url.startsWith( "corbaloc::" ) || url.startsWith( "corbaloc:iiop:" )) { ior = IIOPCorbaloc.getIOR( url ); } else { ior = IIOPIOR.fromString(this.orb, url); } } catch ( InvalidName in ){ throw new CommunicationException( "Invalid url: " + in.getMessage(), in ); } delegate = createDelegate( ior ); } else { delegate = null; } return delegate; }
/** * Simulates an usual ObjectKey, that is marshaled in an Encapsulation, but * instead, the url ObjectKey is marshaled as a ulong value (the size) and * the char array of the string (without the end of string character *. * * @param url * @return * @throws org.omg.CORBA.ORBPackage.InvalidName */ private static ObjectKey createKey(String url_key) throws org.omg.CORBA.ORBPackage.InvalidName { CDROutputStream output = new CDROutputStream(null, new byte[url_key.length() + CDR.ULONG_SIZE]); char[] url_buffer = url_key.toCharArray(); output.write_ulong(url_buffer.length); output.write_char_array(url_buffer, 0, url_buffer.length); CDRInputStream input = (CDRInputStream) output.create_input_stream(); Encapsulation encap = input.readEncapsulation(); return new ObjectKey(encap); }
public CommunicationDelegate createDelegate(String url) throws CommunicationException { CommunicationDelegate delegate; if ( this.accepts( url ) ){ IOR ior; try { if ( url.startsWith( "corbaloc:tidorb:" ) ){ ior = Corbaloc.getIOR( url ); } else if ( url.startsWith( "corbaloc:ssliop:" )) { ior = SSLIOPCorbaloc.getIOR( url ); } else if ( url.startsWith( "corbaloc:" )) { ior = IIOPCorbaloc.getIOR( url ); } else { ior = IIOPIOR.fromString(this.orb, url); } } catch ( InvalidName in ){ throw new CommunicationException( "Invalid url: " + in.getMessage(), in ); } delegate = createDelegate( ior ); } else { delegate = null; } return delegate; }
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"); } }
/** * 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 ) ; } }
/** * Return the ORB's default POA. */ public POA default_POA(Servant a_servant) { same(a_servant); try { return POAHelper.narrow(orb(a_servant).resolve_initial_references("RootPOA")); } catch (InvalidName ex) { throw new Unexpected(ex); } }