Package org.omg.CosNaming

Examples of org.omg.CosNaming.NamingContext


     */
    @Test
    public void test_arraysPassing_tuscanyAsService() {
        try {
            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};
            ScenarioSix ref = ScenarioSixHelper.narrow(ncRef.resolve(path));
            String[][] stringArg = getStringArray();
            String[][] stringRes = ref.passStringArray(stringArg);
            assertTrue(areArraysEqual(stringArg, stringRes));
            AnnotatedStruct structArg = new AnnotatedStruct();
            structArg.stringArray = getStringArray();
View Full Code Here


     */
    @Test
    public void test_unionsPassing_tuscanyAsService() {
        try {
            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};
            ScenarioSix ref = ScenarioSixHelper.narrow(ncRef.resolve(path));
            RichUnion arg = new RichUnion();
            InnerUnion inner = new InnerUnion();
            inner.y(20f);
            arg.iu(inner);
            RichUnion result = ref.passRichUnion(arg);
View Full Code Here

                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

    @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

                e.printStackTrace();
                Assert.fail(e.getMessage());
            }

            Object nameService = orb.resolve_initial_references("NameService");
            NamingContext namingContext = NamingContextHelper.narrow(nameService);

            PrimitivesSetterServant singleSetter = new PrimitivesSetterServant();
            ArraysSetterServant arraysSetter = new ArraysSetterServant();
            TestObjectServant complexObject = new TestObjectServant();
            CalcServant calcObject = new CalcServant();
            ObjectManagerServant objectManager = new ObjectManagerServant();
            EnumManagerServant enumManager = new EnumManagerServant();
            ArraysUnionsServant arraysUnions = new ArraysUnionsServant();

            orb.connect(singleSetter);
            orb.connect(arraysSetter);

            NameComponent nc;
            NameComponent[] path;

            nc = new NameComponent("PrimitivesSetter", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, singleSetter);

            nc = new NameComponent("ArraysSetter", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, arraysSetter);

            nc = new NameComponent("TestObject", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, complexObject);

            nc = new NameComponent("CalcObject", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, calcObject);

            nc = new NameComponent("ObjectManager", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, objectManager);

            nc = new NameComponent("EnumManager", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, enumManager);

            nc = new NameComponent("ArraysUnions", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, arraysUnions);

            NamingContextExt nce = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));

            refArraysSetter = nce.resolve(nce.to_name("ArraysSetter"));
            refPrimitivesSetter = nce.resolve(nce.to_name("PrimitivesSetter"));
View Full Code Here

    }

    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

        // do we need to push through to a deeper naming context first?
        if (n.length > 1) {
            // resolve the top level name to a context, and have that context
            // resolve the rest.
            NamingContext context = resolveContext(n[0]);
            NameComponent[] subName = extractSubName(n);

            // now pass this along to the next context for the real bind operation.
            context.bind(subName, obj);
        } else {
            NameComponent name = n[0];
            // we need the resolveObject() and bindObject() calls to be consistent, so
            // synchronize on this
            synchronized (this) {
View Full Code Here

        // do we need to push through to a deeper naming context first?
        if (n.length > 1) {
            // resolve the top level name to a context, and have that context
            // resolve the rest.
            NamingContext context = resolveContext(n[0]);
            NameComponent[] subName = extractSubName(n);

            // now pass this along to the next context for the real bind operation.
            context.rebind(subName, obj);
        } else {
            NameComponent name = n[0];
            // we need the resolveObject() and bindObject() calls to be consistent, so
            // synchronize on this
            synchronized (this) {
View Full Code Here

        // do we need to push through to a deeper naming context first?
        if (n.length > 1) {
            // resolve the top level name to a context, and have that context
            // resolve the rest.
            NamingContext context = resolveContext(n[0]);
            NameComponent[] subName = extractSubName(n);

            // now pass this along to the next context for the real bind operation.
            context.bind_context(subName, nc);
        } else {
            NameComponent name = n[0];
            // we need the resolveObject() and bindObject() calls to be consistent, so
            // synchronize on this
            synchronized (this) {
View Full Code Here

        // do we need to push through to a deeper naming context first?
        if (n.length > 1) {
            // resolve the top level name to a context, and have that context
            // resolve the rest.
            NamingContext context = resolveContext(n[0]);
            NameComponent[] subName = extractSubName(n);

            // now pass this along to the next context for the real bind operation.
            context.rebind_context(subName, nc);
        } else {
            NameComponent name = n[0];
            // we need the resolveObject() and bindObject() calls to be consistent, so
            // synchronize on this
            synchronized (this) {
View Full Code Here

TOP

Related Classes of org.omg.CosNaming.NamingContext

Copyright © 2018 www.massapicom. 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.