Package javax.naming

Examples of javax.naming.InitialContext.rebind()


    { ctx = ctx.createSubcontext( name.get( i ) ); }
    catch (NameAlreadyBoundException ignore)
    { ctx = (Context) ctx.lookup( name.get( i ) ); }
      }

       ictx.rebind( jndiName, combods );
  }


    }
View Full Code Here


        // directory.
        InitialContext ctx =
            new InitialContext(attributes);

        if (rebind)
            ctx.rebind(jndiUrl, rmiServer);
        else
            ctx.bind(jndiUrl, rmiServer);
        ctx.close();
    }
View Full Code Here

      if (!OptionHelper.isEmpty(passwordStr)) {
        setter.setProperty("password", passwordStr);
      }

      Context ctx = new InitialContext();
      ctx.rebind("dataSource", ds);
    } catch (Exception oops) {
      addError(
        "Could not bind  datasource. Reported error follows.", oops);
      ec.addError("Could not not bind  datasource of type [" + dsClassName + "].");
    }
View Full Code Here

        // bind UserTransaction and TransactionManager to JNDI
        try {
            InitialContext ic = new InitialContext();
            // TODO: for some reason this is not working, throwing an error: java.lang.IllegalArgumentException: RegistryContext: object to bind must be Remote, Reference, or Referenceable
            ic.rebind("java:comp/UserTransaction", new GeronimoTransactionManager());
        } catch (Exception e) {
            throw new ContainerException("Unable to bind UserTransaction/TransactionManager to JNDI", e);
        }

        // check JNDI
View Full Code Here

            }
        } else {
            // bind RMIDispatcher to InitialContext (must be RMI protocol not IIOP)
            try {
                InitialContext ic = new InitialContext();
                ic.rebind(name, remote);
            } catch (NamingException e) {
                throw new ContainerException("Unable to bind RMIDispatcher to JNDI", e);
            }

            // check JNDI
View Full Code Here

        EventLogger.logEvent(msg);
        assertNotNull("No events generated", listAppender1.getEvents());
        assertTrue("Incorrect number of events. Expected 1, got " + listAppender1.getEvents().size(), listAppender1.getEvents().size() == 1);

        // now set jndi resource to Application2
        context.rebind("java:comp/env/logging/context-name", "Application2");

        msg = new StructuredDataMessage("Test", "This is a message from Application2", "Context");
        EventLogger.logEvent(msg);
        assertNotNull("No events generated", listAppender2.getEvents());
        assertTrue("Incorrect number of events. Expected 1, got " + listAppender2.getEvents().size(), listAppender2.getEvents().size() == 1);
View Full Code Here

        InitialContext ctx = new InitialContext(contextEnv);
        Context fooCtx = ctx.createSubcontext("jca:foo");
        fooCtx.createSubcontext("bar");
        ctx.bind("jca:foo/bar/baz", 1);
        assertEquals(ctx.lookup("jca:foo/bar/baz"), 1);
        ctx.rebind("jca:foo/bar/baz", 2);
        assertEquals(ctx.lookup("jca:foo/bar/baz"), 2);

    }

    public void testGBeanFormatReBinding() throws Exception {
View Full Code Here

        InitialContext ctx = new InitialContext(contextEnv);
        assertTrue(ctx.lookup("jca:/test/test/GBean/resourceSource") instanceof DataSource);
        Context context = (Context)ctx.lookup("jca:/test/test");
        assertTrue(context.lookup("GBean/resourceSource") instanceof DataSource);

        ctx.rebind("jca:/test/test/GBean/resourceSource", 2);
        assertEquals(2, ctx.lookup("jca:/test/test/GBean/resourceSource"));

    }

    private void setUpJcaContext() {
View Full Code Here

        InitialContext ctx = new InitialContext(contextEnv);
        Context fooCtx = ctx.createSubcontext("jca:foo");
        fooCtx.createSubcontext("bar");
        ctx.bind("jca:foo/bar/baz", 1);
        assertEquals(ctx.lookup("jca:foo/bar/baz"), 1);
        ctx.rebind("jca:foo/bar/baz", 2);
        assertEquals(ctx.lookup("jca:foo/bar/baz"), 2);

    }

    public void testGBeanFormatReBinding() throws Exception {
View Full Code Here

        InitialContext ctx = new InitialContext(contextEnv);
        assertTrue(ctx.lookup("jca:/test/test/GBean/resourceSource") instanceof DataSource);
        Context context = (Context)ctx.lookup("jca:/test/test");
        assertTrue(context.lookup("GBean/resourceSource") instanceof DataSource);

        ctx.rebind("jca:/test/test/GBean/resourceSource", 2);
        assertEquals(2, ctx.lookup("jca:/test/test/GBean/resourceSource"));

    }

    private void setUpJcaContext() {
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.