Package javax.naming

Examples of javax.naming.Context.bind()


            try {
                subctx = lookupCtx(n.get(0));
            } catch (NameNotFoundException e) {
                subctx = createSubcontext(n.get(0));
            }
            subctx.bind(suffix, obj);
        }
    }

    /**
     * Binds a name to an object, overwriting any existing binding.
View Full Code Here


        this.logger.debug("javaContext = ''{0}''.", javaContext);
        Context global = (Context) this.initialContext.lookup("java:global");
        this.logger.debug("globalContext = ''{0}''.", javaContext);
        String name = "name1";
        String value = "value1";
        global.bind(name, value);

        Assert.assertEquals(value, global.lookup(name));
    }

    /**
 
View Full Code Here

        String key = "comp/env/myValue";

        // Value1 for the first component
        Context context1 = this.namingManager.createEnvironmentContext("component1");
        String value1 = "Value1";
        context1.bind(key, value1);

        // Value2 for other component
        Context context2 = this.namingManager.createEnvironmentContext("component1");
        String value2 = "Value2";
        context2.bind(key, value2);
View Full Code Here

        context1.bind(key, value1);

        // Value2 for other component
        Context context2 = this.namingManager.createEnvironmentContext("component1");
        String value2 = "Value2";
        context2.bind(key, value2);

        // global should be the same
        String globalKey = "global/sameKeyTest";
        String globalValue = "sameValueTest";
        context1.bind(globalKey, globalValue);
View Full Code Here

    */
   public void start() throws Exception
   {     
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.bind(NAME, VALUE);
      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
      ctx.bind(BAD_BINDING, new NonDeserializable());
      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
     
      // For some reason creating a context for our own JNDI doesn't work
View Full Code Here

   {     
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.bind(NAME, VALUE);
      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
      ctx.bind(BAD_BINDING, new NonDeserializable());
      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
     
      // For some reason creating a context for our own JNDI doesn't work
      // inside the server, so as a hack we directly deal with the NamingServer
      // to bind the object
View Full Code Here

      naming.bind(parser.parse(NAME),
                                      new MarshalledValuePair(VALUE),
                                      VALUE.getClass().getName());
      log.info("Bound " + VALUE + " to " + naming + " under " + NAME);
      Context sub = naming.createSubcontext(parser.parse(SUBCONTEXT_NAME));
      sub.bind(parser.parse(NAME), VALUE);
      log.info("Bound " + VALUE + " to " + sub + " under " + NAME);
     
      // NOTE: we must bind the NonDeserializable directly, or else the
      // NamingContext will wrap it in a MarshalledValuePair, which will
      // defeat the test by triggering deserialization too late
View Full Code Here

            // ignore (this time only) - we just try to figure out whether BeanManager is registered already
         }
         if (beanManagerContext == null)
         {
            String path = applicationName == null? applicationName : (applicationName + "/" + moduleName);
            compContext.bind("BeanManager", new LinkRef("java:global/cdi/" + path +"/BeanManager"));
         }
      }
      catch (NamingException e)
      {
         log.error("Could not bound BeanManager on " + getJavaContextDescription());
View Full Code Here

            {
               String path = JndiUtils.getJndiSubcontexPathForBeanManager(moduleInformer, unit);
               Context subcontext = Util.createSubcontext(rootContext, path);
               Reference reference = new Reference(BeanManager.class.getName(), "org.jboss.weld.integration.deployer.jndi.JBossBeanManagerObjectFactory", null);
               reference.add(new StringRefAddr(REFADDR_ID, IdFactory.getIdFromClassLoader(unit.getClassLoader())));
               subcontext.bind("BeanManager", reference);
            }
         }
         catch (NamingException e)
         {
            throw new DeploymentException(e);
View Full Code Here

   public void bind(DeploymentUnit unit) throws DeploymentException
   {
      try
      {
         Context context = getBeanManagerContext().createSubcontext(unit.getSimpleName());
         context.bind("bootstrap", "Bootstrap Dummy");
      }
      catch (NamingException e)
      {
         new DeploymentException(e);
      }
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.