Package javax.naming.directory

Examples of javax.naming.directory.Attribute


   
    NamingEnumeration<? extends Attribute> enume = attrs.getAll();
   
    while (enume.hasMore())
    {
      Attribute attr = enume.next();
      log.info("Attr: " + attr.getID() + " " + attr.get());
    }
  }
View Full Code Here


      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));
        }
        foo.close();
       
        NamingEnumeration<?> vals = attribute.getAll();
        while (vals.hasMore())
        {
          Object val = vals.next();
          log.info("\t" + val + " {" + val.getClass() + "}");
        }
View Full Code Here

        }
    }

    private String[] getParents(Attributes attributes) throws NamingException {
        List<String> parents = new ArrayList<String>();
        Attribute memberOfAttribute = attributes.get(MEMBER_OF_ATTIBUTE);
        if (memberOfAttribute != null) {
            final PagedResultTemplate pagedResultTemplate = configuration.getPagedResultTemplate();
            for (int index = 0; index < memberOfAttribute.size(); index++) {
                String parentDn = (String) memberOfAttribute.get(index);
                if (pagedResultTemplate.isDnValid(parentDn)) {
                    parents.add(parentDn); // valid parent so record
                }
            }
        }
View Full Code Here

        }
        return groups.toArray(new ActiveDirectoryGroup[groups.size()]);
    }

    private Collection<ActiveDirectoryGroup> getUsersGroups(Attributes attributes) throws NamingException {
        Attribute memberOfAttribute = attributes.get(MEMBER_OF_ATTIBUTE);
        if (memberOfAttribute == null) {
            return Collections.<ActiveDirectoryGroup>emptyList();
        }
       
        Collection<ActiveDirectoryGroup> groups = new ArrayList<ActiveDirectoryGroup>();
        for (int index = 0; index < memberOfAttribute.size(); index++) {
            String groupDn = (String) memberOfAttribute.get(index);
            groups.addAll(getGroupsByDn(groupDn));
        }
        return groups;
    }
View Full Code Here

    protected static String getAttributeValue(Attributes attributes, String attributeName) throws NamingException {
        if (attributes == null) {
            return null;
        }
        Attribute attribute = attributes.get(attributeName);
        return attribute == null ? "" : (String) attribute.get();
    }
View Full Code Here

    if (item.isMap()) {
      AnyMap map = item.toMap();
      int modop = map.getLeft().toInt();
      Any right = map.getRight();
      if (right instanceof AnyAttribute) {
        Attribute attr = (Attribute)right.toObject();
        return new ModificationItem(modop, attr);
      }
    } else {
      if (item instanceof AnyAttribute) {
        Attribute attr = (Attribute)item.toObject();
        return new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr);
      }
    }
    return null;
  }
View Full Code Here


  public Any getReference(anvil.script.Context context, Any index)
  {
    try {
      Attribute attr = _attribute;
      int i = index.toInt();
      if (i>=0 && i<attr.size()) {
        return Any.create(attr.get(i));
      }
      return UNDEFINED;
    } catch (NamingException e) {
      throw context.exception(e);
    }
View Full Code Here

  }


  public boolean deleteReference(anvil.script.Context context, Any index)
  {
    Attribute attr = _attribute;
    int i = index.toInt();
    if (i>=0 && i<attr.size()) {
      attr.remove(i);
      return true;
    }
    return false;
  }
View Full Code Here

  }


  public Any setReference(anvil.script.Context context, Any index, Any value)
  {
    Attribute attr = _attribute;
    int i = index.toInt();
    if (i>=0 && i<attr.size()) {
      Any.create(attr.set(i, value.toObject()));
    }
    return value;
  }
View Full Code Here

    try {
      if (index_ == null) {
        return Any.create(_attribute.get());
       
      } else {
        Attribute attr = _attribute;
        int index = index_.toInt();
        if (index >= 0 && index < attr.size()) {
          return Any.create(attr.get(index));
        }
        return UNDEFINED;
      }
     
    } catch(NoSuchElementException e) {
View Full Code Here

TOP

Related Classes of javax.naming.directory.Attribute

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.