Package javax.naming

Examples of javax.naming.NameParser


                  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 + "," + groupsBaseDN;
                     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

            log("username " + username + " has multiple entries");
            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)
View Full Code Here

     *
     * @see javax.naming.Context#getNameParser(java.lang.String)
     */
    public NameParser getNameParser( String name ) throws NamingException
    {
        return new NameParser()
        {
            public Name parse( String name ) throws NamingException
            {
                return new DN( name );
            }
View Full Code Here

     *
     * @see javax.naming.Context#getNameParser(javax.naming.Name)
     */
    public NameParser getNameParser( Name name ) throws NamingException
    {
        return new NameParser()
        {
            public Name parse( String name ) throws NamingException
            {
                return new DN( name );
            }
View Full Code Here

            log("username " + username + " has multiple entries");
            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)
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

    public void testLocal ()
    throws Exception
    {
       
        InitialContext ic = new InitialContext();
        NameParser parser = ic.getNameParser("");
        ic.bind("foo", "xxx");
       
        Object o = ic.lookup("foo");
        assertNotNull(o);
        assertEquals("xxx", (String)o);
       
        ic.unbind("foo");
        try
        {
            ic.lookup("foo");
            fail("Foo exists");
        }
        catch (NameNotFoundException e)
        {
            //expected
        }
        Name name = parser.parse("a");
        name.addAll(parser.parse("b/c/d"));
        NamingUtil.bind(ic, name.toString(), "333");
        assertNotNull(ic.lookup("a"));
        assertNotNull(ic.lookup("a/b"));
        assertNotNull(ic.lookup("a/b/c"));
        Context c = (Context)ic.lookup("a/b/c");
        o = c.lookup("d");
        assertNotNull(o);
        assertEquals("333", (String)o);       
        assertEquals("333", ic.lookup(name));
        ic.destroySubcontext("a");
       
        name = parser.parse("");
        name.add("x");
        Name suffix = parser.parse("y/z");
        name.addAll(suffix);
        NamingUtil.bind(ic, name.toString(), "555");       
        assertEquals("555", ic.lookup(name));
        ic.destroySubcontext("x");
    }
View Full Code Here

        Properties sessionProps =  session.getProperties();
        assertEquals(props, sessionProps);
        assertTrue (session.getDebug());
       
        Context foo = icontext.createSubcontext("foo");
        NameParser parser = icontext.getNameParser("");
        Name objectNameInNamespace = parser.parse(icontext.getNameInNamespace());
        objectNameInNamespace.addAll(parser.parse("mail/Session"));
       
        NamingUtil.bind(foo, "mail/Session", new LinkRef(objectNameInNamespace.toString()));
       
        Object o = foo.lookup("mail/Session");
        assertNotNull(o);
View Full Code Here

        NamingEntry entry = null;
        try
        {        
            Name scopeName = getNameForScope(scope);
            InitialContext ic = new InitialContext();  
            NameParser parser = ic.getNameParser("");
            Name namingEntryName = makeNamingEntryName(parser, jndiName)
            scopeName.addAll(namingEntryName);          
            entry =  (NamingEntry)ic.lookup(scopeName);
        }
        catch (NameNotFoundException ee)
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.