All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.vt.middleware.ldap.bean.UnorderedLdapBeanFactory Maven / Gradle / Ivy

There is a newer version: 3.3.9
Show newest version
/*
  $Id: UnorderedLdapBeanFactory.java 1330 2010-05-23 22:10:53Z dfisher $

  Copyright (C) 2003-2010 Virginia Tech.
  All rights reserved.

  SEE LICENSE FOR MORE INFORMATION

  Author:  Middleware Services
  Email:   [email protected]
  Version: $Revision: 1330 $
  Updated: $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
package edu.vt.middleware.ldap.bean;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

/**
 * UnorderedLdapBeanFactory provides an ldap bean factory that
 * produces unordered ldap beans.
 *
 * @author  Middleware Services
 * @version  $Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
 */
public class UnorderedLdapBeanFactory implements LdapBeanFactory
{


  /** {@inheritDoc} */
  public LdapResult newLdapResult()
  {
    return new UnorderedLdapResult();
  }


  /** {@inheritDoc} */
  public LdapEntry newLdapEntry()
  {
    return new UnorderedLdapEntry();
  }


  /** {@inheritDoc} */
  public LdapAttributes newLdapAttributes()
  {
    return new UnorderedLdapAttributes();
  }


  /** {@inheritDoc} */
  public LdapAttribute newLdapAttribute()
  {
    return new UnorderedLdapAttribute();
  }


  /**
   * UnorderedLdapResult represents a collection of ldap entries
   * that are unordered.
   */
  protected class UnorderedLdapResult
    extends AbstractLdapResult>
  {


    /** Default constructor. */
    public UnorderedLdapResult()
    {
      super(UnorderedLdapBeanFactory.this);
      this.entries = new HashMap();
    }
  }


  /** UnorderedLdapEntry represents a single ldap entry. */
  protected class UnorderedLdapEntry extends AbstractLdapEntry
  {


    /** Default constructor. */
    public UnorderedLdapEntry()
    {
      super(UnorderedLdapBeanFactory.this);
      this.ldapAttributes = new UnorderedLdapAttributes();
    }
  }


  /**
   * UnorderedLdapAttributes represents a collection of ldap
   * attribute that are unordered.
   */
  protected class UnorderedLdapAttributes
    extends AbstractLdapAttributes>
  {


    /** Default constructor. */
    public UnorderedLdapAttributes()
    {
      super(UnorderedLdapBeanFactory.this);
      this.attributes = new HashMap();
    }
  }


  /**
   * UnorderedLdapAttribute represents a single ldap attribute
   * whose values are unordered.
   */
  protected class UnorderedLdapAttribute
    extends AbstractLdapAttribute>
  {


    /** Default constructor. */
    public UnorderedLdapAttribute()
    {
      super(UnorderedLdapBeanFactory.this);
      this.values = new HashSet();
    }


    /** {@inheritDoc} */
    public Set getStringValues()
    {
      final Set s = new HashSet();
      this.convertValuesToString(s);
      return Collections.unmodifiableSet(s);
    }
  }
}