Examples of NameClassPair


Examples of javax.naming.NameClassPair

    System.out.println("JNDI props = " + props + "\n");
   
    javax.naming.Context jndiCtx = new javax.naming.InitialContext(props);
     NamingEnumeration e = jndiCtx.list("");
     while (e.hasMore()) {
       NameClassPair ncp = (NameClassPair) e.next();
       System.out.println("ncp = " +ncp);
       System.out.println("  obj = " + jndiCtx.lookup(ncp.getName()));
     }
     jndiCtx.close();

    System.out.println("Admin closed.");
  }
View Full Code Here

Examples of javax.naming.NameClassPair

    NameClassPair[] res = new NameClassPair[records.size()];
    for (int i = 0; i < records.size(); i++) {
      Record r = (Record)records.elementAt(i);
      if (r instanceof ObjectRecord) {
        ObjectRecord or = (ObjectRecord)r;
        res[i] = new NameClassPair(
          or.getName(),
          getClassName(or.getObject()),
          true);
      } else if (r instanceof ContextRecord) {
        res[i] = new NameClassPair(
          r.getName(),
          Context.class.getName(),
          true);
      }
    }
View Full Code Here

Examples of javax.naming.NameClassPair

      for (int i=0; i < contextName.length(); i++) buf.append(" ");
      String offset = buf.toString();
      NamingEnumeration enumer = context.list("");
      while (enumer.hasMore()) {
         try {
            NameClassPair pair = (NameClassPair)enumer.next();
            Object obj = context.lookup(pair.getName());
            if (obj instanceof Context) scanContext(contextName + pair.getName() + "/", (Context)obj, out);        
            else {
               out.println(offset +  pair.getName() + " class='" + pair.getClassName() + "'");           
   //            out.println(tmpOffset + " class='" + pair.getClassName() + "'");           
            }
         }
         catch (javax.naming.CommunicationException e) {
            out.println("Ignoring problem: " + e.toString());
View Full Code Here

Examples of javax.naming.NameClassPair

    public WinstoneNameEnumeration(Map bindings) {
        Object keys[] = bindings.keySet().toArray();
        Arrays.sort(keys);
        Vector nameClassPairs = new Vector();
        for (int n = 0; n < keys.length; n++)
            nameClassPairs.add(new NameClassPair((String) keys[n], bindings
                    .get(keys[n]).getClass().getName()));
        this.nameEnumeration = nameClassPairs.elements();
    }
View Full Code Here

Examples of javax.naming.NameClassPair

            }

            // Loop on all objects
            List<String> names = new ArrayList<String>();
            while (namingEnumeration.hasMoreElements()) {
                NameClassPair ncp = namingEnumeration.nextElement();

                String txt = "[Name='" + ncp.getName() + "', class='" + ncp.getClassName() + "']";
                names.add(txt);

                if (this.unbindOnStop) {
                    try {
                        new InitialContext().unbind(ncp.getName());
                        this.logger.info("Unbind of " + txt + " done !");
                    } catch (NamingException e) {
                        this.logger.error("Unable to unbind the name '" + ncp.getName() + "'", e);
                    }
                }
            }

            // Display all objects that were still bound
View Full Code Here

Examples of javax.naming.NameClassPair

     *         its subclasses for the possible naming exceptions.
     */
    public NameClassPair next() throws NamingException {
        String name = (String) names.nextElement();
        String className = bindings.get(name).getClass().getName();
        return new NameClassPair(name, className);
    }
View Full Code Here

Examples of javax.naming.NameClassPair

      InitialContext ctx = getInitialContext();
      NamingEnumeration names = ctx.list("");
      int count = 0;
      while( names.hasMore() )
      {
         NameClassPair ncp = (NameClassPair) names.next();
         log.info(ncp);
         count ++;
      }
      log.info("list count = "+count);
      assertTrue("list count > 0 ", count > 0);
View Full Code Here

Examples of javax.naming.NameClassPair

      InitialContext ctx = getInitialContext();
      NamingEnumeration names = ctx.list("");
      int count = 0;
      while( names.hasMore() )
      {
         NameClassPair ncp = (NameClassPair) names.next();
         log.info(ncp);
         count ++;
      }
      assertTrue("list count > 0 ", count > 0);
   }
View Full Code Here

Examples of javax.naming.NameClassPair

         InitialContext ic = getInitialContext();
         NamingEnumeration list = ic.list(context);

         while (list.hasMore())
         {
            NameClassPair nc = (NameClassPair) list.next();
            log.info(nc.toString());
         }
         log.info("Dumped JNDI context");
      }
      catch (Exception e)
      {
View Full Code Here

Examples of javax.naming.NameClassPair

      tmp.append(name);
      getLog().info(tmp.toString());
      NamingEnumeration<NameClassPair> iter = ctx.list(name);
      while(iter.hasMore())
      {
         NameClassPair ncp = iter.next();
         tmp.setLength(0);
         for(int n = 0; n <= depth; n ++)
            tmp.append('+');
         tmp.append(ncp.getName());
         getLog().info(tmp.toString());
         if(ncp.getClassName().equals("javax.naming.Context"))
            dumpGlobalJndi(name+"/"+ncp.getName(), depth+1);
      }
   }
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.