directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r178684 - in /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo: AbstractPOJO.java LdapPOJO.java
Date Thu, 26 May 2005 20:50:01 GMT
Author: elecharny
Date: Thu May 26 13:50:00 2005
New Revision: 178684

URL: http://svn.apache.org/viewcvs?rev=178684&view=rev
Log:
re-added. The svn eclipse plugin is still in beta test, it seems ...

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

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AbstractPOJO.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AbstractPOJO.java?rev=178684&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AbstractPOJO.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AbstractPOJO.java
Thu May 26 13:50:00 2005
@@ -0,0 +1,100 @@
+/*
+ *   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.ldap.codec.DecoderException;
+
+
+/**
+ * An abstract POJO that extend PoolObject.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractPOJO implements LdapPOJO
+{
+    //~ Instance fields ----------------------------------------------------------------------------
+
+    /** The object's current length. It is used while decoding PDUs */
+    private int currentLength;
+
+    /** The object's expected length. It is used while decoding PDUs */
+    private int expectedLength;
+
+    /** The encapsulating POJO */
+    protected AbstractPOJO father;
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Get the current object length, which is the sum of all inner length
+     * already decoded.
+     * 
+     * @return The current object's length
+     */
+    public int getCurrentLength()
+    {
+
+        return currentLength;
+    }
+
+    /**
+     * Get the expected object length.
+     * 
+     * @return The expected object's length
+     */
+    public int getExpectedLength()
+    {
+
+        return expectedLength;
+    }
+
+    /**
+     * Add a length to the object
+     * 
+     * @param length The length to add.
+     * @throws DecoderException Thrown if the current length exceed the expected length
+     */
+    public void addLength( int length ) throws DecoderException
+    {
+        this.currentLength += length;
+        
+        if (currentLength > expectedLength)
+        {
+        	throw new DecoderException("Current Length is above expected Length");
+        }
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param expectedLength The expectedLength to set.
+     */
+    public void setExpectedLength( int expectedLength )
+    {
+        this.expectedLength = expectedLength;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param currentLength The currentLength to set.
+     */
+    public void setCurrentLength( int currentLength )
+    {
+        this.currentLength = currentLength;
+    }
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapPOJO.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapPOJO.java?rev=178684&view=auto
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapPOJO.java
(added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapPOJO.java
Thu May 26 13:50:00 2005
@@ -0,0 +1,32 @@
+/*
+ *   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;
+
+/**
+ * LdapPojo interface
+ * 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface LdapPOJO
+{
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /** The method used to free the object */
+    public void free();
+
+}



Mime
View raw message