Package javax.naming

Examples of javax.naming.Name


 
  if (jndiName != null)
  {
      // Thanks to David D. Kilzer for this code to auto-create
      // subcontext paths!
      Name name = ictx.getNameParser( jndiName ).parse( jndiName );
      Context ctx = ictx;
      for (int i = 0, max = name.size() - 1; i < max; i++)
      {
    try
    { ctx = ctx.createSubcontext( name.get( i ) ); }
    catch (NameAlreadyBoundException ignore)
    { ctx = (Context) ctx.lookup( name.get( i ) ); }
      }

       ictx.rebind( jndiName, combods );
  }
View Full Code Here


    {
        final DefaultConfiguration configuration;

        final String absoluteName = context.getNameInNamespace();
        final NameParser parser = context.getNameParser( absoluteName );
        final Name parsedName = parser.parse( absoluteName );

        String name = absoluteName;
        String prefix = "";
        //if composite name, use only the relative name.
        final int position = parsedName.size();
        if( position > 0 )
        {
            name = parsedName.get( position - 1 );
        }

        if( context instanceof DirContext )
        {
            //extract element name, and namespace prefix
View Full Code Here

            // first get the resource incase there are exceptions
            Object value = $getResource();

            // get the initial context
            Context context = new InitialContext();
            Name parsedName = context.getNameParser("").parse(jndiName);

            // create intermediate contexts
            for (int i = 1; i < parsedName.size(); i++) {
                Name contextName = parsedName.getPrefix(i);
                if (!bindingExists(context, contextName)) {
                    context.createSubcontext(contextName);
                }
            }
View Full Code Here

        if (user == null) {
            return new ClaimCollection();
        }
       
        if (!LdapUtils.isDN(user)) {
            Name dn = LdapUtils.getDnOfEntry(ldap, this.userBaseDn, this.getUserObjectClass(),
                                             this.getUserNameAttribute(), user);
            if (dn != null) {
                user = dn.toString();
                LOG.fine("DN for (" + this.getUserNameAttribute() + "=" + user + ") found: " + user);
            } else {
                LOG.warning("DN not found for user '" + user + "'");
                return new ClaimCollection();
            }
View Full Code Here

            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();
            if (attrs == null) {
                return false;
            }
View Full Code Here

              // Since UID is unique across the entire directory,
              // the search results should contain only one entry.
              SearchResult sr = (SearchResult) results.next();
              // we need the DN to authenticate the user
              NameParser parser = ctx.getNameParser(BASE);
          Name userDN = parser.parse(BASE);

          if (userDN == (Name) null)
          // This should not happen in theory
          throw new NameNotFoundException();
          else
          userDN.addAll(parser.parse(sr.getName()));
          user.put("userDN", userDN.toString());
                   
              // Get all available attribute types and their associated values.
          // we can build a user object to return.
              Attributes attributes = sr.getAttributes();
View Full Code Here

                // This fixes a bug for war files that don't record separate
                // zip entries for the directories.
                int currentPos = -1;
                int lastPos = 0;
                while ((currentPos = name.indexOf('/', lastPos)) != -1) {
                    Name parentName = new CompositeName(name.substring(0, lastPos));
                    Name childName = new CompositeName(name.substring(0, currentPos));
                    String entryName = name.substring(lastPos, currentPos);
                    // Parent should have been created in last cycle through
                    // this loop
                    Entry parent = treeLookup(parentName);
                    Entry child = treeLookup(childName);
                    if (child == null) {
                        // Create a new entry for missing entry and strip off
                        // the leading '/' character and appended on by the
                        // normalize method and add '/' character to end to
                        // signify that it is a directory entry
                        String zipName = name.substring(1, currentPos) + "/";
                        child = new Entry(entryName, new ZipEntry(zipName));
                        if (parent != null)
                            parent.addChild(child);
                    }
                    // Increment lastPos
                    lastPos = currentPos + 1;
                }
                String entryName = name.substring(pos + 1, name.length());
                Name compositeName = new CompositeName(name.substring(0, pos));
                Entry parent = treeLookup(compositeName);
                Entry child = new Entry(entryName, entry);
                if (parent != null)
                    parent.addChild(child);
               
View Full Code Here

            return (null);
        }

        // Get the entry's distinguished name
        NameParser parser = context.getNameParser("");
        Name contextName = parser.parse(context.getNameInNamespace());
        Name baseName = parser.parse(userBase);

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

        Name name = contextName.addAll(baseName);
        name = name.addAll(entryName);
        String dn = name.toString();

        if (containerLog.isTraceEnabled())
            containerLog.trace("  entry found for " + username + " with dn " + dn);

        // Get the entry's attributes
View Full Code Here

            return (null);
        }

        // Get the entry's distinguished name
        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();
       
        if (debug > 2)
            log("  entry found for " + username + " with dn " + dn);

        // Get the entry's attributes
View Full Code Here

    public Object lookupLink(String name) throws NamingException {
        return lookup(name);
    }

    public Name composeName(Name name, Name prefix) throws NamingException {
        Name result = (Name)prefix.clone();
        result.addAll(name);
        return result;
    }
View Full Code Here

TOP

Related Classes of javax.naming.Name

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.