Refine search
/** * Does the job of calling the COS Naming API, * resolve, and performs the exception mapping. If the resolved * object is a COS Naming Context (sub-context), then this function * returns a new JNDI naming context object. * * @param path the NameComponent[] object. * @return Resolved object returned by the COS Name Server. * @throws NotFound No objects under the name. * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. */ java.lang.Object callResolve(NameComponent[] path) throws NamingException { try { org.omg.CORBA.Object obj = _nc.resolve(path); try { NamingContext nc = NamingContextHelper.narrow(obj); if (nc != null) { return new CNCtx(_orb, nc, _env, makeFullName(path)); } else { return obj; } } catch (org.omg.CORBA.SystemException e) { return obj; } } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
NamingContext nobj = NamingContextHelper.narrow((org.omg.CORBA.Object) obj); if (rebind) _nc.rebind_context(pth, nobj); else _nc.bind_context(pth, nobj); _nc.rebind(pth, (org.omg.CORBA.Object) obj); else _nc.bind(pth, (org.omg.CORBA.Object) obj); } else throw IIOPLogger.ROOT_LOGGER.notACorbaObject();
/** * Calls the unbind api of COS Naming and uses the exception mapper * class to map the exceptions * * @param path NameComponent[] object * @throws NotFound No objects under the name. If leaf * is not found, that's OK according to the JNDI spec * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. */ private void callUnbind(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { _nc.unbind(path); } catch (NotFound e) { // If leaf is the one missing, return success // as per JNDI spec if (leafNotFound(e, path[path.length - 1])) { // do nothing } else { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
/** * (Re)binds an object to a name in a given CORBA naming context, creating * any non-existent intermediate contexts along the way. * <p/> * This method is synchronized on the class object, if multiple services attempt to bind the * same context name at once it will fail * * @param ctx a reference to the COSNaming service. * @param strName the name under which the CORBA object is to be bound. * @param obj the CORBA object to be bound. * @throws Exception if an error occurs while binding the object. */ public static synchronized void rebind(final NamingContextExt ctx, final String strName, final org.omg.CORBA.Object obj) throws Exception { final NameComponent[] name = ctx.to_name(strName); NamingContext intermediateCtx = ctx; for (int i = 0; i < name.length - 1; i++) { final NameComponent[] relativeName = new NameComponent[]{name[i]}; try { intermediateCtx = NamingContextHelper.narrow( intermediateCtx.resolve(relativeName)); } catch (NotFound e) { intermediateCtx = intermediateCtx.bind_new_context(relativeName); } } intermediateCtx.rebind(new NameComponent[]{name[name.length - 1]}, obj); }
public synchronized void registerName(String nameId, String nameKind) throws NotFound, CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { if (nameId == null) { return; } namingContext_ = NamingContextHelper.narrow(getORB().resolve_initial_references("NameService")); NameComponent[] _name = new NameComponent[] { new NameComponent(nameId, nameKind) }; if (logger_.isInfoEnabled()) { logger_.info("namingContext.rebind(" + format(_name) + " => " + getCorbaLoc() + ")"); } namingContext_.rebind(_name, thisRef_); registeredName_ = _name; }
public SerialContextProvider getNameService() throws InvalidName, NotFound, CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object objref = null; if (endpoints == null) { objref = orb.resolve_initial_references( "NameService"); } else { objref = orb.string_to_object(endpoints) ; } final NamingContext nctx = NamingContextHelper.narrow(objref); final NameComponent[] path = { new NameComponent("SerialContextProvider", "") }; final org.omg.CORBA.Object obj = nctx.resolve(path) ; SerialContextProvider result = (SerialContextProvider)PortableRemoteObject.narrow( obj, SerialContextProvider.class ); return result ; }
orbProps.put("org.omg.CORBA.ORBInitialHost", orbInitialHost); orbProps.put("org.omg.CORBA.ORBInitialPort", orbInitialPort); ORB orb = ORB.init(new String[0], orbProps); NamingContext root = NamingContextHelper.narrow(orb.resolve_initial_references("NameService")); NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);
context = NamingContextHelper.narrow (context.resolve (bind.getName ())); if (context == null) context.bind (bindname.components (), orb.string_to_object (ior)); context.rebind (bindname.components (), orb.string_to_object (ior)); else throw ab;
public void registerServant(String uri, Object servantObject) throws CorbaHostException { CorbanameURL details = CorbaHostUtils.getServiceDetails(uri); ORB orb = createORB(details.getHost(), details.getPort(), false); try { NamingContext namingCtx = getNamingContext(orb, details.getNameService()); for (int i = 0; i < details.getNamePath().size() - 1; i++) { NameComponent nc = new NameComponent(details.getNamePath().get(i), ""); NameComponent[] path = new NameComponent[] {nc}; try { namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path)); } catch (Exception e) { namingCtx = namingCtx.bind_new_context(path); } } NameComponent finalName = new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), ""); try { namingCtx.resolve(new NameComponent[] {finalName}); // no exception means that some object is already registered // under this name, we need to crash here throw new CorbaHostException(CorbaHostException.BINDING_IN_USE); } catch (NotFound e) { namingCtx.bind(new NameComponent[] {finalName}, servantObject); } } catch (CorbaHostException e) { throw e; } catch (Exception e) { handleException(e); } }
@Override public void initializeRemoteNaming(Remote remoteNamingProvider) throws Exception { try { org.omg.CORBA.Object provider = getRemoteNamingReference( remoteNamingProvider ) ; // put object in NameService org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // XXX use constant for SerialContextProvider name NameComponent nc = new NameComponent("SerialContextProvider", ""); NameComponent path[] = {nc}; ncRef.rebind(path, provider); } catch (Exception ex) { _logger.log(Level.SEVERE, "enterprise_naming.excep_in_insertserialcontextprovider",ex); RemoteException re = new RemoteException("initSerialCtxProvider error", ex); throw re; } }
context = NamingContextHelper.narrow (context.resolve (bind.getName ())); if (context == null) System.err.println ("name is null "); context.bind_new_context (bindname.components ()); update ();
/**Request the transaction service to stop any further transactional activity. * * @param immediate Indicates whether to ignore running transactions. * * @return * * @see */ public static void shutdown( boolean immediate ) { // Remove the admin and factory objects from the naming service. if( namingContext != null ) try { NameComponent nc = new NameComponent(TransactionFactoryHelper.id(),""); NameComponent path[] = {nc}; namingContext.unbind(path); namingContext = null; } catch( Exception exc ) {} // Inform the local TransactionFactory and CurrentImpl classes that no more // transactional activity may occur. TransactionFactoryImpl.deactivate(); CurrentImpl.deactivate(); // Shut down the basic transaction services. currentInstance.shutdown(immediate); // Discard the factory and current instances. currentInstance = null; factoryInstance = null; //adminInstance = null; active = false; }
return context.resolve(tail);
context.rebind(subName, obj);
/** * Calls the destroy on the COS Naming Server * * @param nc The NamingContext object to use. * @throws org.omg.CosNaming.NamingContextPackage.NotEmpty when the context is not empty and cannot be destroyed. */ private void callDestroy(NamingContext nc) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(nc.toString()); try { nc.destroy(); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, null); } }
/** * Calls the bind_new_context COS naming api to create a new subcontext. * * @param path NameComponent[] object * @return the new context object. * @throws NotFound No objects under the name. * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. * @throws org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound to this name. */ private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { NamingContext nctx = _nc.bind_new_context(path); return new CNCtx(_orb, nctx, _env, makeFullName(path)); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
context.bind(subName, obj);
context.rebind_context(subName, nc); } else { NameComponent name = n[0];