/** * (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); }
NameComponent[] name = corbaContext.to_name(this.name); corbaContext.unbind(name); } catch (InvalidName invalidName) {
public void exportObjectReferenceToNamingService(ORB orb, org.omg.CORBA.Object ref, String location) { int idx = location.indexOf("#"); String name = location.substring(idx + 1); //Register in NameService try { org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService"); NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj); NameComponent[] nc = rootContext.to_name(name); rootContext.rebind(nc, ref); } catch (Exception ex) { throw new CorbaBindingException(ex); } } public void exportObjectReferenceToCorbaloc(ORB orb,
public ThreadSubscriber( org.omg.CORBA.ORB orb , org.omg.PortableServer.POA poa ) { ecs = null; ca = null; pushConsumer = null; pps = null; references_domaines_participant = new Vector(); all_Sub = new Vector(); try { this.orb = orb; this.poa = poa; NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); ecs = EventChannelHelper.narrow(nc.resolve(nc.to_name("eventchannel"))); } catch(Exception e) { e.printStackTrace(); } ca = ecs.for_consumers(); pps = ca.obtain_push_supplier(); }
NameComponent path[] = ncRef.to_name (id); ncRef.unbind (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 DomainParticipantFactoryImpl (org.omg.CORBA.ORB orb, org.omg.PortableServer.POA poa) { this.orb = orb; this.poa = poa; try { NamingContextExt nc = NamingContextExtHelper.narrow (orb.resolve_initial_references ("NameService")); EventChannelImpl channel = new EventChannelImpl (orb, poa); org.omg.CORBA.Object o = poa.servant_to_reference (channel); /* event channel used by event service */ nc.rebind (nc.to_name ("eventchannel"), o); } catch (Exception e) { } allParticipant = new Vector (); /* thread send message for all suscriber */ Consummer = new ThreadSubscriber (orb, poa); Consummer.start (); }
public Supplier( org.omg.CORBA.ORB orb , org.omg.PortableServer.POA poa ) { e = null; this.orb = orb; this.poa = poa ; try { NamingContextExt nc =NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); e = EventChannelHelper.narrow(nc.resolve( nc.to_name("eventchannel"))); supplierAdmin = e.for_suppliers(); proxyPushConsumer = supplierAdmin.obtain_push_consumer(); proxyPushConsumer.connect_push_supplier( _this(orb) ); } catch(Exception ex) { ex.printStackTrace(); } }
NameComponent path[] = ncRef.to_name (new Integer (domainId).toString ()); ncRef.rebind (path, ref); allParticipant.add (ref);
public void unregisterServant(String uri) throws CorbaHostException { CorbanameURL details = CorbaHostUtils.getServiceDetails(uri); ORB orb = createORB(details.getHost(), details.getPort(), false); try { NamingContextExt namingCtx = getNamingContext(orb, details.getNameService()); namingCtx.unbind(namingCtx.to_name(details.getName())); } catch (Exception e) { handleException(e); } }
nc.resolve( nc.to_name("tracing.service")));
static public void main( String[] args ) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); try { org.omg.PortableServer.POA poa = org.omg.PortableServer.POAHelper.narrow( orb.resolve_initial_references("RootPOA")); EventChannelImpl channel = new EventChannelImpl(orb,poa); poa.the_POAManager().activate(); org.omg.CORBA.Object o = poa.servant_to_reference(channel); NamingContextExt nc = NamingContextExtHelper.narrow( orb.resolve_initial_references("NameService")); String channelName = ( args.length > 0 ? args[0] : "Generic.channel" ); nc.bind(nc.to_name( channelName ), o); orb.run(); } catch( Exception e ) { e.printStackTrace(); } }
public static void main( String[] args ) { org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); try { org.omg.PortableServer.POA poa = org.omg.PortableServer.POAHelper.narrow( orb.resolve_initial_references("RootPOA")); poa.the_POAManager().activate(); org.omg.CORBA.Object o = poa.servant_to_reference(new TracingServiceImpl()); NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService")); nc.bind( nc.to_name("tracing.service"), o); poa.the_POAManager().activate(); } catch ( Exception e ) { e.printStackTrace(); } orb.run(); } }
NameComponent[] name = corbaContext.to_name(this.name); corbaContext.unbind(name); } catch (InvalidName invalidName) {