directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1074549 - in /directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended: ./ ads_impl/
Date Fri, 25 Feb 2011 14:53:40 GMT
Author: akarasulu
Date: Fri Feb 25 14:53:40 2011
New Revision: 1074549

URL: http://svn.apache.org/viewvc?rev=1074549&view=rev
Log:
breaking out the parameter bean from the implementation classes

Added:
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureParameter.java
Modified:
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureRequestImpl.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedure.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureGrammar.java

Added: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureParameter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureParameter.java?rev=1074549&view=auto
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureParameter.java
(added)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureParameter.java
Fri Feb 25 14:53:40 2011
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.shared.ldap.extras.extended;
+
+
+import org.apache.directory.shared.util.Strings;
+
+
+/**
+ * Bean for representing a Stored Procedure Parameter
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StoredProcedureParameter
+{
+    /** the type of the parameter */
+    private byte[] type;
+    /** the value of the parameter */
+    private byte[] value;
+
+
+    /**
+     * Gets the type as a UTF8 String.
+     *
+     * @return The type as a UTF8 String.
+     */
+    public String getTypeString()
+    {
+        return Strings.utf8ToString( type );
+    }
+    
+    
+    /**
+     * Gets the value as a UTF8 String.
+     *
+     * @return The value as a UTF8 String.
+     */
+    public String getValueString()
+    {
+        return Strings.utf8ToString( value );
+    }
+    
+    
+    /**
+     * Gets the type as a byte[].
+     *
+     * @return The type as a byte[].
+     */
+    public byte[] getType()
+    {
+        if ( type == null )
+        {
+            return null;
+        }
+
+        final byte[] copy = new byte[ type.length ];
+        System.arraycopy( type, 0, copy, 0, type.length );
+        return copy;
+    }
+
+
+    /**
+     * Sets the type.
+     * 
+     * @param type The type as a byte[].
+     */
+    public void setType( byte[] type )
+    {
+        if ( type != null )
+        {
+            this.type = new byte[ type.length ];
+            System.arraycopy( type, 0, this.type, 0, type.length );
+        } 
+        else 
+        {
+            this.type = null;
+        }
+    }
+
+
+    /**
+     * Gets the value as a byte[].
+     *
+     * @return The value as a byte[].
+     */
+    public byte[] getValue()
+    {
+        if ( value == null )
+        {
+            return null;
+        }
+
+        final byte[] copy = new byte[ value.length ];
+        System.arraycopy( value, 0, copy, 0, value.length );
+        return copy;
+    }
+
+
+    /**
+     * Sets the value.
+     * 
+     * @param value The value as a byte[].
+     */
+    public void setValue( byte[] value )
+    {
+        if ( value != null )
+        {
+            this.value = new byte[ value.length ];
+            System.arraycopy( value, 0, this.value, 0, value.length );
+        } 
+        else 
+        {
+            this.value = null;
+        }
+    }
+}
\ No newline at end of file

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureRequestImpl.java?rev=1074549&r1=1074548&r2=1074549&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureRequestImpl.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/StoredProcedureRequestImpl.java
Fri Feb 25 14:53:40 2011
@@ -29,7 +29,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.message.AbstractExtendedRequest;
 import org.apache.directory.shared.util.exception.NotImplementedException;
-import org.apache.directory.shared.ldap.extras.extended.ads_impl.StoredProcedure.StoredProcedureParameter;
 import org.apache.directory.shared.util.StringConstants;
 import org.apache.directory.shared.util.Strings;
 

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedure.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedure.java?rev=1074549&r1=1074548&r2=1074549&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedure.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedure.java
Fri Feb 25 14:53:40 2011
@@ -31,6 +31,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.extras.extended.StoredProcedureParameter;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureRequestImpl;
 import org.apache.directory.shared.util.Strings;
 
@@ -89,83 +90,6 @@ public class StoredProcedure extends Abs
     
 
     /**
-     * Bean for representing a Stored Procedure Parameter
-     */
-    public static class StoredProcedureParameter
-    {
-        byte[] type;
-
-        byte[] value;
-
-
-        public String getTypeString()
-        {
-            return Strings.utf8ToString( type );
-        }
-        
-        
-        public String getValueString()
-        {
-            return Strings.utf8ToString( value );
-        }
-        
-        
-        public byte[] getType()
-        {
-            if ( type == null )
-            {
-                return null;
-            }
-
-            final byte[] copy = new byte[ type.length ];
-            System.arraycopy( type, 0, copy, 0, type.length );
-            return copy;
-        }
-
-
-        public void setType( byte[] type )
-        {
-            if ( type != null )
-            {
-                this.type = new byte[ type.length ];
-                System.arraycopy( type, 0, this.type, 0, type.length );
-            } 
-            else 
-            {
-                this.type = null;
-            }
-        }
-
-
-        public byte[] getValue()
-        {
-            if ( value == null )
-            {
-                return null;
-            }
-
-            final byte[] copy = new byte[ value.length ];
-            System.arraycopy( value, 0, copy, 0, value.length );
-            return copy;
-        }
-
-
-        public void setValue( byte[] value )
-        {
-            if ( value != null )
-            {
-                this.value = new byte[ value.length ];
-                System.arraycopy( value, 0, this.value, 0, value.length );
-            } 
-            else 
-            {
-                this.value = null;
-            }
-        }
-    }
-
-    
-    /**
      * Compute the StoredProcedure length 
      * 
      * 0x30 L1 
@@ -218,8 +142,8 @@ public class StoredProcedure extends Abs
                 int localParamTypeLength = 0;
                 int localParamValueLength = 0;
                 
-                localParamTypeLength = 1 + TLV.getNbBytes( spParam.type.length ) + spParam.type.length;
-                localParamValueLength = 1 + TLV.getNbBytes( spParam.value.length ) + spParam.value.length;
+                localParamTypeLength = 1 + TLV.getNbBytes( spParam.getType().length ) + spParam.getType().length;
+                localParamValueLength = 1 + TLV.getNbBytes( spParam.getValue().length ) +
spParam.getValue().length;
                 
                 localParameterLength = localParamTypeLength + localParamValueLength;
                 
@@ -276,10 +200,10 @@ public class StoredProcedure extends Abs
                     bb.put( TLV.getBytes( localParameterLength ) );
 
                     // The parameter type
-                    Value.encode( bb, spParam.type );
+                    Value.encode( bb, spParam.getType() );
 
                     // The parameter value
-                    Value.encode( bb, spParam.value );
+                    Value.encode( bb, spParam.getValue() );
 
                     // Go to the next parameter;
                     parameterNumber++;
@@ -322,9 +246,9 @@ public class StoredProcedure extends Abs
             for ( StoredProcedureParameter spParam : request.getParameters() )
             {
                 sb.append( "            type[" ).append( i ) .append( "] : '" ).
-                    append( Strings.utf8ToString(spParam.type) ).append( "'\n" );
+                    append( Strings.utf8ToString(spParam.getType()) ).append( "'\n" );
                 sb.append( "            value[" ).append( i ) .append( "] : '" ).
-                    append( Strings.dumpBytes(spParam.value) ).append( "'\n" );
+                    append( Strings.dumpBytes(spParam.getValue()) ).append( "'\n" );
             }
         }
 

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureGrammar.java?rev=1074549&r1=1074548&r2=1074549&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureGrammar.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureGrammar.java
Fri Feb 25 14:53:40 2011
@@ -28,7 +28,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.extras.extended.ads_impl.StoredProcedure.StoredProcedureParameter;
+import org.apache.directory.shared.ldap.extras.extended.StoredProcedureParameter;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;



Mime
View raw message