jbossContext.rebind(ncx, obj); else NamingContextExtHelper.narrow(context).rebind(ncx, obj);
jbossContext.bind(ncx, obj); else NamingContextExtHelper.narrow(context).bind(ncx, obj);
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(); }
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(); } }
jbossContext.unbind(ncx); else NamingContextExtHelper.narrow(context).unbind(ncx);
/** * @param domainId * @return a Participant has a same domaiId */ public org.omg.dds.DomainParticipant lookup_participant (int domainId) { org.omg.dds.DomainParticipant ref = null; try { org.omg.CORBA.Object objRef = orb.resolve_initial_references ("NameService"); // Use NamingContextExt instead of NamingContext. This is // part of the Interoperable naming Service. NamingContextExt ncRef = NamingContextExtHelper.narrow (objRef); ref = DomainParticipantHelper.narrow (ncRef.resolve_str (new Integer (domainId).toString ())); } catch (Exception e) { System.err.println ("ERROR: " + e); e.printStackTrace (System.out); } return ref; }
public org.omg.CORBA.Object resolve(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName { if (this.destroyed) throw new CannotProceed(); if (nc == null || nc.length == 0) throw new InvalidName(); Name n = new Name(nc[0]); if (nc.length > 1) { org.omg.CORBA.Object next_context = (org.omg.CORBA.Object) this.contexts.get(n); if ((next_context == null) || (isDead(next_context))) throw new NotFound(NotFoundReason.missing_node, nc); NameComponent[] nc_prime = new NameComponent[nc.length - 1]; System.arraycopy(nc, 1, nc_prime, 0, nc_prime.length); // try first to call the context implementation object directly. String contextOID = this.getObjectOID(next_context); CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID)); if (jbossContext != null) return jbossContext.resolve(nc_prime); else return NamingContextExtHelper.narrow(next_context).resolve(nc_prime); } else { org.omg.CORBA.Object result = (org.omg.CORBA.Object) this.contexts.get(n); if (result == null) result = (org.omg.CORBA.Object) this.names.get(n); if (result == null) throw new NotFound(NotFoundReason.missing_node, n.components()); if (!noPing && isDead(result)) throw new NotFound(NotFoundReason.missing_node, n.components()); return result; } }
/** * (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[] aNameComponentArray = new NameComponent[1]; aNameComponentArray[0] = new NameComponent(namingContextExt, ""); nc = nce.bind_new_context(aNameComponentArray); log.debug(" created NamingContext"); } catch (AlreadyBound e) { org.omg.CORBA.Object aObject = nce.resolve_str(namingContextExt); log.debug("NamingContext Object is " + aObject);
jbossContext.bind_context(ncx, obj); else NamingContextExtHelper.narrow(context).bind_context(ncx, obj);
jbossContext.rebind_context(ncx, obj); else NamingContextExtHelper.narrow(context).rebind_context(ncx, 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(); } }
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(); } }
NamingContextExtHelper.narrow( resolve( ctx.components())).unbind(ncx );
org.omg.CORBA.Object target = n.resolve_str(name); ior = ((Delegate) ((org.omg.CORBA.portable.ObjectImpl)target)
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()); } }
/** * (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); }