Package javax.naming.directory

Examples of javax.naming.directory.Attributes


  }
 
  /* A couple of simple sanity tests. Don't run normally (rename to run) */
  public void notestGeo() throws NamingException
  {
    Attributes attrs = context.getAttributes("ldap://ldap.hp.com/hprealestateid=buk03,%20ou=locations,%20o=hp.com");
   
    NamingEnumeration<? extends Attribute> enume = attrs.getAll();
   
    while (enume.hasMore())
    {
      Attribute attr = enume.next();
      log.info("Attr: " + attr.getID() + " " + attr.get());
View Full Code Here


    assertTrue("I found Paul", results.hasMore());
   
    while (results.hasMore())
    {
      SearchResult result = results.next();
      Attributes attributes = result.getAttributes();
      NamingEnumeration<? extends Attribute> theAttributes = attributes.getAll();
      while (theAttributes.hasMore())
      {
        Attribute attribute = theAttributes.next();
        log.info("Attribute: " + attribute.getID());
        DirContext foo = attribute.getAttributeSyntaxDefinition();
        assertNotNull("I have a syntax definition", foo);
        Attributes lister = foo.getAttributes("");
        if (lister.get("numericoid").get().equals("1.3.6.1.4.1.1466.115.121.1.12"))
        {
          String bar = (String) attribute.get();
          log.info("Points to: " + bar);
          log.info(context.getAttributes(directory + bar));
        }
View Full Code Here

    private void loadRoles(String filter, InitialLdapContext context, boolean removeMissingEntries) throws Exception {
        final Collection<String> groupNames = groupContainer.retrievePrincipalNames();
        PagedResultMapper mapper = new AbstractPagedResultMapper() {
            public void mapSearchResult(SearchResult searchResult) throws NamingException {
                String dn = searchResult.getNameInNamespace();
                Attributes attributes = searchResult.getAttributes();
                String commonName = getAttributeValue(attributes, COMMON_NAME_ATTRIBUTE);
                if (commonName.length() != 0) {
                    Long rid = ActiveDirectoryGroup.getRIDFromSID((byte[]) attributes.get(OBJECT_SID_ATTRIBUTE).get());
                    ActiveDirectoryGroup group = new ActiveDirectoryGroup(commonName, dn, getEscapedDn(dn), rid, getRealm());
                    String[] parents = getParents(attributes);
                    String key = groupContainer.storeGroup(group, parents);
                    groupNames.remove(key);
                }
View Full Code Here

                actualDN = (actualDN == null ? "" : actualDN + ",") + elm;
            }
        }

        try {
            Attributes attributes = context.getAttributes(actualDN, USER_ATTRS);
            return populateActiveDirectoryUser(dn, attributes);
        } catch (Exception e) {
            logger.error("Cannot locate user for DN " + dn, e);
            throw new NamingException("User not found for DN " + dn);
        }
View Full Code Here

        protected abstract Object doIt(InitialLdapContext context) throws Exception;
    }

    protected String getAttributeValue(String dn, String attributeName) throws NamingException, UserDatabaseException {
        Attributes attributes = getAttributes(dn, new String[] { attributeName });
        return getAttributeValue(attributes, attributeName);
    }
View Full Code Here

    }
    Context ctx = getContext();

    Any param;
    Object value = parameters[1].toObject();
    Attributes attrs = null;

    if (parameters.length > 2) {
      param = parameters[2];
      if (param instanceof AnyAttributes) {
        attrs = (Attributes)param.toObject();
View Full Code Here

    }
    Context ctx = getContext();

    Any param;
    Object value = parameters[1].toObject();
    Attributes attrs = null;

    if (parameters.length > 2) {
      param = parameters[2];
      if (param instanceof AnyAttributes) {
        attrs = (Attributes)param.toObject();
View Full Code Here

      throw parametersMissing(context, "create");
    }
    Context ctx = getContext();

    Any param;
    Attributes attrs = null;

    if (parameters.length > 1) {
      param = parameters[1];
      if (param instanceof AnyAttributes) {
        attrs = (Attributes)param.toObject();
View Full Code Here

    int i = 0;
    Any param;

    Name name = null;
    String sname = null;
    Attributes attributes = null;
    ModificationItem[] modifications = null;
    int modop = DirContext.REPLACE_ATTRIBUTE;
   
    for(; i<n; i++) {
      param = parameters[i];
View Full Code Here

        indexedAttrs.add("objectClass");
        indexedAttrs.add("o");
        pcfg.setIndexedAttributes(indexedAttrs);

        // Create a first entry associated to the partition
        Attributes attrs = new BasicAttributes(true);

        // First, the objectClass attribute
        Attribute attr = new BasicAttribute("objectClass");
        attr.add("top");
        attr.add("organization");
        attrs.put(attr);

        // The the 'Organization' attribute
        attr = new BasicAttribute("o");
        attr.add("sevenseas");
        attrs.put(attr);

        // Associate this entry to the partition
        pcfg.setContextEntry(attrs);

        // As we can create more than one partition, we must store
View Full Code Here

TOP

Related Classes of javax.naming.directory.Attributes

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.