Package javax.naming

Examples of javax.naming.InitialContext.createSubcontext()


        javax.mail.Session session = (javax.mail.Session)x;
        Properties sessionProps =  session.getProperties();
        assertEquals(props, sessionProps);
        assertTrue (session.getDebug());
       
        Context foo = icontext.createSubcontext("foo");
        NameParser parser = icontext.getNameParser("");
        Name objectNameInNamespace = parser.parse(icontext.getNameInNamespace());
        objectNameInNamespace.addAll(parser.parse("mail/Session"));
       
        NamingUtil.bind(foo, "mail/Session", new LinkRef(objectNameInNamespace.toString()));
View Full Code Here


        {
            //expected
        }
       
        InitialContext ic = new InitialContext();
        Context scopeContext = ic.createSubcontext(NamingEntryUtil.getNameForScope(scope));
        assertNotNull(scopeContext);
       
        try
        {
            Context c = NamingEntryUtil.getContextForScope(scope);
View Full Code Here

        setUpJcaContext();
        configurationManager.loadConfiguration(configurationData);
        configurationManager.startConfiguration(configurationData.getId());

        InitialContext ctx = new InitialContext();
        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);
View Full Code Here

      }
      catch(NamingException e)
      {
         try
         {
            context = initialContext.createSubcontext(subContextName);
         }
         catch(NameAlreadyBoundException e1)
         {
            log.debug("The sub context " + subContextName + " was created before we could.");
            context = (Context) initialContext.lookup(subContextName);
View Full Code Here

        System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
       
        InitialContext jndiContext = new InitialContext(props);
        try
        {
          jndiContext.createSubcontext("java:comp");
          jndiContext.createSubcontext("java:comp/env");
          jndiContext.createSubcontext("java:comp/env/jdbc");
          //jndiContext.createSubcontext("java:comp/env/jdbc");
         
  //        <Resource
View Full Code Here

       
        InitialContext jndiContext = new InitialContext(props);
        try
        {
          jndiContext.createSubcontext("java:comp");
          jndiContext.createSubcontext("java:comp/env");
          jndiContext.createSubcontext("java:comp/env/jdbc");
          //jndiContext.createSubcontext("java:comp/env/jdbc");
         
  //        <Resource
  //        name="jdbc/LiferayPool"
View Full Code Here

        InitialContext jndiContext = new InitialContext(props);
        try
        {
          jndiContext.createSubcontext("java:comp");
          jndiContext.createSubcontext("java:comp/env");
          jndiContext.createSubcontext("java:comp/env/jdbc");
          //jndiContext.createSubcontext("java:comp/env/jdbc");
         
  //        <Resource
  //        name="jdbc/LiferayPool"
  //        auth="Container"
View Full Code Here

        ctx.bind("map", map);
        map = (HashMap)ctx.lookup("map");

        /* Test sub context */

        Context subCtx = ctx.createSubcontext("myctx");
        Assert.assertNotNull("subcontext is null", subCtx);

        String name = "name" + System.currentTimeMillis();
        subCtx.bind(name, name);

View Full Code Here

    protected void performTask(HttpServletRequest request, HttpServletResponse response){
        try {
            PrintWriter pw = response.getWriter();
            try {
                Context ctx = new InitialContext();
                ctx.createSubcontext("foo");
                ctx.bind("foo/bar", "value");
                String value = (String) ctx.lookup("foo/bar");
                if ("value".equals(value)) {
                    pw.println("Value bound and retrieved from jndi default context");
                } else{
View Full Code Here

        replay(dataSource);

        MockContextFactory.setAsInitial();

        final InitialContext context = new InitialContext();
        context.createSubcontext("java:");
        context.createSubcontext("java:/comp");
        context.createSubcontext("java:/comp/env");
        context.createSubcontext("java:/comp/env/jdbc");

        context.bind("java:/comp/env/jdbc/TestDataSourceAppender", dataSource);
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.