directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r439770 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Date Sun, 03 Sep 2006 12:46:30 GMT
Author: elecharny
Date: Sun Sep  3 05:46:30 2006
New Revision: 439770

URL: http://svn.apache.org/viewvc?rev=439770&view=rev
Log:
Added a skeleton of LdapDN message. This is for compilation purpose.

Added:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java

Added: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=439770&view=auto
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
(added)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Sun Sep  3 05:46:30 2006
@@ -0,0 +1,295 @@
+
+package org.apache.directory.shared.ldap.name;
+
+import java.util.Enumeration;
+
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LdapDN implements Name
+{
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
+    private static final long serialVersionUID = 2L;
+    
+    /** The LoggerFactory used by this class */
+    private static Logger log = LoggerFactory.getLogger( LdapDN.class );
+
+    /**
+     * Determines whether this name is empty. An empty name is one with zero
+     * components.
+     *
+     * @return true if this name is empty, false otherwise
+     */
+    public boolean isEmpty()
+    {
+        return true;
+    }
+
+    /**
+     * Determines whether this name starts with a specified prefix. A name
+     * <tt>name</tt> is a prefix if it is equal to
+     * <tt>getPrefix(name.size())</tt>.
+     *
+     * Be aware that for a specific DN like :
+     * cn=xxx, ou=yyy
+     * the startsWith method will return true with ou=yyy, and
+     * false with cn=xxx
+     *
+     * @param name the name to check
+     * @return true if <tt>name</tt> is a prefix of this name, false otherwise
+     */
+    public boolean startsWith( Name name )
+    {
+        return true;
+    }
+
+    /**
+     * Determines whether this name ends with a specified suffix. A name
+     * <tt>name</tt> is a suffix if it is equal to
+     * <tt>getSuffix(size()-name.size())</tt>.
+     *
+     * Be aware that for a specific
+     * DN like : cn=xxx, ou=yyy the endsWith method will return true with
+     * cn=xxx, and false with ou=yyy
+     *
+     * @param name
+     *            the name to check
+     * @return true if <tt>name</tt> is a suffix of this name, false otherwise
+     */
+    public boolean endsWith( Name name )
+    {
+        return true;
+    }
+
+    /**
+     * Adds a single component to the end of this name.
+     *
+     * @param comp
+     *            the component to add
+     * @return the updated name (not a new one)
+     * @throws InvalidNameException
+     *             if adding <tt>comp</tt> would violate the syntax rules of
+     *             this name
+     */
+    public Name add( String comp ) throws InvalidNameException
+    {
+        return this;
+    }
+    
+    /**
+     * Adds a single component at a specified position within this name.
+     * Components of this name at or after the index of the new component are
+     * shifted up by one (away from index 0) to accommodate the new component.
+     *
+     * @param comp
+     *            the component to add
+     * @param posn
+     *            the index at which to add the new component. Must be in the
+     *            range [0,size()].
+     * @return the updated name (not a new one)
+     * @throws ArrayIndexOutOfBoundsException
+     *             if posn is outside the specified range
+     * @throws InvalidNameException
+     *             if adding <tt>comp</tt> would violate the syntax rules of
+     *             this name
+     */
+    public Name add( int posn, String comp ) throws InvalidNameException
+    {
+        return this;
+    }
+
+    /**
+     * Adds the components of a name -- in order -- to the end of this name.
+     *
+     * @param suffix
+     *            the components to add
+     * @return the updated name (not a new one)
+     * @throws InvalidNameException
+     *             if <tt>suffix</tt> is not a valid name, or if the addition
+     *             of the components would violate the syntax rules of this name
+     */
+    public Name addAll( Name suffix ) throws InvalidNameException
+    {
+        return this;
+    }
+
+    /**
+     * Adds the components of a name -- in order -- at a specified position
+     * within this name. Components of this name at or after the index of the
+     * first new component are shifted up (away from 0) to accommodate the new
+     * components.
+     *
+     * @param name
+     *            the components to add
+     * @param posn
+     *            the index in this name at which to add the new components.
+     *            Must be in the range [0,size()].
+     * @return the updated name (not a new one)
+     * @throws ArrayIndexOutOfBoundsException
+     *             if posn is outside the specified range
+     * @throws InvalidNameException
+     *             if <tt>n</tt> is not a valid name, or if the addition of
+     *             the components would violate the syntax rules of this name
+     */
+    public Name addAll( int posn, Name name ) throws InvalidNameException
+    {
+        return this;
+    }
+    
+    /**
+     * Retrieves the components of this name as an enumeration of strings. The
+     * effect on the enumeration of updates to this name is undefined. If the
+     * name has zero components, an empty (non-null) enumeration is returned.
+     *
+     * @return an enumeration of the components of this name, each as string
+     */
+    public Enumeration<String> getAll()
+    {
+        /*
+         * Note that by accessing the name component using the get() method on
+         * the name rather than get() on the list we are reading components from
+         * right to left with increasing index values. LdapName.get() does the
+         * index translation on m_list for us.
+         */
+        return new Enumeration<String>()
+        {
+            public boolean hasMoreElements()
+            {
+                return true;
+            }
+
+
+            public String nextElement()
+            {
+                return "";
+            }
+        };
+    }
+    
+    /**
+     * Retrieves a component of this name.
+     *
+     * @param posn
+     *            the 0-based index of the component to retrieve. Must be in the
+     *            range [0,size()).
+     * @return the component at index posn
+     * @throws ArrayIndexOutOfBoundsException
+     *             if posn is outside the specified range
+     */
+    public String get( int posn )
+    {
+        return "";
+    }
+    
+    /**
+     * Removes a component from this name. The component of this name at the
+     * specified position is removed. Components with indexes greater than this
+     * position are shifted down (toward index 0) by one.
+     *
+     * @param posn
+     *            the index of the component to remove. Must be in the range
+     *            [0,size()).
+     * @return the component removed (a String)
+     * @throws ArrayIndexOutOfBoundsException
+     *             if posn is outside the specified range
+     * @throws InvalidNameException
+     *             if deleting the component would violate the syntax rules of
+     *             the name
+     */
+    public Object remove( int posn ) throws InvalidNameException
+    {
+        return this;
+    }
+    
+    /**
+     * Creates a name whose components consist of a prefix of the components of
+     * this name. Subsequent changes to this name will not affect the name that
+     * is returned and vice versa.
+     *
+     * @param posn the 0-based index of the component at which to stop. Must be
+     *            in the range [0,size()].
+     * @return a name consisting of the components at indexes in the range
+     *         [0,posn].
+     * @throws ArrayIndexOutOfBoundsException if posn is outside the specified range
+     */
+    public Name getPrefix( int posn )
+    {
+        return this;
+    }
+    
+    /**
+     * Creates a name whose components consist of a suffix of the components in
+     * this name. Subsequent changes to this name do not affect the name that is
+     * returned and vice versa.
+     *
+     * @param posn
+     *            the 0-based index of the component at which to start. Must be
+     *            in the range [0,size()].
+     * @return a name consisting of the components at indexes in the range
+     *         [posn,size()]. If posn is equal to size(), an empty name is
+     *         returned.
+     * @throws ArrayIndexOutOfBoundsException
+     *             if posn is outside the specified range
+     */
+    public Name getSuffix( int posn )
+    {
+        return this;
+    }
+    
+    /**
+     * Get the number of NameComponent contained in this LdapDN
+     *
+     * @return The number of NameComponent contained in this LdapDN
+     */
+    public int size()
+    {
+        return 0;
+    }
+
+    /**
+     * Generates a new copy of this name. Subsequent changes to the components
+     * of this name will not affect the new copy, and vice versa.
+     *
+     * @return a copy of this name
+     * @see Object#clone()
+     */
+    public Object clone()
+    {
+        return this;
+    }
+
+    /**
+     * Compares this name with another name for order. Returns a negative
+     * integer, zero, or a positive integer as this name is less than, equal to,
+     * or greater than the given name.
+     * <p>
+     * As with <tt>Object.equals()</tt>, the notion of ordering for names
+     * depends on the class that implements this interface. For example, the
+     * ordering may be based on lexicographical ordering of the name components.
+     * Specific attributes of the name, such as how it treats case, may affect
+     * the ordering. In general, two names of different classes may not be
+     * compared.
+     *
+     * @param obj
+     *            the non-null object to compare against.
+     * @return a negative integer, zero, or a positive integer as this name is
+     *         less than, equal to, or greater than the given name
+     * @throws ClassCastException
+     *             if obj is not a <tt>Name</tt> of a type that may be
+     *             compared with this name
+     * @see Comparable#compareTo(Object)
+     */
+    public int compareTo( Object obj )
+    {
+        return 0;
+    }
+}



Mime
View raw message