Package javax.naming

Examples of javax.naming.InitialContext.list()


   private void lookup(String name)
   {
      log.info("lookup " + name);
      try {
         InitialContext jndiContext = new InitialContext();
         NamingEnumeration names = jndiContext.list(name);
         if (names != null){
            while (names.hasMore()){
               log.info("  " + names.next());
            }
         }
View Full Code Here


      m_evaluators.clear(  );
      NamingEnumeration list = null;
      try
      {
         Context initialContext = new InitialContext(  );
         list = initialContext.list( QUERY_EVALUATOR_CONTEXT );
         NameClassPair       pair      = null;
         ExpressionEvaluator evaluator = null;
         while ( list.hasMore(  ) )
         {
            pair         = (NameClassPair) list.next(  );
View Full Code Here

   */
  public void listRepositoryContents() throws NamingException
  {
    InitialContext ctx = new InitialContext();
   
    NamingEnumeration<NameClassPair> serviceList = ctx.list("osgi:service/java.lang.Runnable/(rubbish=smelly)");
   
    checkThreadRetrievedViaListMethod(serviceList);
   
    assertFalse("The repository contained more objects than we expected", serviceList.hasMoreElements());
   
View Full Code Here

   
    //Now add a second service
   
    registerService(new Thread());
   
    serviceList = ctx.list("osgi:service/java.lang.Runnable/(rubbish=smelly)");
   
    checkThreadRetrievedViaListMethod(serviceList);
   
    checkThreadRetrievedViaListMethod(serviceList);
   
View Full Code Here

    reg.unregister();
   
    ServiceRegistration reg = bc.registerService(className, t, null);
    ServiceRegistration reg2 = bc.registerService(className, new Thread(), null);
   
    NamingEnumeration<NameClassPair> ne = ctx.list("osgi:servicelist/" + className);
   
    assertTrue(ne.hasMoreElements());
   
    NameClassPair ncp = ne.nextElement();
   
View Full Code Here

            Properties props = new Properties();
            props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
            props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
            Context context = new InitialContext(props);

            assertNameClassPair(context.list(""));
            assertNameClassPair(context.list("ejb"));

            assertBindings(context.listBindings(""));
            assertBindings(context.listBindings("ejb"));
View Full Code Here

            props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
            props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
            Context context = new InitialContext(props);

            assertNameClassPair(context.list(""));
            assertNameClassPair(context.list("ejb"));

            assertBindings(context.listBindings(""));
            assertBindings(context.listBindings("ejb"));

        } finally {
View Full Code Here

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {
            final InitialContext ic = new InitialContext();
            ic.lookup("java:comp/env");
            Assert.assertFalse(ic.list("java:comp/env").hasMore());
            resp.getWriter().write("ok");
            resp.getWriter().close();
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

            final Set<String> expected = new HashSet<String>();
            expected.add(Bean.class.getSimpleName() + "!" + Remote.class.getName());
            expected.add(Singleton.class.getSimpleName() + "!" + BinderRemote.class.getName());
            expected.add(StatefulBean.class.getSimpleName() + "!" + Remote.class.getName());

            NamingEnumeration<NameClassPair> e = ctx.list("test");
            while (e.hasMore()) {
                NameClassPair binding = e.next();
                if (!expected.remove(binding.getName())) {
                    Assert.fail("unknown binding " + binding.getName());
                }
View Full Code Here

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
      env.put(Context.PROVIDER_URL, "rmi://localhost");
      InitialContext ctx = new InitialContext(env);
      ctx.list("");
      sleep(1000);

      Socket socket = new Socket((String)null, shutdownPort);
      socket.getOutputStream().write(DefaultConfigurationBuilder.SHUTDOWN_COMMAND.getBytes());
      socket.close();
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.