directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r208911 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java
Date Sun, 03 Jul 2005 12:32:00 GMT
Author: elecharny
Date: Sun Jul  3 05:31:59 2005
New Revision: 208911

URL: http://svn.apache.org/viewcvs?rev=208911&view=rev
Log:
Added the AddRequest pojo

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java?rev=208911&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AddRequest.java
Sun Jul  3 05:31:59 2005
@@ -0,0 +1,123 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.asn1.ldap.pojo;
+
+import org.apache.asn1.Asn1Object;
+import org.apache.asn1.ldap.codec.primitives.LdapDN;
+import org.apache.asn1.ldap.codec.primitives.LdapString;
+import org.apache.asn1.primitives.OctetString;
+
+import java.util.ArrayList;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
+
+
+/**
+ * An AddRequest Message. Its syntax is :
+ *   AddRequest ::= [APPLICATION 8] SEQUENCE {
+ *              entry           LDAPDN,
+ *              attributes      AttributeList }
+ *
+ *   AttributeList ::= SEQUENCE OF SEQUENCE {
+ *              type    AttributeDescription,
+ *              vals    SET OF AttributeValue }
+ * 
+ *   AttributeValue ::= OCTET STRING
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AddRequest extends Asn1Object
+{
+    //~ Instance fields ----------------------------------------------------------------------------
+
+    /** The DN to be modified. */
+    private LdapDN entry;
+
+    /** The attributes list. */
+    private ArrayList attributes;
+
+    /** The current attribute being decoded */
+    private Attribute currentAttribute;
+
+    //~ Constructors -------------------------------------------------------------------------------
+
+    /**
+     * Creates a new AddRequest object.
+     */
+    public AddRequest()
+    {
+        super( );
+    }
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Initialize the ArrayList for attributes.
+     */
+    public void initAttributes()
+    {
+        attributes = new ArrayList();
+    }
+
+    /**
+     * Get the entry's attributes to be added
+     *
+     * @return Returns the attributes.
+     */
+    public ArrayList getAttributes()
+    {
+        return attributes;
+    }
+
+    /**
+     * Create a new attributeValue
+     * @param type The attribute's name
+     */
+    public void addAttributeType( LdapString type )
+    {
+        currentAttribute = new BasicAttribute( type.toString() );
+        attributes.add( currentAttribute );
+    }
+
+    /**
+     * Add a new value to the current attribute
+     * @param value
+     */
+    public void addAttributeValue( OctetString value )
+    {
+        currentAttribute.add( value );
+    }
+
+    /**
+     * Get the added DN
+     * @return Returns the entry.
+     */
+    public String getEntry()
+    {
+        return ( ( entry == null ) ? "" : entry.toString() );
+    }
+
+    /**
+     * Set the added DN.
+     * @param entry The entry to set.
+     */
+    public void setEntry( LdapDN entry )
+    {
+        this.entry = entry;
+    }
+}



Mime
View raw message