Package javax.naming

Examples of javax.naming.Context.bind()


      }
      catch(NamingException ignore)
      {
      }
      Context readonly = bootCtx.createSubcontext("readonly");
      readonly.bind("data", "somedata");

      Properties env = new Properties();
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
      env.setProperty(Context.PROVIDER_URL, INVOKER_BASE + "ReadOnlyJNDIFactory");
      getLog().debug("Creating InitialContext with env="+env);
View Full Code Here


      getLog().debug("Looked up data: "+data);
      assertTrue("lookup(data) == somedata: "+data, "somedata".equals(data));
      try
      {
         // Try to bind into the readonly context
         roctx.bind("mydata", "otherdata");
         fail("Was able to bind into the readonly context");
      }
      catch(UndeclaredThrowableException e)
      {
         getLog().debug("Invalid exception", e);
View Full Code Here

      redeployNaming();
     
      Context ctx2 = new InitialContext(env);
      try
      {
         ctx2.bind(BIND_NAME, BIND_VALUE);
      }
      catch (NamingException e)
      {
         log.error("Caught NamingException", e);
         fail(e.getMessage());
View Full Code Here

     
      Context ctx2 = new InitialContext(env);
      try
      {
         Context sub = ctx2.createSubcontext(SUBCONTEXT_NAME);
         sub.bind(BIND_NAME, BIND_VALUE);
         assertEquals("Proper bind to " + SUBCONTEXT_NAME, BIND_VALUE, sub.lookup(BIND_NAME));
      }
      catch (NamingException e)
      {
         log.error("Caught NamingException", e);
View Full Code Here

                  }
               }
            }
         }

         encCtx.bind("classPathEntries", cpURIs);
         // java:comp/UserTransaction -> UserTransaction
         Util.createLinkRef(encCtx, "UserTransaction", "UserTransaction");

         // TODO: Notify the client launcher of other metadata stuff (injectors, lifecycle callbacks etc)
         // FIXME: For now I expose the entire metadata
View Full Code Here

         // java:comp/UserTransaction -> UserTransaction
         Util.createLinkRef(encCtx, "UserTransaction", "UserTransaction");

         // TODO: Notify the client launcher of other metadata stuff (injectors, lifecycle callbacks etc)
         // FIXME: For now I expose the entire metadata
         encCtx.bind("metaData", metaData);
        
         String mainClassName = getMainClassName(unit, true);

         Class<?> mainClass = loadClass(unit, mainClassName);
View Full Code Here

      ctx.rebind(DEFAULT_CACHE_POLICY_PATH, ref);
      log.debug("cachePolicyCtxPath="+cacheJndiName);

      // Bind the default SecurityProxyFactory instance under java:/SecurityProxyFactory
      SecurityProxyFactory proxyFactory = (SecurityProxyFactory) securityProxyFactoryClass.newInstance();
      ctx.bind("java:/SecurityProxyFactory", proxyFactory);
      log.debug("SecurityProxyFactory="+proxyFactory);
     
      //Handler custom callbackhandler
      if(callbackHandlerClass != JBossCallbackHandler.class)
      {
View Full Code Here

         NonSerializableFactory.rebind(ctx, "HandleDelegate", hd);
         log.debug("Bound java:comp/HandleDelegate for EJB: " + getBeanMetaData().getEjbName());
      }

      // JTA links
      ctx.bind("TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
      log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");

      Context envCtx = ctx.createSubcontext("env");

      // Bind environment properties
View Full Code Here

      getLog().debug("HAJndiTestCase.testLocalBinding() NODE0_HAJNDI=" + NODE0_HAJNDI +", NODE1_HAJNDI=" + NODE1_HAJNDI);
      validateUrls();
     
      // bind to node0 locally
      Context naming = getContext(NODE0_JNDI);
      naming.bind(LOCAL0_KEY, LOCAL0_VALUE);
      closeContext(naming);
     
      // lookup binding locally on Node0 - should succeed
      naming = getContext(NODE0_JNDI);
      String value = (String)lookup(naming, LOCAL0_KEY, true);
View Full Code Here

      getLog().debug("HAJndiTestCase.testHAJndiBinding() NODE0_HAJNDI=" + NODE0_HAJNDI +", NODE1_HAJNDI = " + NODE1_JNDI);
      validateUrls();
     
      // bind to node0 using HA-JNDI
      Context naming = getContext(NODE0_HAJNDI);
      naming.bind(GLOBAL0_KEY, GLOBAL0_VALUE);
      closeContext(naming);
     
      // lookup binding locally on Node0 - should fail
      naming = getContext(NODE0_JNDI);
      String value = (String)lookup(naming, GLOBAL0_KEY, false);
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.