Package javax.naming

Examples of javax.naming.Context.listBindings()


            PrintWriter out = resp.getWriter();

            try {
                Context ctx = new InitialContext();
                NamingEnumeration<Binding> enm =
                    ctx.listBindings("java:comp/env/list");
                while (enm.hasMore()) {
                    Binding b = enm.next();
                    out.print(b.getObject().getClass().getName());
                }
            } catch (NamingException ne) {
View Full Code Here


    }
    else
    {
      String atom = name.get(0);
      Context context = (Context) bindings.get(atom);
      iter = context.listBindings(name.getSuffix(1));
    }

    return iter;
  }
View Full Code Here

      redeployNaming();
     
      Context ctx2 = new InitialContext(env);
      try
      {
         NamingEnumeration list = ctx2.listBindings(ObjectBinder.SUBCONTEXT_NAME);
         assertNotNull("NamingEnumeration returned", list);
         assertTrue("NamingEnumeration has entry", list.hasMoreElements());
         Binding binding = (Binding) list.next();
         assertEquals(ObjectBinder.NAME, binding.getName());
      }
View Full Code Here

    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // List the correct Context
    return ctx.listBindings(rname);
  }

  /**
   * Destroys the named context and removes it from the namespace.
   * Any attributes associated with the name are also removed.
View Full Code Here

            PrintWriter out = resp.getWriter();

            try {
                Context ctx = new InitialContext();
                NamingEnumeration<Binding> enm =
                    ctx.listBindings("java:comp/env/list");
                while (enm.hasMore()) {
                    Binding b = enm.next();
                    out.print(b.getObject().getClass().getName());
                }
            } catch (NamingException ne) {
View Full Code Here

    }
    assertTrue("Correct Integer registered", context3.lookup("myinteger") == i);
    assertTrue("Correct String registered", context3.lookup("mystring") == s);

    Map bindingMap = new HashMap();
    NamingEnumeration bindingEnum = context3.listBindings("");
    while (bindingEnum.hasMoreElements()) {
      Binding binding = (Binding) bindingEnum.nextElement();
      bindingMap.put(binding.getName(), binding);
    }
    assertTrue("Correct jdbc subcontext", ((Binding) bindingMap.get("jdbc")).getObject() instanceof Context);
View Full Code Here

    assertTrue("Correct jdbc subcontext", SimpleNamingContext.class.getName().equals(((Binding) bindingMap.get("jdbc")).getClassName()));

    Context jdbcContext = (Context) context3.lookup("jdbc");
    jdbcContext.bind("mydsX", ds);
    Map subBindingMap = new HashMap();
    NamingEnumeration subBindingEnum = jdbcContext.listBindings("");
    while (subBindingEnum.hasMoreElements()) {
      Binding binding = (Binding) subBindingEnum.nextElement();
      subBindingMap.put(binding.getName(), binding);
    }
View Full Code Here

            cursor.dispose();
        }
        environmentEntryBuilder.buildNaming(doc, null, null, componentContext);
        Context context = EnterpriseNamingContext.createEnterpriseNamingContext(NamingBuilder.JNDI_KEY.get(componentContext));
        Set actual = new HashSet();
        for (NamingEnumeration e = context.listBindings("env"); e.hasMore();) {
            NameClassPair pair = (NameClassPair) e.next();
            actual.add(pair.getName());
        }
        Set expected = new HashSet(Arrays.asList(new String[]{"string", "char", "byte", "short", "int", "long", "float", "double", "boolean"}));
        assertEquals(expected, actual);
View Full Code Here

  private Collection<String> getHermesIds() {
    Context ctx = HermesBrowser.getBrowser().getLoader().getContext();
    ArrayList<String> hermesIds = new ArrayList<String>();

    try {
      for (NamingEnumeration iter = ctx.listBindings(""); iter.hasMoreElements();) {
        final Binding binding = (Binding) iter.next();

        if (binding.getObject() instanceof Hermes) {
          final Hermes hermes = (Hermes) binding.getObject();
          hermesIds.add(binding.getName());
View Full Code Here

      try
      {
         final Vector<String> options = new Vector<String>();
         final Context ctx = HermesBrowser.getBrowser().getContext();

         for (NamingEnumeration names = ctx.listBindings(""); names.hasMore();)
         {
            final Binding b = (Binding) names.next();

            if (b.getObject() instanceof Hermes)
            {
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.