Package javax.naming

Examples of javax.naming.NameParser


        if (result.isRelative()) {
           if (containerLog.isTraceEnabled()) {
               containerLog.trace("  search returned relative name: " +
                       result.getName());
           }
           NameParser parser = context.getNameParser("");
           Name contextName = parser.parse(context.getNameInNamespace());
           Name baseName = parser.parse(base);

           // Bugzilla 32269
           Name entryName =
               parser.parse(new CompositeName(result.getName()).get(0));

           Name name = contextName.addAll(baseName);
           name = name.addAll(entryName);
           return name.toString();
        } else {
           String absoluteName = result.getName();
           if (containerLog.isTraceEnabled())
               containerLog.trace("  search returned absolute name: " +
                       result.getName());
           try {
               // Normalize the name by running it through the name parser.
               NameParser parser = context.getNameParser("");
               URI userNameUri = new URI(absoluteName);
               String pathComponent = userNameUri.getPath();
               // Should not ever have an empty path component, since that is /{DN}
               if (pathComponent.length() < 1 ) {
                   throw new InvalidNameException(
                           "Search returned unparseable absolute name: " +
                           absoluteName );
               }
               Name name = parser.parse(pathComponent.substring(1));
               return name.toString();
           } catch ( URISyntaxException e ) {
               throw new InvalidNameException(
                       "Search returned unparseable absolute name: " +
                       absoluteName );
View Full Code Here


   level operations here.
    */
   public Object invoke(Object obj, Method method, Object[] args) throws Throwable
   {
      Context ctx = new InitialContext();
      NameParser parser = ctx.getNameParser("");
      String securityDomain = null;
      Name name = null;
     
     
      String methodName = method.getName();
      if( methodName.equals("toString") == true )
         return SecurityConstants.JAAS_CONTEXT_ROOT + " Context proxy";

      if( methodName.equals("list") == true )
         return new DomainEnumeration(JNDIBasedSecurityManagement.securityMgrMap.keys(),
               JNDIBasedSecurityManagement.securityMgrMap);
     
      if(methodName.equals("bind") || methodName.equals("rebind"))
      {
         if( args[0] instanceof String )
            name = parser.parse((String) args[0]);
         else
            name = (Name)args[0];
         securityDomain = name.get(0);
         SecurityDomainContext val = (SecurityDomainContext)args[1];
         JNDIBasedSecurityManagement.securityMgrMap.put(securityDomain, val);
         return obj;
      }
      if( methodName.equals("lookup") == false )
         throw new OperationNotSupportedException("Only lookup is supported, op="+method);
      if( args[0] instanceof String )
         name = parser.parse((String) args[0]);
      else
         name = (Name)args[0];
      securityDomain = name.get(0);
      SecurityDomainContext securityDomainCtx = lookupSecurityDomain(securityDomain);
      //TODO: Legacy expectation was subjectsecuritymgr
View Full Code Here

               results = ctx.search(ldapAttrMapping.groupsURL, filter, constraints);
               while (results.hasMoreElements())
               {
                  SearchResult sr = results.next();
                  NameParser parser = ctx.getNameParser("");
                  Name entryNameName = parser.parse(new CompositeName(sr.getName()).get(0));
                  String entryName =
                     entryNameName.getSuffix(0).toString()
                        .substring(entryNameName.getSuffix(1).toString().length() + 1);
                  String groupDN = entryName + "," + ldapAttrMapping.groupsURL;
                  Group group = getGroupByDN(ctx, groupDN);
View Full Code Here

               results = ctx.search(ldapAttrMapping.groupsURL, filter, constraints);
               while (results.hasMoreElements())
               {
                  SearchResult sr = results.next();
                  NameParser parser = ctx.getNameParser("");
                  Name entryNameName = parser.parse(new CompositeName(sr.getName()).get(0));
                  String entryName =
                     entryNameName.getSuffix(0).toString()
                        .substring(entryNameName.getSuffix(1).toString().length() + 1);
                  String groupDN = entryName + "," + ldapAttrMapping.groupsURL;
                  Group group = getGroupByDN(ctx, groupDN);
View Full Code Here

                  return groups;
               }
               while (results.hasMoreElements())
               {
                  SearchResult sr = results.next();
                  NameParser parser = ctx.getNameParser("");
                  CompositeName name = new CompositeName(sr.getName());
                  if (name.size() > 0)
                  {
                     Name entryName = parser.parse(name.get(0));
                     String groupDN = entryName + "," + ldapAttrMapping.groupsURL;
                     Group group = this.buildGroup(groupDN, sr.getAttributes());
                     if (group != null)
                        addGroup(groups, group);
                  }
View Full Code Here

               // add groups for memberships matching user
               Set<String> uniqueGroupsDN = new HashSet<String>();
               while (results != null && results.hasMore())
               {
                  SearchResult sr = results.next();
                  NameParser parser = ctx.getNameParser("");
                  CompositeName name = new CompositeName(sr.getName());
                  if (name.size() < 1)
                     break;
                  Name entryName = parser.parse(name.get(0));
                  String membershipDN = entryName + "," + ldapAttrMapping.groupsURL;
                  uniqueGroupsDN.add(this.getGroupDNFromMembershipDN(membershipDN));
               }
               for (String groupDN : uniqueGroupsDN)
               {
View Full Code Here

                  new Object[]{sid, scopedRole}, constraints);
         }
         while (answer.hasMoreElements())
         {
            SearchResult sr = answer.next();
            NameParser parser = ctx.getNameParser("");
            Name entryName = parser.parse(new CompositeName(sr.getName()).get(0));
            return entryName + "," + baseDN;
         }
         return null;
      }
      catch (NameNotFoundException e)
View Full Code Here

            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);
            Name entryName = parser.parse(result.getName());
            Name name = contextName.addAll(baseName);
            name = name.addAll(entryName);
            String dn = name.toString();

            Attributes attrs = result.getAttributes();
View Full Code Here

        if (result.isRelative()) {
           if (containerLog.isTraceEnabled()) {
               containerLog.trace("  search returned relative name: " +
                       result.getName());
           }
           NameParser parser = context.getNameParser("");
           Name contextName = parser.parse(context.getNameInNamespace());
           Name baseName = parser.parse(base);
  
           // Bugzilla 32269
           Name entryName =
               parser.parse(new CompositeName(result.getName()).get(0));
  
           Name name = contextName.addAll(baseName);
           name = name.addAll(entryName);
           return name.toString();
        } else {
           String absoluteName = result.getName();
           if (containerLog.isTraceEnabled())
               containerLog.trace("  search returned absolute name: " +
                       result.getName());
           try {
               // Normalize the name by running it through the name parser.
               NameParser parser = context.getNameParser("");
               URI userNameUri = new URI(absoluteName);
               String pathComponent = userNameUri.getPath();
               // Should not ever have an empty path component, since that is /{DN}
               if (pathComponent.length() < 1 ) {
                   throw new InvalidNameException(
                           "Search returned unparseable absolute name: " +
                           absoluteName );
               }
               Name name = parser.parse(pathComponent.substring(1));
               return name.toString();
           } catch ( URISyntaxException e ) {
               throw new InvalidNameException(
                       "Search returned unparseable absolute name: " +
                       absoluteName );
View Full Code Here

            throws NamingException {
        ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);

        InitialContext initialContext = new InitialContext();

        NameParser nameParser = initialContext.getNameParser("");

        Name connectionFactoryName = nameParser.parse(getConnectionFactory(facesContext, configurationService));
        Name topicsNamespace = nameParser.parse(getTopicsNamespace(facesContext, configurationService));

        String username = getUserName(facesContext, configurationService);
        String password = getPassword(facesContext, configurationService);

        return new JMSTopicsContextImpl(threadFactory, initialContext, connectionFactoryName, topicsNamespace, username,
View Full Code Here

TOP

Related Classes of javax.naming.NameParser

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.