Examples of NameComponent


Examples of org.omg.CosNaming.NameComponent

               String contextId = this.addressServer.getEnv("NameService.context.id", "xmlBlaster").getValue();
               String contextKind = this.addressServer.getEnv("NameService.context.kind", "MOM").getValue();

               nameXmlBlaster = new NameComponent[1];
               nameXmlBlaster[0] = new NameComponent();
               nameXmlBlaster[0].id = contextId;      // old style: "xmlBlaster-Authenticate"
               nameXmlBlaster[0].kind = contextKind;  // kind is like a file extension (does not make much sense here)
               NamingContext relativeContext = null;
               int numTries = 5// We need to retry
               for(int i=0; i<numTries; i++) {
                  try {
                     relativeContext = namingContextExt.bind_new_context(nameXmlBlaster);
                     if (relativeContext != null) {
                        break;
                     }
                  }
                  catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
                     if (log.isLoggable(Level.FINE)) log.fine("Can't register CORBA NameService context '" +
                                    OrbInstanceFactory.getString(nameXmlBlaster) + "': " + ex.toString());
                     try {
                        org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
                        relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);
                        break;
                     }
                     catch (Throwable e) {
                        log.severe("Can't register CORBA NameService context '" +
                                   OrbInstanceFactory.getString(nameXmlBlaster) + "', #"+i+"/"+numTries+": " + e.toString());
                     }
                  }
                  catch (org.omg.CORBA.NO_IMPLEMENT ex) {  // JacORB 1.3.x bug (remove this catch when updated to JacORB 1.4x)
                     if (log.isLoggable(Level.FINE)) log.fine("Can't register CORBA NameService context '" +
                                    OrbInstanceFactory.getString(nameXmlBlaster) + "': " + ex.toString());
                     try {
                        org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
                        relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);
                        break;
                     }
                     catch (Throwable e) {
                        log.severe("Can't register CORBA NameService context '" +
                                   OrbInstanceFactory.getString(nameXmlBlaster) + "', #"+i+"/"+numTries+": " + e.toString());
                     }
                  }
               }
               if (relativeContext != null) {
                  String clusterId = this.addressServer.getEnv("NameService.node.id", glob.getStrippedId()).getValue();
                  String clusterKind = this.addressServer.getEnv("NameService.node.kind", "MOM").getValue();
                  nameNode = new NameComponent[] { new NameComponent(clusterId, clusterKind) };
                  relativeContext.rebind(nameNode, this.authRef);
               }
               else {
                  // delegate error handling
                  throw new XmlBlasterException(glob, ErrorCode.RESOURCE_UNAVAILABLE, ME, "Can't bind to naming service");
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

               // NameService entry is e.g. "xmlBlaster.MOM/heron.MOM"
               // where "xmlBlaster.MOM" is a context node and
               // "heron.MOM" is a subnode for each running server (containing the AuthServer POA reference)

               NamingContextExt namingContextExt = getNamingService();
               NameComponent [] nameXmlBlaster = new NameComponent[] { new NameComponent(contextId, contextKind) };
               if (log.isLoggable(Level.FINE)) log.fine("Query NameServer -ORBInitRef NameService=" + glob.getProperty().get("ORBInitRef","") +
                             ((System.getProperty("ORBInitRef.NameService") != null) ? System.getProperty("ORBInitRef.NameService") : "") +
                             " to find the xmlBlaster root context " + OrbInstanceFactory.getString(nameXmlBlaster));
               org.omg.CORBA.Object obj = namingContextExt.resolve(nameXmlBlaster);
               NamingContext relativeContext = org.omg.CosNaming.NamingContextExtHelper.narrow(obj);

               if (relativeContext == null) {
                  throw new Exception("Can't resolve CORBA NameService");
               }

               NameComponent [] nameNode = new NameComponent[] { new NameComponent(clusterId, clusterKind) };

               AuthServer authServerFirst = null;
               String tmpId = "";           // for logging only
               String tmpServerName = "";   // for logging only
               String firstServerName = ""; // for logging only
               int countServerFound = 0;    // for logging only
               String serverNameList = ""// for logging only
               try {
                  this.authServer = AuthServerHelper.narrow(relativeContext.resolve(nameNode));
               }
               catch (Exception ex) {
                  if (log.isLoggable(Level.FINE)) log.fine("Query NameServer to find a suitable xmlBlaster server for " + OrbInstanceFactory.getString(nameXmlBlaster) + "/" + OrbInstanceFactory.getString(nameNode));
                  BindingListHolder bl = new BindingListHolder();
                  BindingIteratorHolder bi = new BindingIteratorHolder();
                  relativeContext.list(0, bl, bi);
                  //for (int i=0; i<bl.value.length; i++) { // bl.value.length should be 0
                  //   String id = bl.value[i].binding_name[0].id;
                  //   String kind = bl.value[i].binding_name[0].kind;

                  // process the remaining bindings if an iterator exists:
                  if (this.authServer == null && bi.value != null) {
                     BindingHolder bh = new BindingHolder();
                     int i = 0;
                     while ( bi.value.next_one(bh) ) {
                        String id = bh.value.binding_name[0].id;
                        String kind = bh.value.binding_name[0].kind;
                        NameComponent [] nameNodeTmp = new NameComponent[] { new NameComponent(id, kind) };

                        tmpId = id;
                        countServerFound++;
                        tmpServerName = OrbInstanceFactory.getString(nameXmlBlaster)+"/"+OrbInstanceFactory.getString(nameNodeTmp);
                        if (i>0) serverNameList += ", ";
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

            return nb;
        }
        try
        {
            NameComponent[] resolveName =
                { new NameComponent(namePrefix + name, "") };
            org.omg.CORBA.Object object = serverNamingContext.resolve(resolveName);
            NameBinding nb = new NameBinding();
            nb.object = object;
            nb.cacheTimeout = System.currentTimeMillis() + lookupCacheTimeout;
            return nb;
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

    public void registerServant(String uri, Object servantObject) throws CorbaHostException {
        CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
        try {
            NamingContext namingCtx = getNamingContext(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);
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

                    Assert.fail("The naming server cannot be started");
                }
                orb = server.getORB();
                org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
                NamingContext ncRef = NamingContextHelper.narrow(objRef);
                NameComponent nc = new NameComponent(GENERATED_SERVICE_NAME, "");
                NameComponent path[] = {nc};
                ScenarioTwo scenarioTwo = new ScenarioTwoServant();
                ncRef.rebind(path, scenarioTwo);
            } catch (Throwable e) {
                e.printStackTrace();
                Assert.fail(e.getMessage());
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

    public void test_getneratedGetSetAttribute() {
        try {
            orb = server.getORB();
            org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);
            NameComponent nc = new NameComponent(TUSCANY_SERVICE_NAME, "");
            NameComponent path[] = {nc};
            ScenarioTwo st = ScenarioTwoHelper.narrow(ncRef.resolve(path));
            st.stringField("");
            assertEquals("", st.stringField());
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

                e.printStackTrace();
                Assert.fail(e.getMessage());
            }
            org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);
            NameComponent nc = new NameComponent(SERVICE_NAME, "");
            NameComponent path[] = {nc};
            ScenarioOne scenarioOne = new ScenarioOneServant();
            ncRef.rebind(path, scenarioOne);
            // obtain node
            node = NodeFactory.getInstance().createNode("ScenarioOne.composite", TestCorbaHost.class.getClassLoader()).start();
        } catch (Exception e) {
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

    public void testServiceUsingGeneratedClient(String serviceName) {
        try {
            org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);
            NameComponent nc = new NameComponent(serviceName, "");
            NameComponent path[] = {nc};
            ScenarioOne so = ScenarioOneHelper.narrow(ncRef.resolve(path));

            RichStruct richStruct = getRichStruct();
            RichStruct result = so.setRichStruct(richStruct);
            assertTrue(equalTo(result, richStruct));
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

        if (obj == null)
            throw new org.omg.CORBA.BAD_PARAM();

        Name n = new Name(nc);
        Name ctx = n.ctxName();
        NameComponent nb = n.baseNameComponent();

        if (ctx == null) {
            if (this.names.containsKey(n)) {
                // if the name is still in use, try to ping the object
                org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
View Full Code Here

Examples of org.omg.CosNaming.NameComponent

        if (this.destroyed)
            throw new CannotProceed();

        Name n = new Name(nc);
        Name ctx = n.ctxName();
        NameComponent nb = n.baseNameComponent();

        if (ctx == null) {
            if (this.names.containsKey(n)) {
                // if the name is still in use, try to ping the object
                org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.