Examples of NamingEnumeration


Examples of javax.naming.NamingEnumeration

      props.put("java.naming.provider.url","scn://localhost:16430");
    }
    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();
View Full Code Here

Examples of javax.naming.NamingEnumeration

   * Parameter  : None
   * Return    : None, prints to the system output the list of all attributes
   */
  public void listAllAttributes() throws Exception
  {
    NamingEnumeration   valueEnum = null;
    Attribute      attr = null;
    int         aindex = 0, vindex = 0;

    this.getAllAttributes();

    // Search for objects that have those matching attributes
    NamingEnumeration attrEnum = attributes.getAll();
   
    aindex = 0;
   
    // List the attributes
    while (attrEnum.hasMore())
    {
      attr = (Attribute)attrEnum.next();
     
      System.out.println("Attribute[ " + aindex + "]: " + attr.getID());
     
      valueEnum = attr.getAll();

View Full Code Here

Examples of javax.naming.NamingEnumeration

     
        Attribute attr = attrs.get( "aaaa" );
     
        if ( attr != null ){
         
          NamingEnumeration values = attr.getAll();
     
          while( values.hasMore()){
         
            Object value = values.next();
           
            if ( value instanceof String ){
             
              try{
                result.add( (Inet6Address)InetAddress.getByName((String)value));
View Full Code Here

Examples of javax.naming.NamingEnumeration

    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      if (isRoot) {
        NamingEnumeration enu = ctx.list(isTribe? "ou=groups" : "ou=users");
 
        while (enu.hasMore()) {
          String name = ((NameClassPair)enu.next()).getName();
          name = name.substring(name.indexOf("=")+1);
          if (isTribe) {
            result.add( realm.getTribe(name) );
          } else {
            result.add( realm.getCitizen(name) );
View Full Code Here

Examples of javax.naming.NamingEnumeration

    /**
     * Performs a relative list on the context
     */
    public void testRelativeList() throws NamingException {
        NamingEnumeration listing = this.ic.list("");
        assertNotNull("Listing of current context must be non-null", listing);
        listing.close();
    }
View Full Code Here

Examples of javax.naming.NamingEnumeration

    /**
     * Performs an absolute list on the context
     */
    public void testAbsoluteList() throws NamingException {
        NamingEnumeration listing1 = this.ic.list("java:/comp/env");
        assertNotNull("Listing of java:/comp/env must be non-null", listing1);
        listing1.close();
        NamingEnumeration listing2 = this.ic.list("java:/comp/env/");
        assertNotNull("Listing of java:/comp/env/ must be non-null", listing2);
        listing2.close();
    }
View Full Code Here

Examples of javax.naming.NamingEnumeration

     */
    public void testCreateDestroyContexts() throws NamingException {
        Context child = this.ic.createSubcontext("TestChildContext");
        assertNotNull("Created subcontext TestChildContext must not be null",
                child);
        NamingEnumeration listing = child.list("");
        assertTrue("Listing on new child context is empty", !listing
                .hasMoreElements());
        listing.close();
        this.ic.destroySubcontext("java:/comp/env/TestChildContext");
    }
View Full Code Here

Examples of javax.naming.NamingEnumeration

    /*
     * Execute the given LDAP requests
     */
    Vector requests = extractRequests((Document) callData);
    NamingEnumeration results = null;
    DirContext context = connection.getContext();
    SearchControls controls = connection.getSearchControls();

    for (Iterator it = requests.iterator(); it.hasNext();)
    {
View Full Code Here

Examples of javax.naming.NamingEnumeration

    Element record = null;
    Element attribute = null;

    SearchResult sr = null;
    NamingEnumeration attrs = null;
    Attribute attr = null;
    String key = null;
    NamingEnumeration values = null;
    String value = null;

    try
    {
      while (results.hasMore())
      {
        sr = (SearchResult) results.next();
        attrs = sr.getAttributes().getAll();

        record = doc.createElement("Record");

        while (attrs.hasMore())
        {
          attr = (Attribute) attrs.next();
          key = attr.getID();
          values = attr.getAll();
          while (values.hasMore())
          {
            value = values.next().toString();
            attribute = doc.createElement(key);
            attribute.appendChild(doc.createTextNode(value));
            record.appendChild(attribute);
          }
        }
View Full Code Here

Examples of javax.naming.NamingEnumeration

      if (contextName == null) contextName = "/";
      out.println(contextName);
      StringBuffer buf = new StringBuffer(contextName.length());
      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() + "'");           
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.