Package javax.naming

Examples of javax.naming.NamingEnumeration


                destDir.mkdirs();
            }

            // Looking up directory /WEB-INF/lib in the context
            try {
                NamingEnumeration enumeration = resources.listBindings(libPath);
                while (enumeration.hasMoreElements()) {

                    Binding binding = (Binding) enumeration.nextElement();
                    String filename = libPath + "/" + binding.getName();
                    if (!filename.endsWith(".jar"))
                        continue;

                    // Copy JAR in the work directory, always (the JAR file
View Full Code Here


     */
    private boolean copyDir(DirContext srcDir, File destDir) {

        try {

            NamingEnumeration enumeration = srcDir.list("");
            while (enumeration.hasMoreElements()) {
                NameClassPair ncPair =
                    (NameClassPair) enumeration.nextElement();
                String name = ncPair.getName();
                Object object = srcDir.lookup(name);
                File currentFile = new File(destDir, name);
                if (object instanceof Resource) {
                    InputStream is = ((Resource) object).streamContent();
View Full Code Here

            {
                String filter = "(&(objectclass=ipHost)(objectclass=ieee802Device)(macaddress={0}))";
                SearchControls sc = new SearchControls();
                sc.setCountLimit( 1 );
                sc.setSearchScope( SearchControls.SUBTREE_SCOPE );
                NamingEnumeration ne = ctx.search( "", filter, new Object[]
                    { hardwareAddress.toString() }, sc );

                if ( ne.hasMoreElements() )
                {
                    SearchResult sr = ( SearchResult ) ne.next();
                    Attributes att = sr.getAttributes();
                    Attribute ipHostNumberAttribute = att.get( "iphostnumber" );

                    if ( ipHostNumberAttribute != null )
                    {
View Full Code Here

        Attributes attrs = rec.getAttributes();
       
        logger.fine("Found " + attrs.size() +
                    " attributes for " + rec.getUserId());

        NamingEnumeration attrEnum = attrs.getAll();
        try {
            while (attrEnum.hasMore()) {
                Attribute attr = (Attribute) attrEnum.next();
                if (attrNames == null || attrNames.isEmpty() ||
                    attrNames.contains(attr.getID()))
                {
                    res.append(NAME_PREFIX + attr.getID() + "\n");
                   
                    NamingEnumeration valEnum = attr.getAll();
                    while (valEnum.hasMore()) {
                        res.append(VALUE_PREFIX + valEnum.next() + "\n");
                    }
                }
            }
        } catch (NamingException ne) {
            throw new WebApplicationException(ne,
View Full Code Here

        Attributes attrs = rec.getAttributes();

        logger.fine("Found " + attrs.size() +
                    " attributes for " + rec.getUserId());

        NamingEnumeration attrEnum = attrs.getAll();
        try {
            while (attrEnum.hasMore()) {
                Attribute attr = (Attribute) attrEnum.next();
                if (attrNames == null || attrNames.isEmpty() ||
                    attrNames.contains(attr.getID()))
                {
                    res.append(NAME_PREFIX + attr.getID() + "\n");

                    NamingEnumeration valEnum = attr.getAll();
                    while (valEnum.hasMore()) {
                        res.append(VALUE_PREFIX + valEnum.next() + "\n");
                    }
                }
            }
        } catch (NamingException ne) {
            throw new WebApplicationException(ne,
View Full Code Here

        if (debug > 3) {
            log("  Searching for " + username);
            log("  base: " + userBase + "  filter: " + filter);
        }
       
        NamingEnumeration results =
            context.search(userBase, filter, constraints);
       
       
        // Fail if no entries found
        if (results == null || !results.hasMore()) {
            if (debug > 2) {
                log("  username not found");
            }
            return (null);
        }
       
        // Get result for the first entry found
        SearchResult result = (SearchResult)results.next();
       
        // Check no further entries were found
        if (results.hasMore()) {
            log("username " + username + " has multiple entries");
            return (null);
        }

        // Get the entry's distinguished name
View Full Code Here

        if (debug >= 3) {
            log("  Searching role base '" + roleBase + "' for attribute '" +
                roleName + "'");
            log("  With filter expression '" + filter + "'");
        }
        NamingEnumeration results =
            context.search(roleBase, filter, controls);
        if (results == null)
            return (list)// Should never happen, but just in case ...
        while (results.hasMore()) {
            SearchResult result = (SearchResult) results.next();
            Attributes attrs = result.getAttributes();
            if (attrs == null)
                continue;          
            list = addAttributeValues(roleName, attrs, list);  
        }
View Full Code Here

        if (values == null)
            values = new ArrayList();
        Attribute attr = attrs.get(attrId);
        if (attr == null)
            return (null);
        NamingEnumeration e = attr.getAll();
        while(e.hasMore()) {
            String value = (String)e.next();
            values.add(value);
        }                      
        return values;
    }
View Full Code Here

     */
    private boolean copyDir(DirContext srcDir, File destDir) {

        try {

            NamingEnumeration enumeration = srcDir.list("");
            while (enumeration.hasMoreElements()) {
                NameClassPair ncPair =
                    (NameClassPair) enumeration.nextElement();
                String name = ncPair.getName();
                Object object = srcDir.lookup(name);
                File currentFile = new File(destDir, name);
                if (object instanceof Resource) {
                    InputStream is = ((Resource) object).streamContent();
View Full Code Here

        if (log.isTraceEnabled()) {
            log.trace("  Scanning TLDs in " + rootPath + " subdirectory");
        }

        try {
            NamingEnumeration items = resources.list(rootPath);
            while (items.hasMoreElements()) {
                NameClassPair item = (NameClassPair) items.nextElement();
                String resourcePath = rootPath + "/" + item.getName();
                if (!resourcePath.endsWith(".tld")
                        && (resourcePath.startsWith("/WEB-INF/classes")
                            || resourcePath.startsWith("/WEB-INF/lib"))) {
                    continue;
View Full Code Here

TOP

Related Classes of javax.naming.NamingEnumeration

Copyright © 2018 www.massapicom. 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.