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

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

There is a newer version: 3.3.9
Show newest version
/*
  $Id: OrderedLdapBeanFactory.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.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Set;

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


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


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


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


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


  /**
   * OrderedLdapResult represents a collection of ldap entries that
   * are ordered by insertion.
   */
  protected class OrderedLdapResult
    extends AbstractLdapResult>
  {


    /** Default constructor. */
    public OrderedLdapResult()
    {
      super(OrderedLdapBeanFactory.this);
      this.entries = new LinkedHashMap();
    }
  }


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


    /** Default constructor. */
    public OrderedLdapEntry()
    {
      super(OrderedLdapBeanFactory.this);
      this.ldapAttributes = new OrderedLdapAttributes();
    }
  }


  /**
   * OrderedLdapAttributes represents a collection of ldap
   * attribute that are ordered by insertion.
   */
  protected class OrderedLdapAttributes
    extends AbstractLdapAttributes>
  {


    /** Default constructor. */
    public OrderedLdapAttributes()
    {
      super(OrderedLdapBeanFactory.this);
      this.attributes = new LinkedHashMap();
    }
  }


  /**
   * OrderedLdapAttribute represents a single ldap attribute whose
   * values are ordered by insertion.
   */
  protected class OrderedLdapAttribute
    extends AbstractLdapAttribute>
  {


    /** Default constructor. */
    public OrderedLdapAttribute()
    {
      super(OrderedLdapBeanFactory.this);
      this.values = new LinkedHashSet();
    }


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