Examples of Attributes


Examples of javax.naming.directory.Attributes

     
      Attribute currMembers = fetchMembers(ctx);
      String failer = containsName(ctx, currMembers, dn);
      if (failer == null) {
        currMembers.add(dn);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
       
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
        return true;
      }
 
View Full Code Here

Examples of javax.naming.directory.Attributes

 
      Attribute currMembers = fetchMembers(ctx);
      String result = containsName(ctx, currMembers, dn);
      if (result != null) {
        currMembers.remove(result);
        Attributes attrs = new BasicAttributes();
        attrs.put(currMembers);
     
        ctx.modifyAttributes(this.dn, DirContext.REPLACE_ATTRIBUTE, attrs);
       
        return true;
      }
View Full Code Here

Examples of javax.naming.directory.Attributes

  }
 
 
  private Attribute fetchMembers(DirContext ctx, String fetchDN) throws NamingException
  {
    Attributes attrs = ctx.getAttributes(fetchDN, new String[] { "uniquemember" });
    Attribute members = attrs.get("uniquemember");
    return (members == null)? new BasicAttribute("uniquemember") : members;
  }
View Full Code Here

Examples of javax.naming.directory.Attributes

    Node requestNode = null;
    String requestString = null;
    RequestContainer request = null;
    NodeList children = null;
    Node child = null;
    Attributes attrs;

    for (int i = 0; i < nodes.getLength(); i++)
    {
      requestNode = nodes.item(i);
      if (requestNode.getNodeType() == Element.ELEMENT_NODE)
      {
        if (requestNode.getNodeName().equals(SEARCH_STRING))
        {
          requestString = XMLHelper.getNodeText(requestNode);
          if (requestString == null)
          {
            throw new XException(Constants.LOCATION_EXTERN,
                Constants.LAYER_TECHNICAL,
                Constants.PACKAGE_TECHNICAL_LDAP, "1");
          }
          else
          {
            request = new RequestContainer(SEARCH_STRING,
                getContext(requestNode), requestString);
            retVector.add(request);
          }
        }
        else if (requestNode.getNodeName().equals(SEARCH_ATTRIBUTES))
        {
          children = requestNode.getChildNodes();
          attrs = new BasicAttributes();
          for (int j = 0; j < children.getLength(); j++)
          {
            child = children.item(j);
            if (child.getNodeType() == Element.ELEMENT_NODE)
            {
              String attributeName = child.getNodeName();
              String attributeValue = XMLHelper
                  .getNodeText(child);
              attrs.put(attributeName, attributeValue);
            }
          }
          request = new RequestContainer(SEARCH_ATTRIBUTES,
              getContext(requestNode), attrs);
          retVector.add(request);
View Full Code Here

Examples of javax.naming.directory.Attributes

      ldapResult = executeLdap(binding, context);

      while (ldapResult.hasMore())
      {
        SearchResult sr = ldapResult.next();
        Attributes sra = sr.getAttributes();
       
        Map<String, Node> aBinding = new HashMap<String, Node>();

        // Mapping results to rdf
        if (subject.isVariable())
          aBinding.put(subject.getName(), createLdapNode(sr
              .getNameInNamespace()));

        boolean valid = true;

        for (Triple triple : query)
        {
          if (!triple.getObject().isVariable())
            continue;

          String attribute = predToAttribute(triple.getPredicate());

          if (sra.get(attribute) == null) // no value -- not a hit
          {
            log.debug("Attribute not found");
            valid = false;
            break;
          }
         
          // FIXME I get the first value, but there may be more. tricky.
          // TODO If pred is type unmap value to node (often multiple vals, btw)
          Object val = sra.get(attribute).get();
          String var = triple.getObject().getName();

          // I don't think this does anything useful, since we prebind
          if (aBinding.containsKey(var)) // if we have a binding for
          // this
View Full Code Here

Examples of javax.naming.directory.Attributes

   
    NamingEnumeration<SearchResult> results = null;
   
    if ("".equals(queryString)) // We aren't searching, just get attributes
    {
      Attributes attrs = context.getAttributes(baseURI, (String[]) toGet
          .toArray(new String[] {}));
      // Wrap this to fit this method's contract
      SearchResult sr = new SearchResult(null, null, attrs);
      sr.setNameInNamespace(uriToName(baseURI));
      results = new SingletonNamingEnumeration<SearchResult>(sr);
View Full Code Here

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

Examples of javax.naming.directory.Attributes

    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

Examples of javax.util.jcache.Attributes

        return getTrueObject(objHandle, arguments);
    }

    private Object getTrueObject(final CacheObject objHandle, final Object arguments) {
        if (objHandle.needsLoading(arguments)) {
            Attributes attribs = objHandle.getAttributes();
            CacheLoader loader = attribs.getLoader();
            Object retrievedObject;
            try {
                retrievedObject = loader.load(objHandle, arguments);
                if (retrievedObject == null) {
                    throw new ObjectNotFoundException("The returned object from the CacheLoader " + loader.getClass().getName() + " was null.");
                }
                if (retrievedObject instanceof CacheOutputStream) {
                    /*
                     * a CacheLoader has created an OutputStream, and loaded the
                     * object. Get the owner object for the stream, and return
                     * the corresponding InputStream. The StreamObjects are
                     * created in the CacheLoader, but the regular memory
                     * objects are created below, is this correct? And a double
                     * creation is also done... once before the load, and once
                     * further down, but this is not called as we have multiple
                     * return points in this method.... well, if it works, dont
                     * touch it! Refactor when we are moving towards a
                     * production release.
                     * 
                     */
                    return ((CacheOutputStream) retrievedObject).getStreamObject().getInputStream();
                } else if (retrievedObject instanceof File) {
                    /*
                     * The object was a DiskObject, return the path to the
                     * diskfile.
                     */
                    return ((File) retrievedObject).getAbsolutePath();
                }
                attribs.setCreateTime(System.currentTimeMillis());
            } catch (CacheException e) {
                this.lastException  = e.getClass();
                this.lastMessage = e.getMessage();
                return null;
            }
View Full Code Here

Examples of javax.util.jcache.Attributes

     */
    public void resetAttributes(Attributes attributes) {
        if (!isValid()) {
            return;
        }
        Attributes att = region.getAttributes();
        att.reset();
        att.applyAttributes(attributes);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.