directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068126 - in /directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1: actions/ ber/grammar/
Date Mon, 07 Feb 2011 20:51:43 GMT
Author: elecharny
Date: Mon Feb  7 20:51:43 2011
New Revision: 1068126

URL: http://svn.apache.org/viewvc?rev=1068126&view=rev
Log:
Fixing some more warnings

Modified:
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
    directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
Mon Feb  7 20:51:43 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.actions;
 
@@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used read a BITSTRING from a TLV
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractReadBitString extends GrammarAction<Asn1Container>
+public abstract class AbstractReadBitString<E extends Asn1Container> extends GrammarAction<E>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractReadBitString.class
);
@@ -55,18 +55,18 @@ public abstract class AbstractReadBitStr
 
     /**
      * gives a byte array to be set to the appropriate field of the ASN.1 object
-     * present in the container 
+     * present in the container
      *
      * @param data the data of the read TLV present in byte array format
      * @param container the container holding the ASN.1 object
      */
-    protected abstract void setBitString( byte[] data, Asn1Container container );
+    protected abstract void setBitString( byte[] data, E container );
 
 
     /**
      * {@inheritDoc}
      */
-    public final void action( Asn1Container container ) throws DecoderException
+    public final void action( E container ) throws DecoderException
     {
         TLV tlv = container.getCurrentTLV();
 

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
Mon Feb  7 20:51:43 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.actions;
 
@@ -23,10 +23,10 @@ package org.apache.directory.shared.asn1
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
 import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
@@ -35,10 +35,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to read an integer value
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractReadInteger extends GrammarAction<Asn1Container>
+public abstract class AbstractReadInteger<E extends Asn1Container> extends GrammarAction<E>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractReadInteger.class
);
@@ -63,7 +63,7 @@ public abstract class AbstractReadIntege
 
 
     /**
-     * 
+     *
      * Creates a new instance of AbstractReadInteger.
      *
      * @param name the action's name
@@ -80,19 +80,19 @@ public abstract class AbstractReadIntege
 
 
     /**
-     * 
+     *
      * set the integer value to the appropriate field of ASN.1 object present in the container
-     * 
+     *
      * @param value the integer value
      * @param container the ASN.1 object's container
      */
-    protected abstract void setIntegerValue( int value, Asn1Container container );
+    protected abstract void setIntegerValue( int value, E container );
 
 
     /**
      * {@inheritDoc}
      */
-    public final void action( Asn1Container container ) throws DecoderException
+    public final void action( E container ) throws DecoderException
     {
         TLV tlv = container.getCurrentTLV();
 
@@ -104,9 +104,9 @@ public abstract class AbstractReadIntege
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         Value value = tlv.getValue();
-        
+
         try
         {
             int number = IntegerDecoder.parse( value, minValue, maxValue );
@@ -115,7 +115,7 @@ public abstract class AbstractReadIntege
             {
                 LOG.debug( "read integer value : {}", number );
             }
-            
+
             setIntegerValue( number, container );
         }
         catch ( IntegerDecoderException ide )

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
Mon Feb  7 20:51:43 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.actions;
 
@@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to read an OCTET STRING value
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractReadOctetString extends GrammarAction<Asn1Container>
+public abstract class AbstractReadOctetString<E extends Asn1Container> extends GrammarAction<E>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractReadOctetString.class
);
@@ -55,32 +55,32 @@ public abstract class AbstractReadOctetS
 
     /**
      * Instantiates a new AbstractReadInteger action.
-     * 
+     *
      * @param name The log message
      * @param canBeNull Tells if the byte array can be null or not
      */
     public AbstractReadOctetString( String name, boolean canBeNull )
     {
         super( name );
-        
+
         this.canBeNull = canBeNull;
     }
 
 
     /**
-     * 
+     *
      * set the OCTET STRING value to the appropriate field of ASN.1 object present in the
container
-     * 
+     *
      * @param value the OCTET STRING value
      * @param container the ASN.1 object's container
      */
-    protected abstract void setOctetString( byte[] value, Asn1Container container );
+    protected abstract void setOctetString( byte[] value, E container );
 
 
     /**
      * {@inheritDoc}
      */
-    public final void action( Asn1Container container ) throws DecoderException
+    public final void action( E container ) throws DecoderException
     {
         TLV tlv = container.getCurrentTLV();
 
@@ -92,9 +92,9 @@ public abstract class AbstractReadOctetS
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         Value value = tlv.getValue();
-        
+
         // The data should not be null
         if ( ( value.getData() == null ) && ( !canBeNull ) )
         {
@@ -103,7 +103,7 @@ public abstract class AbstractReadOctetS
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         setOctetString( value.getData(), container );
     }
 }

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
Mon Feb  7 20:51:43 2011
@@ -6,24 +6,24 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.actions;
 
 
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,10 +31,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * An action that checks the length is not null
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CheckNotNullLength extends GrammarAction<Asn1Container>
+public class CheckNotNullLength<E extends Asn1Container> extends GrammarAction<E>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( CheckNotNullLength.class );
@@ -51,7 +51,7 @@ public class CheckNotNullLength extends 
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( E container ) throws DecoderException
     {
         TLV tlv = container.getCurrentTLV();
 

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
Mon Feb  7 20:51:43 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.ber.grammar;
 
@@ -31,10 +31,10 @@ import org.slf4j.LoggerFactory;
 /**
  * The abstract Grammar which is the Mother of all the grammars. It contains
  * the transitions table.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractGrammar implements Grammar
+public abstract class AbstractGrammar<E extends Asn1Container> implements Grammar<E>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractGrammar.class );
@@ -47,7 +47,7 @@ public abstract class AbstractGrammar im
      * indice the states, the second dimension indices the Tag value, so it is
      * 256 wide.
      */
-    protected GrammarTransition<Asn1Container>[][] transitions;
+    protected GrammarTransition<E>[][] transitions;
 
     /** The grammar name */
     private String name;
@@ -60,7 +60,7 @@ public abstract class AbstractGrammar im
 
     /**
      * Return the grammar's name
-     * 
+     *
      * @return The grammar name
      */
     public String getName()
@@ -71,7 +71,7 @@ public abstract class AbstractGrammar im
 
     /**
      * Set the grammar's name
-     * 
+     *
      * @param name The new grammar name
      */
     public void setName( String name )
@@ -82,12 +82,12 @@ public abstract class AbstractGrammar im
 
     /**
      * Get the transition associated with the state and tag
-     * 
+     *
      * @param state The current state
      * @param tag The current tag
      * @return A valid transition if any, or null.
      */
-    public GrammarTransition<Asn1Container> getTransition( Enum<?> state, int
tag )
+    public GrammarTransition<E> getTransition( Enum<?> state, int tag )
     {
         return transitions[state.ordinal()][tag & 0x00FF];
     }
@@ -96,11 +96,11 @@ public abstract class AbstractGrammar im
     /**
      * The main function. This is where an action is executed. If the action is
      * null, nothing is done.
-     * 
+     *
      * @param container The Asn1Container
      * @throws DecoderException Thrown if anything went wrong
      */
-    public void executeAction( Asn1Container container ) throws DecoderException
+    public void executeAction( E container ) throws DecoderException
     {
 
         Enum<?> currentState = container.getTransition();
@@ -113,7 +113,7 @@ public abstract class AbstractGrammar im
         byte tagByte = container.getCurrentTLV().getTag();
 
         // We will loop until no more actions are to be executed
-        GrammarTransition<Asn1Container> transition = ( ( AbstractGrammar ) container.getGrammar()
).getTransition( currentState,
+        GrammarTransition<E> transition = ( ( AbstractGrammar<E> ) container.getGrammar()
).getTransition( currentState,
             tagByte );
 
         if ( transition == null )
@@ -134,7 +134,7 @@ public abstract class AbstractGrammar im
 
         if ( transition.hasAction() )
         {
-            Action<Asn1Container> action = transition.getAction();
+            Action<E> action = transition.getAction();
             action.action( container );
         }
 

Modified: directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java?rev=1068126&r1=1068125&r2=1068126&view=diff
==============================================================================
--- directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
(original)
+++ directory/shared/branches/m1/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
Mon Feb  7 20:51:43 2011
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.asn1.ber.grammar;
 
@@ -26,24 +26,24 @@ import org.apache.directory.shared.asn1.
 
 /**
  * The interface which expose common behavior of a Grammar implementer.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface Grammar
+public interface Grammar<E extends Asn1Container>
 {
     /**
      * This method, when called, execute an action on the current data stored in
      * the container.
-     * 
+     *
      * @param asn1Container Store the data being processed.
      * @throws DecoderException Thrown when an unrecoverable error occurs.
      */
-    void executeAction( Asn1Container asn1Container ) throws DecoderException;
+    void executeAction( E asn1Container ) throws DecoderException;
 
 
     /**
      * Get the grammar name
-     * 
+     *
      * @return Return the grammar's name
      */
     String getName();
@@ -51,7 +51,7 @@ public interface Grammar
 
     /**
      * Set the grammar's name
-     * 
+     *
      * @param name The grammar name
      */
     void setName( String name );



Mime
View raw message