return (new org.omg.CosNaming.NameComponent(id.toString(), kind.toString()));
new NameComponent(new String(id, 0, idCount), new String(kind, 0, kindCount))));
NameComponent comp = new NameComponent(); int kindSep = -1; int len = compStr.length();
/** * Convert a Name object to a NameComponent array * * @param name * The Name * @return A NameComponent array */ public static NameComponent[] getCosName(Name name) { List<NameComponent> corbaName= new ArrayList<>(); Enumeration<String> names= name.getAll(); while (names.hasMoreElements()) { String str= names.nextElement(); int pos= str.lastIndexOf('.'); if (pos == -1) { corbaName.add(new NameComponent(str, "")); } else { corbaName.add(new NameComponent(str.substring(0, pos), str.substring(pos + 1))); } } return corbaName.toArray(new NameComponent[0]); }
public static org.omg.CosNaming.NameComponent read (final org.omg.CORBA.portable.InputStream in) { org.omg.CosNaming.NameComponent result = new org.omg.CosNaming.NameComponent(); result.id=in.read_string(); result.kind=in.read_string(); return result; } public static void write (final org.omg.CORBA.portable.OutputStream out, final org.omg.CosNaming.NameComponent s)
public static org.omg.CosNaming.NameComponent read (org.omg.CORBA.portable.InputStream istream) { org.omg.CosNaming.NameComponent value = new org.omg.CosNaming.NameComponent (); value.id = istream.read_string (); value.kind = istream.read_string (); return value; }
public static org.omg.CosNaming.NameComponent read (org.omg.CORBA.portable.InputStream istream) { org.omg.CosNaming.NameComponent value = new org.omg.CosNaming.NameComponent (); value.id = istream.read_string (); value.kind = istream.read_string (); return value; }
public static org.omg.CosNaming.NameComponent read (final org.omg.CORBA.portable.InputStream in) { org.omg.CosNaming.NameComponent result = new org.omg.CosNaming.NameComponent(); result.id=in.read_string(); result.kind=in.read_string(); return result; } public static void write (final org.omg.CORBA.portable.OutputStream out, final org.omg.CosNaming.NameComponent s)
public static org.omg.CosNaming.NameComponent read (org.omg.CORBA.portable.InputStream istream) { org.omg.CosNaming.NameComponent value = new org.omg.CosNaming.NameComponent (); value.id = istream.read_string (); value.kind = istream.read_string (); return value; }
/** * Returns the next binding in the NamingContext. Uses the enumeration * object to determine if there are more bindings and if so, returns * the next binding from the InternalBindingValue. * @param b The Binding as an out parameter. * @return true if there were more bindings. */ final public boolean NextOne(org.omg.CosNaming.BindingHolder b) { // If there are more elements get the next element boolean hasMore = theEnumeration.hasMoreElements(); if (hasMore) { InternalBindingKey theBindingKey = ((InternalBindingKey)theEnumeration.nextElement()); InternalBindingValue theElement = (InternalBindingValue)theHashtable.get( theBindingKey ); NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind ); NameComponent[] nlist = new NameComponent[1]; nlist[0] = n; BindingType theType = theElement.theBindingType; b.value = new Binding( nlist, theType ); } else { // Return empty but marshalable binding b.value = new Binding(new NameComponent[0],BindingType.nobject); } return hasMore; }
public TransactionCurrentImpl(ORB orb, int slot_id) { this.orb = orb; this.slot_id = slot_id; logger = orb.getConfiguration().getLogger("org.jacorb.tx_service.current"); contexts = new Hashtable(); timeouts = new Hashtable(); try { NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); NameComponent [] name = new NameComponent[1]; name[0] = new NameComponent( "TransactionService", "service"); factory = TransactionFactoryHelper.narrow(nc.resolve(name)); } catch (Exception e) { if (logger.isErrorEnabled()) logger.error("Unable to obtain Transaction Service reference. Giving up.", e ); throw new Error(e.getMessage()); } }
@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; } }
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 ; }
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 ; }
/** * unbind a name and remove it from the table */ public synchronized void unbind() { int row = getSelectedRow(); if( row > -1 ) { try { org.omg.CosNaming.NameComponent[] ncs = new org.omg.CosNaming.NameComponent[1]; ncs[0] = new org.omg.CosNaming.NameComponent( (String)getValueAt(row,0), (String)getValueAt(row,1)); current.unbind(ncs); update(); } catch( Exception e) {} } } /**
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); } }
/**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; }
NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);
NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);