directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
Subject svn commit: r349696 - in /directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs: ParameterPojo.java StoredProcedurePojo.java codec/StoredProcedureContainer.java codec/StoredProcedureGrammar.java
Date Tue, 29 Nov 2005 10:19:50 GMT
Author: ersiner
Date: Tue Nov 29 02:19:43 2005
New Revision: 349696

URL: http://svn.apache.org/viewcvs?rev=349696&view=rev
Log:
Refactored Emmanuel's StoredProcedure Bean and Codec to make them Java independend.
Needs lots of work still..

Modified:
    directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/ParameterPojo.java
    directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/StoredProcedurePojo.java
    directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureContainer.java
    directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureGrammar.java

Modified: directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/ParameterPojo.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/ParameterPojo.java?rev=349696&r1=349695&r2=349696&view=diff
==============================================================================
--- directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/ParameterPojo.java
(original)
+++ directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/ParameterPojo.java
Tue Nov 29 02:19:43 2005
@@ -1,21 +1,47 @@
+/*
+ *   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.ldap.server.storedprocs;
 
-public class ParameterPojo {
-	private String type;
-	
-	private byte[] value;
-	
-	public String getType() {
-		return type;
-	}
-	public void setType(String type) {
-		this.type = type;
-	}
-	public byte[] getValue() {
-		return value;
-	}
-	public void setValue(byte[] value) {
-		this.value = value;
-	}
-}
 
+public class ParameterPojo
+{
+    private byte[] type;
+
+    private byte[] value;
+
+    public byte[] getType()
+    {
+        return type;
+    }
+
+    public void setType( byte[] type )
+    {
+        this.type = type;
+    }
+
+    public byte[] getValue()
+    {
+        return value;
+    }
+
+    public void setValue( byte[] value )
+    {
+        this.value = value;
+    }
+}

Modified: directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/StoredProcedurePojo.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/StoredProcedurePojo.java?rev=349696&r1=349695&r2=349696&view=diff
==============================================================================
--- directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/StoredProcedurePojo.java
(original)
+++ directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/StoredProcedurePojo.java
Tue Nov 29 02:19:43 2005
@@ -1,41 +1,80 @@
+/*
+ *   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.ldap.server.storedprocs;
 
+
 import java.util.ArrayList;
 import java.util.List;
 
-public class StoredProcedurePojo {
-	private String procedure;
-	private ArrayList parameters;
-	private transient ParameterPojo currentParameter;
-	
-	public String getProcedure() {
-		return procedure;
-	}
-	
-	public void setProcedure(String procedure) {
-		this.procedure = procedure;
-	}
-	
-	public List getParameters() {
-		return parameters;
-	}
-	
-	public void addParameter( ParameterPojo parameter )
-	{
-		if ( parameters == null )
-		{
-			parameters = new ArrayList();
-		}
-		
-		parameters.add( parameter );
-	}
-
-	public ParameterPojo getCurrentParameter() {
-		return currentParameter;
-	}
-
-	public void setCurrentParameter(ParameterPojo currentParameter) {
-		this.currentParameter = currentParameter;
-	}
-}
 
+public class StoredProcedurePojo
+{
+    private byte[] language;
+
+    private byte[] procedure;
+
+    private ArrayList parameters;
+
+    private transient ParameterPojo currentParameter;
+
+    public byte[] getLanguage()
+    {
+        return language;
+    }
+
+    public void setLanguage( byte[] language )
+    {
+        this.language = language;
+    }
+
+    public byte[] getProcedure()
+    {
+        return procedure;
+    }
+
+    public void setProcedure( byte[] procedure )
+    {
+        this.procedure = procedure;
+    }
+
+    public List getParameters()
+    {
+        return parameters;
+    }
+
+    public void addParameter( ParameterPojo parameter )
+    {
+        if (parameters == null)
+        {
+            parameters = new ArrayList();
+        }
+
+        parameters.add( parameter );
+    }
+
+    public ParameterPojo getCurrentParameter()
+    {
+        return currentParameter;
+    }
+
+    public void setCurrentParameter( ParameterPojo currentParameter )
+    {
+        this.currentParameter = currentParameter;
+    }
+}

Modified: directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureContainer.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureContainer.java?rev=349696&r1=349695&r2=349696&view=diff
==============================================================================
--- directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureContainer.java
(original)
+++ directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureContainer.java
Tue Nov 29 02:19:43 2005
@@ -14,75 +14,78 @@
  *   limitations under the License.
  *
  */
+
+
 package org.apache.ldap.server.storedprocs.codec;
 
-import java.util.HashSet;
-import java.util.Set;
 
 import org.apache.asn1new.ber.AbstractContainer;
 import org.apache.asn1new.ber.containers.IAsn1Container;
 import org.apache.asn1new.ber.grammar.IGrammar;
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.server.storedprocs.StoredProcedurePojo;
 
 
 /**
- *  
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoredProcedureContainer extends AbstractContainer implements IAsn1Container
+public class StoredProcedureContainer extends AbstractContainer implements
+        IAsn1Container
 {
-    //~ Instance fields ----------------------------------------------------------------------------
+    // ~ Instance fields
+    // ----------------------------------------------------------------------------
 
     /** The pojo */
     private StoredProcedurePojo storedProcedurePojo;
-    
-    //~ Constructors -------------------------------------------------------------------------------
+
+    // ~ Constructors
+    // -------------------------------------------------------------------------------
 
     /**
      */
     public StoredProcedureContainer()
     {
-        super( );
+        super();
         currentGrammar = 0;
         grammars = new IGrammar[1];
         grammarStack = new IGrammar[1];
         stateStack = new int[1];
         nbGrammars = 0;
 
-        grammars[StoredProcedureEnum.STORED_PROCEDURE_GRAMMAR] = StoredProcedureGrammar.getInstance();

+        grammars[StoredProcedureEnum.STORED_PROCEDURE_GRAMMAR] = StoredProcedureGrammar
+                .getInstance();
 
         grammarStack[currentGrammar] = grammars[StoredProcedureEnum.STORED_PROCEDURE_GRAMMAR];
-        
+
         states = StoredProcedureEnum.getInstance();
     }
 
-    //~ Methods ------------------------------------------------------------------------------------
+    // ~ Methods
+    // ------------------------------------------------------------------------------------
     /**
      * @return Returns the ldapMessage.
      */
     public StoredProcedurePojo getStoredProcedurePojo()
     {
-
         return storedProcedurePojo;
     }
 
     /**
-     * Set a ldapMessage Object into the container. It will be completed
-     * by the ldapDecoder .
-     *
-     * @param ldapMessage The ldapMessage to set.
+     * Set a ldapMessage Object into the container. It will be completed by the
+     * ldapDecoder .
+     * 
+     * @param ldapMessage
+     *            The ldapMessage to set.
      */
     public void setStoredProcedurePojo( StoredProcedurePojo storedProcedurePojo )
     {
         this.storedProcedurePojo = storedProcedurePojo;
     }
-    
+
     public void clean()
     {
-    	super.clean();
-    	
-    	storedProcedurePojo = null;
+        super.clean();
+
+        storedProcedurePojo = null;
     }
 }
-

Modified: directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureGrammar.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureGrammar.java?rev=349696&r1=349695&r2=349696&view=diff
==============================================================================
--- directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureGrammar.java
(original)
+++ directory/sandbox/ersiner/apacheds-with-storedprocs/core/src/main/java/org/apache/ldap/server/storedprocs/codec/StoredProcedureGrammar.java
Tue Nov 29 02:19:43 2005
@@ -122,26 +122,32 @@
                         }
                         else
                         {
-                        	String language = StringUtils.toUtf8( tlv.getValue().getData() );
+                            byte[] language = tlv.getValue().getData();
                             
-                        	if ( "java".compareToIgnoreCase( language ) == 0 )
-                        	{
-                            	// We can create the object
-                        		storedProcedurePojo = new StoredProcedurePojo();
-                        	}
-                        	else
-                        	{
-                                log.error( "The language " + StringUtils.dumpBytes( tlv.getValue().getData()
) + " is invalid" );
-                                throw new DecoderException( "The language " + StringUtils.dumpBytes(
tlv.getValue().getData() ) + " is invalid" );
-                        	}
+                            storedProcedurePojo = new StoredProcedurePojo();
+                            
+                            storedProcedurePojo.setLanguage( language );
+//                        	
+//                          String language = StringUtils.toUtf8( tlv.getValue().getData()
);
+//                            
+//                        	if ( "java".compareToIgnoreCase( language ) == 0 )
+//                        	{
+//                            	// We can create the object
+//                        		storedProcedurePojo = new StoredProcedurePojo();
+//                        	}
+//                        	else
+//                        	{
+//                                log.error( "The language " + StringUtils.dumpBytes( tlv.getValue().getData()
) + " is invalid" );
+//                                throw new DecoderException( "The language " + StringUtils.dumpBytes(
tlv.getValue().getData() ) + " is invalid" );
+//                        	}
                         }
                         
                         storedProcedureContainer.setStoredProcedurePojo( storedProcedurePojo
);
 
-                        if ( log.isDebugEnabled() )
-                        {
-                            log.debug( "Language found : java " );
-                        }
+//                        if ( log.isDebugEnabled() )
+//                        {
+//                            log.debug( "Language found : java " );
+//                        }
                     }
                 } );
 
@@ -180,17 +186,19 @@
                         }
                         else
                         {
-                        	String procedure = StringUtils.toUtf8( tlv.getValue().getData()
);
+                        	byte[] procedure = tlv.getValue().getData();
+                            
+                            storedProcedurePojo.setProcedure( procedure );
                             
-                        	if ( procedure.trim().length() != 0 )
-                        	{
-                        		storedProcedurePojo.setProcedure( procedure );
-                        	}
-                        	else
-                        	{
-                                log.error( "The procedure is empty. This is not allowed."
);
-                                throw new DecoderException( "The procedure is empty. This
is not allowed." );
-                        	}
+//                        	if ( procedure.trim().length() != 0 )
+//                        	{
+//                        		storedProcedurePojo.setProcedure( procedure );
+//                        	}
+//                        	else
+//                        	{
+//                                log.error( "The procedure is empty. This is not allowed."
);
+//                                throw new DecoderException( "The procedure is empty. This
is not allowed." );
+//                        	}
                         }
 
                         if ( log.isDebugEnabled() )
@@ -252,26 +260,39 @@
 		                    }
 		                    else
 		                    {
-		                    	String parameterType = StringUtils.toUtf8( tlv.getValue().getData()
);
-		                        
-		                    	if ( parameterType.trim().length() != 0 )
-		                    	{
-		                    		ParameterPojo parameterPojo = new ParameterPojo();
-		                    		parameterPojo.setType( parameterType );
-		                    		
-		                    		// We stores the type in the current parameter.
-		                    		storedProcedurePojo.setCurrentParameter( parameterPojo );
-
-				                    if ( log.isDebugEnabled() )
-				                    {
-				                        log.debug( "Parameter type found : " + parameterType );
-				                    }
-		                    	}
-		                    	else
-		                    	{
-		                            log.error( "The parameter type is empty. This is not allowed."
);
-		                            throw new DecoderException( "The parameter type is empty. This
is not allowed." );
-		                    	}
+                                byte[] parameterType = tlv.getValue().getData();
+                                
+                                ParameterPojo parameterPojo = new ParameterPojo();
+                                parameterPojo.setType( parameterType );
+                              
+                                // We stores the type in the current parameter.
+                                storedProcedurePojo.setCurrentParameter( parameterPojo );
+                                
+                                if ( log.isDebugEnabled() )
+                                {
+                                   log.debug( "Parameter type found : " + StringUtils.dumpBytes(
parameterType ) );
+                                }
+                                
+//		                    	String parameterType = StringUtils.toUtf8( tlv.getValue().getData()
);
+//		                        
+//		                    	if ( parameterType.trim().length() != 0 )
+//		                    	{
+//		                    		ParameterPojo parameterPojo = new ParameterPojo();
+//		                    		parameterPojo.setType( parameterType );
+//		                    		
+//		                    		// We stores the type in the current parameter.
+//		                    		storedProcedurePojo.setCurrentParameter( parameterPojo );
+//
+//				                    if ( log.isDebugEnabled() )
+//				                    {
+//				                        log.debug( "Parameter type found : " + parameterType );
+//				                    }
+//		                    	}
+//		                    	else
+//		                    	{
+//		                            log.error( "The parameter type is empty. This is not allowed."
);
+//		                            throw new DecoderException( "The parameter type is empty.
This is not allowed." );
+//		                    	}
 		                    }
 		                }
                     } );



Mime
View raw message