Examples of NamingContext


Examples of org.omg.CosNaming.NamingContext

            buf.append('\n');

            // recursively list the subcontext contents
            try
            {
               NamingContext subCtx =
                  NamingContextHelper.narrow(ctx.resolve(binding.binding_name));
               rlist(subCtx, name, buf);
            }
            catch(Exception e)
            {
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

    }

    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);
            } catch (NotFound e) {
                namingCtx.bind(new NameComponent[] {finalName}, servantObject);
                registerURI(uri);
            }
        } catch (CorbaHostException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

                if (t == null) {
                    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());
            }
            // obtain node
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

    @Test
    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();
            fail();
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

            } catch (Throwable e) {
                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) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

    }

    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.NamingContext

            org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService");
            initialContext = NamingContextExtHelper.narrow(obj);
            String[] names = tssLink.getJndiNames();
            for (int i = 0; i < names.length; i++) {
                NameComponent[] nameComponent = initialContext.to_name(names[i]);
                NamingContext currentContext = initialContext;
                NameComponent[] nc = new NameComponent[1];
                int lastComponent = nameComponent.length - 1;
                for (int j = 0; j < lastComponent; ++j) {
                    nc[0] = nameComponent[j];
                    try {
                        currentContext = NamingContextHelper.narrow(currentContext.resolve(nc));
                    } catch (NotFound nf) {
                        currentContext = currentContext.bind_new_context(nc);
                    }
                }
                nc[0] = nameComponent[lastComponent];
                currentContext.rebind(nc, homeReference);
            }
        } catch (Exception e) {
            throw new CORBAException(e);
        }
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

                initialContext.unbind(nameComponent);

                for (int j = nameComponent.length - 1; 0 < j; --j) {
                    NameComponent[] nc = new NameComponent[j];
                    System.arraycopy(nameComponent, 0, nc, 0, j);
                    NamingContext currentContext = NamingContextHelper.narrow(initialContext.resolve(nc));
                    try {
                        currentContext.destroy();
                    } catch (NotEmpty ne) {
                        break;
                    }
                }
            }
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

            throw new CannotProceed();

        if (nc == null || nc.length == 0)
            throw new InvalidName();

        NamingContext context = new_context();
        if (context == null)
            throw new CannotProceed();

        bind_context(nc, context);
        return context;
View Full Code Here

Examples of org.omg.CosNaming.NamingContext

            throw new CannotProceed();

        if (nc == null || nc.length == 0)
            throw new InvalidName();

        NamingContext context = new_context();
        if (context == null)
            throw new CannotProceed();

        bind_context(nc, context);
        return context;
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.