Package javax.naming

Examples of javax.naming.NamingEnumeration


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


      // provide defaults if not present (backward compatibility)
      String userAttribute =
    defaultProperties.getProperty(USR_ATTR_PROP, USR_ATTR_DEFAULT);
      searchFilter = "(" + userAttribute + "=" + userId + ")";
      SearchControls scope = new SearchControls();
      NamingEnumeration results;

      recursiveSearch = isSubtreeSearch();
      if (recursiveSearch) {
    scope.setSearchScope(SearchControls.SUBTREE_SCOPE);
    objectName = defaultProperties.getProperty(PROVIDER_URL_PROP);
      }
      else {
    scope.setSearchScope(SearchControls.ONELEVEL_SCOPE);
    objectName = 
        defaultProperties.getProperty(USR_BRANCH_PROP, USR_BRANCH_DEFAULT);
      }
 
      if (log.isDebugEnabled())
    log.debug("searching object " + objectName + " filtering with " + searchFilter + ", recursive search ? " + recursiveSearch);

      results = context.search(objectName, searchFilter, scope);

      if (results != null && results.hasMore()) {
    result = (SearchResult)results.next();

    // sanity check: if more than one entry is returned
    // for a user-id, then the directory is probably flawed,
    // so it would be nice to warn the administrator.
    //
View Full Code Here

                attribs = new String[]{userRoleName};
            }
            constraints.setReturningAttributes(attribs);


            NamingEnumeration results = context.search(userBase, filter, constraints);

            if (results == null || !results.hasMore()) {
                return false;
            }

            SearchResult result = (SearchResult) results.next();

            if (results.hasMore()) {
                //ignore for now
            }
            NameParser parser = context.getNameParser("");
            Name contextName = parser.parse(context.getNameInNamespace());
            Name baseName = parser.parse(userBase);
View Full Code Here

            constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
        } else {
            constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
        }
        constraints.setReturningAttributes(new String[] { roleName });
        NamingEnumeration results =
                context.search(roleBase, filter, constraints);
        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

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

    * This method removes any previously registered topic expression evaluators, so handle with care.
    */
   public synchronized void refresh(  )
   {
      m_evaluators.clear(  );
      NamingEnumeration list = null;
      try
      {
         Context context = new InitialContext(  );
         list = context.list( JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT );
         while ( list.hasMore(  ) )
         {
            NameClassPair            pair      = (NameClassPair) list.next(  );
            TopicExpressionEvaluator evaluator =
               (TopicExpressionEvaluator) JNDIUtils.lookup( context,
                                                            JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT + "/"
                                                            + pair.getName(  ), TopicExpressionEvaluator.class );
            registerEvaluator( evaluator );
         }
      }
      catch ( NamingException ne )
      {
         LOG.warn( "topicEngineInitError: " + ne );
         registerEvaluator( new SimpleTopicExpressionEvaluator(  ) );
         registerEvaluator( new ConcreteTopicExpressionEvaluator(  ) );
         registerEvaluator( new FullTopicExpressionEvaluator(  ) );
      }
      finally
      {
         if ( list != null )
         {
            try
            {
               list.close(  );
            }
            catch ( NamingException ne )
            {
            }
         }
View Full Code Here

                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

        sb.append("<entries>");

        try {

            // Render the directory entries within this directory
            NamingEnumeration enumeration = resources.list(cacheEntry.name);
           
            // rewriteUrl(contextPath) is expensive. cache result for later reuse
            String rewrittenContextPath =  rewriteUrl(contextPath);

            while (enumeration.hasMoreElements()) {

                NameClassPair ncPair = (NameClassPair) enumeration.nextElement();
                String resourceName = ncPair.getName();
                String trimmed = resourceName/*.substring(trim)*/;
                if (trimmed.equalsIgnoreCase("WEB-INF") ||
                    trimmed.equalsIgnoreCase("META-INF") ||
                    trimmed.equalsIgnoreCase(localXsltFile))
View Full Code Here

        sb.append("</tr>");

        try {

            // Render the directory entries within this directory
            NamingEnumeration enumeration = resources.list(cacheEntry.name);
            boolean shade = false;
            while (enumeration.hasMoreElements()) {

                NameClassPair ncPair = (NameClassPair) enumeration.nextElement();
                String resourceName = ncPair.getName();
                String trimmed = resourceName/*.substring(trim)*/;
                if (trimmed.equalsIgnoreCase("WEB-INF") ||
                    trimmed.equalsIgnoreCase("META-INF"))
                    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.