From commits-return-18540-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sat Jun 07 06:28:54 2008 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 4645 invoked from network); 7 Jun 2008 06:28:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jun 2008 06:28:54 -0000 Received: (qmail 38037 invoked by uid 500); 7 Jun 2008 06:28:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 37984 invoked by uid 500); 7 Jun 2008 06:28:57 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 37975 invoked by uid 99); 7 Jun 2008 06:28:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 23:28:57 -0700 X-ASF-Spam-Status: No, hits=-1996.2 required=10.0 tests=ALL_TRUSTED,FRT_GUARANTEE1,FUZZY_GUARANTEE X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jun 2008 06:28:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A3BA62388A06; Fri, 6 Jun 2008 23:28:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r664290 [2/13] - in /directory/shared/branches/bigbang: ./ asn1/src/main/java/org/apache/directory/shared/asn1/ asn1/src/main/java/org/apache/directory/shared/asn1/ber/ asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/ asn1/s... Date: Sat, 07 Jun 2008 06:28:15 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080607062831.A3BA62388A06@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderCallback.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderCallback.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderCallback.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderCallback.java Fri Jun 6 23:28:06 2008 @@ -24,7 +24,7 @@ * Document me. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$, $Date$ */ public interface EncoderCallback { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitor.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitor.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitor.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitor.java Fri Jun 6 23:28:06 2008 @@ -24,12 +24,12 @@ * Document me. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$, $Date$ */ public interface EncoderMonitor { /** Use this if you don't want to recreate this as just a NOOP monitor */ - public EncoderMonitor INSTANCE = new EncoderMonitorAdapter(); + EncoderMonitor INSTANCE = new EncoderMonitorAdapter(); /** @@ -77,10 +77,9 @@ /** * Monitors callbacks that deliver a fully decoded object. * - * @param encoder - * the stateful encoder driving the callback - * @param decoded - * the object that was decoded + * @param encoder the stateful encoder driving the callback + * @param cb the callback to call when the encoder has done its job + * @param decoded the object that was decoded */ void callbackOccured( StatefulEncoder encoder, EncoderCallback cb, Object decoded ); Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitorAdapter.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitorAdapter.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitorAdapter.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/EncoderMonitorAdapter.java Fri Jun 6 23:28:06 2008 @@ -24,7 +24,7 @@ * Document me. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$, $Date$ */ public class EncoderMonitorAdapter implements EncoderMonitor { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulDecoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulDecoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulDecoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulDecoder.java Fri Jun 6 23:28:06 2008 @@ -39,14 +39,14 @@ public interface StatefulDecoder { /** - * Decodes a peice of encoded data. The nature of this call, synchronous + * Decodes a piece of encoded data. The nature of this call, synchronous * verses asynchonous, with respect to driving the actual decoding of the * encoded data argument is determined by an implementation. A return from - * this method does not guarrantee any callbacks: zero or more callbacks may + * this method does not guarantee any callbacks: zero or more callbacks may * occur during this call. * - * @param encoded - * an object representing a peice of encoded data + * @param encoded an object representing a piece of encoded data + * @throws DecoderException if the encoded element can't be decoded */ void decode( Object encoded ) throws DecoderException; Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulEncoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulEncoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulEncoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/StatefulEncoder.java Fri Jun 6 23:28:06 2008 @@ -27,16 +27,35 @@ * The StatefulEncoder interface. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$, $Date$ */ public interface StatefulEncoder { - public void encode( Object obj ) throws EncoderException; + /** + * Encodes a Message object piece by piece often emitting chunks of the + * final PDU to the callback if present. + * + * @param obj the message object to encode into a PDU + * @throws EncoderException if there are problems while encoding + */ + void encode( Object obj ) throws EncoderException; - public void setCallback( EncoderCallback cb ); + /** + * Sets the callback of the underlying implementation. There is no need for + * any special callbacks because when encoding we do not need to transform + * before a value return as we did in the decoder. + * + * @param cb the callback to set on the underlying provider specific encoder + */ + void setCallback( EncoderCallback cb ); - public void setEncoderMonitor( EncoderMonitor monitor ); + /** + * Sets the monitor of the underlying implementation. + * + * @param monitor the monitor to set on the underlying implementation + */ + void setEncoderMonitor( EncoderMonitor monitor ); } Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoder.java Fri Jun 6 23:28:06 2008 @@ -30,7 +30,7 @@ * Document me. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$ */ public class HexDecoder extends AbstractStatefulDecoder { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoder.java Fri Jun 6 23:28:06 2008 @@ -33,7 +33,7 @@ * Document me. * * @author Apache Directory Project - * $Rev$ + * @version $Rev$ */ public class HexEncoder implements StatefulEncoder { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/ASN1InputStream.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/ASN1InputStream.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/ASN1InputStream.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/ASN1InputStream.java Fri Jun 6 23:28:06 2008 @@ -48,6 +48,10 @@ } + /** + * Compute the instance hash code + * @return the instance's hashcode + */ public int hashCode() { return 0; Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/BERConstructedOctetString.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/BERConstructedOctetString.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/BERConstructedOctetString.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/BERConstructedOctetString.java Fri Jun 6 23:28:06 2008 @@ -55,7 +55,7 @@ /** * Convert a vector of octet strings into a single byte string. */ - static private byte[] toBytes( Vector octs ) + private static byte[] toBytes( Vector octs ) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/DERObjectIdentifier.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/DERObjectIdentifier.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/DERObjectIdentifier.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/der/DERObjectIdentifier.java Fri Jun 6 23:28:06 2008 @@ -62,6 +62,7 @@ default: objId.append( '2' ); value -= 80; + break; } first = false; } Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/BitString.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/BitString.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/BitString.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/BitString.java Fri Jun 6 23:28:06 2008 @@ -28,6 +28,7 @@ * an array of int. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class BitString implements Serializable { @@ -210,18 +211,18 @@ return; } - int nbBytes = bytes.length - 1; + int nbb = bytes.length - 1; - if ( ( nbBytes > DEFAULT_LENGTH ) && ( bytes.length < nbBytes ) ) + if ( ( nbb > DEFAULT_LENGTH ) && ( bytes.length < nbb ) ) { // The current size is too small. // We have to allocate more space // TODO : implement the streaming - bytes = new byte[nbBytes]; + bytes = new byte[nbb]; } - setBytes( bytes, nbBytes ); + setBytes( bytes, nbb ); } Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/OID.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/OID.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/OID.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/primitives/OID.java Fri Jun 6 23:28:06 2008 @@ -58,6 +58,7 @@ * .2 -> 0x02 * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class OID implements Serializable { @@ -83,14 +84,16 @@ { // We should not create this kind of object directly, it must // be created through the factory. - hash = 0; + hash = 0; } /** * Create a new OID object from a byte array * - * @param oid + * @param oid the byte array containing the OID + * @throws DecoderException if the byte array does not contain a + * valid OID */ public OID( byte[] oid ) throws DecoderException { @@ -103,6 +106,8 @@ * Create a new OID object from a String * * @param oid The String which is supposed to be an OID + * @throws DecoderException if the byte array does not contain a + * valid OID */ public OID( String oid ) throws DecoderException { @@ -111,25 +116,6 @@ } - /** - * Create a new OID object from a String - * - * @param oid The String which is supposed to be an OID - */ - public OID( String oid, boolean safe ) - { - try - { - setOID( oid ); - hash = computeHashCode(); - } - catch ( DecoderException de ) - { - // do nothing - } - } - - // ~ Methods // ------------------------------------------------------------------------------------ /** @@ -137,6 +123,7 @@ * representation. * * @param oid The bytes containing the OID + * @throws DecoderException if the byte array does not contains a valid OID */ public void setOID( byte[] oid ) throws DecoderException { @@ -236,6 +223,7 @@ * OID = ( [ '0' | '1' ] '.' [ 0 .. 39 ] | '2' '.' int) ( '.' int )* * * @param oid The String containing the OID + * @throws DecoderException if the byte array does not contains a valid OID */ public void setOID( String oid ) throws DecoderException { @@ -246,14 +234,14 @@ } int nbValues = 1; - char[] bytes = oid.toCharArray(); + char[] chars = oid.toCharArray(); boolean dotSeen = false; // Count the number of int to allocate. - for ( int i = 0; i < bytes.length; i++ ) + for ( char c:chars ) { - if ( bytes[i] == '.' ) + if ( c == '.' ) { if ( dotSeen ) @@ -288,7 +276,7 @@ boolean ituOrIso = false; // The first value - switch ( bytes[pos] ) + switch ( chars[pos] ) { case '0': // itu-t @@ -297,7 +285,7 @@ // fallthrough case '2': // joint-iso-itu-t - oidValues[intPos++] = bytes[pos++] - '0'; + oidValues[intPos++] = chars[pos++] - '0'; break; default: // error, this value is not allowed @@ -305,7 +293,7 @@ } // We must have a dot - if ( bytes[pos++] != '.' ) + if ( chars[pos++] != '.' ) { throw new DecoderException( "Invalid OID : " + oid ); } @@ -314,10 +302,10 @@ int value = 0; - for ( int i = pos; i < bytes.length; i++ ) + for ( int i = pos; i < chars.length; i++ ) { - if ( bytes[i] == '.' ) + if ( chars[i] == '.' ) { if ( dotSeen ) @@ -341,10 +329,10 @@ oidValues[intPos++] = value; value = 0; } - else if ( ( bytes[i] >= 0x30 ) && ( bytes[i] <= 0x39 ) ) + else if ( ( chars[i] >= 0x30 ) && ( chars[i] <= 0x39 ) ) { dotSeen = false; - value = ( ( value * 10 ) + bytes[i] ) - '0'; + value = ( ( value * 10 ) + chars[i] ) - '0'; } else @@ -355,16 +343,16 @@ } } - oidValues[intPos++] = value; + oidValues[intPos] = value; hash = computeHashCode(); } /** - * Get an array of int from the OID + * Get an array of long from the OID * - * @return An array of int representing the OID + * @return An array of long representing the OID */ public long[] getOIDValues() { @@ -525,23 +513,25 @@ /** - * Compute the hashcode for this object. No need to copute + * Compute the hash code for this object. No need to compute * it live when calling the hashCode() method, as an OID * never change. + * + * @return the OID's hash code */ private int computeHashCode() { - int h = 37; - - for ( long val:oidValues ) - { - int low = (int)(val & 0x0000FFFFL); - int high = (int)(val >> 32); - h = h*17 + high; - h = h*17 + low; - } - - return h; + int h = 37; + + for ( long val:oidValues ) + { + int low = (int)(val & 0x0000FFFFL); + int high = (int)(val >> 32); + h = h*17 + high; + h = h*17 + low; + } + + return h; } /** @@ -561,10 +551,10 @@ boolean dotSeen = false; // Count the number of int to allocate. - for ( int i = 0; i < bytes.length; i++ ) + for ( byte b:bytes ) { - if ( bytes[i] == '.' ) + if ( b == '.' ) { if ( dotSeen ) @@ -600,9 +590,10 @@ { case '0': // itu-t + // fallthrough case '1': // iso ituOrIso = true; - // fallthrough + // fallthrough case '2': // joint-iso-itu-t break; @@ -685,14 +676,13 @@ return sb.toString(); } - /** - * @see Object#hashCode() - */ + public int hashCode() { - return hash; + return hash; } - + + public boolean equals( Object oid ) { if ( this == oid ) @@ -711,15 +701,15 @@ } OID instance = (OID)oid; - - if ( instance.hash != hash ) - { - return false; - } - else - { - return Arrays.equals( instance.oidValues, oidValues ); - } + + if ( instance.hash != hash ) + { + return false; + } + else + { + return Arrays.equals( instance.oidValues, oidValues ); + } } } \ No newline at end of file Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/Asn1StringUtils.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/Asn1StringUtils.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/Asn1StringUtils.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/Asn1StringUtils.java Fri Jun 6 23:28:06 2008 @@ -27,6 +27,7 @@ * Little helper class. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class Asn1StringUtils { @@ -76,10 +77,10 @@ StringBuffer sb = new StringBuffer(); - for ( int i = 0; i < buffer.length; i++ ) + for ( byte b:buffer ) { - sb.append( "0x" ).append( ( char ) ( HEX_CHAR[( buffer[i] & 0x00F0 ) >> 4] ) ).append( - ( char ) ( HEX_CHAR[buffer[i] & 0x000F] ) ).append( " " ); + sb.append( "0x" ).append( ( char ) ( HEX_CHAR[( b & 0x00F0 ) >> 4] ) ).append( + ( char ) ( HEX_CHAR[b & 0x000F] ) ).append( " " ); } return sb.toString(); Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java Fri Jun 6 23:28:06 2008 @@ -21,7 +21,6 @@ import org.apache.directory.shared.asn1.ber.tlv.Value; -import org.apache.directory.shared.asn1.codec.DecoderException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,6 +29,7 @@ * Parse and decode a Boolean value. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class BooleanDecoder { @@ -46,7 +46,7 @@ * @param value * The byte buffer to parse * @return A boolean. - * @throws DecoderException + * @throws BooleanDecoderException * Thrown if the byte stream does not contains a boolean */ public static boolean parse( Value value ) throws BooleanDecoderException Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java Fri Jun 6 23:28:06 2008 @@ -26,6 +26,7 @@ * during a decode. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class BooleanDecoderException extends Exception { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java Fri Jun 6 23:28:06 2008 @@ -27,6 +27,7 @@ * Parse and decode an Integer value. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class IntegerDecoder { Modified: directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java (original) +++ directory/shared/branches/bigbang/asn1/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java Fri Jun 6 23:28:06 2008 @@ -26,6 +26,7 @@ * decode. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class IntegerDecoderException extends Exception { Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/LengthTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/LengthTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/LengthTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/LengthTest.java Fri Jun 6 23:28:06 2008 @@ -22,13 +22,13 @@ import java.util.Arrays; -import junit.framework.Assert; import junit.framework.TestCase; /** * This class is used to test the Length class * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class LengthTest extends TestCase { @@ -38,17 +38,17 @@ */ public void testLengthGetNbBytes() { - Assert.assertEquals( 1, TLV.getNbBytes( 0 ) ); - Assert.assertEquals( 1, TLV.getNbBytes( 1 ) ); - Assert.assertEquals( 1, TLV.getNbBytes( 127 ) ); - Assert.assertEquals( 2, TLV.getNbBytes( 128 ) ); - Assert.assertEquals( 2, TLV.getNbBytes( 255 ) ); - Assert.assertEquals( 3, TLV.getNbBytes( 256 ) ); - Assert.assertEquals( 3, TLV.getNbBytes( 65535 ) ); - Assert.assertEquals( 4, TLV.getNbBytes( 65536 ) ); - Assert.assertEquals( 4, TLV.getNbBytes( 16777215 ) ); - Assert.assertEquals( 5, TLV.getNbBytes( 16777216 ) ); - Assert.assertEquals( 5, TLV.getNbBytes( 0xFFFFFFFF ) ); + assertEquals( "1 expected", 1, TLV.getNbBytes( 0 ) ); + assertEquals( "1 expected", 1, TLV.getNbBytes( 1 ) ); + assertEquals( "1 expected", 1, TLV.getNbBytes( 127 ) ); + assertEquals( "2 expected", 2, TLV.getNbBytes( 128 ) ); + assertEquals( "2 expected", 2, TLV.getNbBytes( 255 ) ); + assertEquals( "3 expected", 3, TLV.getNbBytes( 256 ) ); + assertEquals( "3 expected", 3, TLV.getNbBytes( 65535 ) ); + assertEquals( "4 expected", 4, TLV.getNbBytes( 65536 ) ); + assertEquals( "4 expected", 4, TLV.getNbBytes( 16777215 ) ); + assertEquals( "5 expected", 5, TLV.getNbBytes( 16777216 ) ); + assertEquals( "5 expected", 5, TLV.getNbBytes( 0xFFFFFFFF ) ); } Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/ValueTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/ValueTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/ValueTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/ber/tlv/ValueTest.java Fri Jun 6 23:28:06 2008 @@ -23,20 +23,21 @@ import java.math.BigInteger; import java.nio.ByteBuffer; -import org.apache.directory.shared.asn1.ber.tlv.Value; +import junit.framework.Assert; +import junit.framework.TestCase; + import org.apache.directory.shared.asn1.codec.EncoderException; import org.apache.directory.shared.asn1.primitives.BitString; import org.apache.directory.shared.asn1.util.Asn1StringUtils; import org.apache.directory.shared.asn1.util.IntegerDecoder; -import junit.framework.Assert; -import junit.framework.TestCase; /** * This class is used to test the Value class * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class ValueTest extends TestCase { @@ -244,13 +245,13 @@ -256, -255, -128, -127, -1, 0, 1, 127, 128, 255, 256, 32767, 32768, 65535, 65536, 8388607, 8388608, 16777215, 16777216, Integer.MAX_VALUE }; - for ( int i = 0; i < testedInt.length; i++ ) + for ( int i:testedInt ) { - encoded = Value.getBytes( testedInt[i] ); + encoded = Value.getBytes( i ); int value = new BigInteger( encoded ).intValue(); - Assert.assertEquals( testedInt[i], value ); + Assert.assertEquals( i, value ); } } @@ -263,13 +264,13 @@ -256, -255, -128, -127, -1, 0, 1, 127, 128, 255, 256, 32767, 32768, 65535, 65536, 8388607, 8388608, 16777215, 16777216, Integer.MAX_VALUE }; - for ( int i = 0; i < testedInt.length; i++ ) + for ( int i:testedInt ) { - encoded = new BigInteger( Integer.toString( testedInt[i] ) ).toByteArray(); + encoded = new BigInteger( Integer.toString( i ) ).toByteArray(); int value = IntegerDecoder.parse( new Value( encoded ) ); - Assert.assertEquals( testedInt[i], value ); + Assert.assertEquals( i, value ); } } @@ -301,7 +302,7 @@ } catch ( EncoderException ee ) { - + fail(); } assertEquals( "0x03 0x03 0x06 0x80 0x00 ", Asn1StringUtils.dumpBytes( buffer.array() ) ); Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java Fri Jun 6 23:28:06 2008 @@ -23,10 +23,6 @@ import junit.framework.TestCase; import org.apache.directory.shared.asn1.codec.DecoderException; -import org.apache.directory.shared.asn1.codec.stateful.AbstractStatefulDecoder; -import org.apache.directory.shared.asn1.codec.stateful.CallbackHistory; -import org.apache.directory.shared.asn1.codec.stateful.DecoderStack; -import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder; /** Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoderTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoderTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoderTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexDecoderTest.java Fri Jun 6 23:28:06 2008 @@ -29,7 +29,6 @@ import org.apache.directory.shared.asn1.codec.binary.Hex; import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback; import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder; -import org.apache.directory.shared.asn1.codec.stateful.examples.HexDecoder; /** Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoderTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoderTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoderTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/examples/HexEncoderTest.java Fri Jun 6 23:28:06 2008 @@ -29,7 +29,6 @@ import org.apache.directory.shared.asn1.codec.binary.Hex; import org.apache.directory.shared.asn1.codec.stateful.EncoderCallback; import org.apache.directory.shared.asn1.codec.stateful.StatefulEncoder; -import org.apache.directory.shared.asn1.codec.stateful.examples.HexEncoder; /** Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/BitStringTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/BitStringTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/BitStringTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/BitStringTest.java Fri Jun 6 23:28:06 2008 @@ -24,7 +24,6 @@ import junit.framework.TestCase; import org.apache.directory.shared.asn1.codec.DecoderException; -import org.apache.directory.shared.asn1.primitives.BitString; import org.apache.directory.shared.asn1.util.Asn1StringUtils; Modified: directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/OIDTest.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/OIDTest.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/OIDTest.java (original) +++ directory/shared/branches/bigbang/asn1/src/test/java/org/apache/directory/shared/asn1/primitives/OIDTest.java Fri Jun 6 23:28:06 2008 @@ -24,7 +24,6 @@ import junit.framework.TestCase; import org.apache.directory.shared.asn1.codec.DecoderException; -import org.apache.directory.shared.asn1.primitives.OID; /** @@ -374,10 +373,10 @@ */ public void testOidEqualsPerf() throws DecoderException { - String s1 = "1.2.840.113554.1.2.2.1.2.840.113554.1.2.2.1.2.840.113554.1.2.2"; - String s2 = "1.2.840.113554.1.2.2.1.2.840.113554.1.2.2.1.2.840.113554.1.2.2"; - String s3 = "1.3.6.1.5.5.2"; - + String s1 = "1.2.840.113554.1.2.2.1.2.840.113554.1.2.2.1.2.840.113554.1.2.2"; + String s2 = "1.2.840.113554.1.2.2.1.2.840.113554.1.2.2.1.2.840.113554.1.2.2"; + String s3 = "1.3.6.1.5.5.2"; + OID oid1 = new OID( s1 ); OID oid2 = new OID( s2 ); OID oid3 = new OID( s3 ); Modified: directory/shared/branches/bigbang/convert/src/main/antlr/schema.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/antlr/schema.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/antlr/schema.g (original) +++ directory/shared/branches/bigbang/convert/src/main/antlr/schema.g Fri Jun 6 23:28:06 2008 @@ -99,11 +99,6 @@ ( 'a' .. 'z') ( 'a' .. 'z' | '0' .. '9' | '-' | ';' )* ; -//XSTRING -// : -// "x-" ( 'a' .. 'z' ) ( 'a' .. 'z' | '-' | '_' )* -// ; - DESC : "desc" WS QUOTE ( ~'\'' )+ QUOTE Modified: directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java (original) +++ directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/ParserException.java Fri Jun 6 23:28:06 2008 @@ -22,10 +22,11 @@ /** * An exception thrown if we have an error while parsing a schema file. * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class ParserException extends Exception { - public static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * A strandard constuctor Modified: directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java (original) +++ directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/Schema.java Fri Jun 6 23:28:06 2008 @@ -29,6 +29,7 @@ * in which the ldif file will be dumped. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class Schema { Modified: directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaElementImpl.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaElementImpl.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaElementImpl.java (original) +++ directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaElementImpl.java Fri Jun 6 23:28:06 2008 @@ -37,6 +37,7 @@ * description, names and extensions (not implemented) * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public abstract class SchemaElementImpl implements SchemaElement { Modified: directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java (original) +++ directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaParser.java Fri Jun 6 23:28:06 2008 @@ -19,12 +19,23 @@ */ package org.apache.directory.shared.converter.schema; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.io.Writer; +import java.text.ParseException; +import java.util.List; -import org.apache.directory.shared.converter.schema.antlrSchemaLexer; -import org.apache.directory.shared.converter.schema.antlrSchemaParser; import org.apache.directory.shared.ldap.util.ExceptionUtils; -import java.util.List; +import antlr.RecognitionException; +import antlr.TokenStreamException; + +/* import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; @@ -34,15 +45,20 @@ import java.io.PipedOutputStream; import java.io.Writer; import java.text.ParseException; +import java.util.List; import antlr.RecognitionException; import antlr.TokenStreamException; +import org.apache.directory.shared.ldap.util.ExceptionUtils; +*/ + /** * A reusable wrapper for antlr generated schema parsers. * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class SchemaParser { Modified: directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java (original) +++ directory/shared/branches/bigbang/convert/src/main/java/org/apache/directory/shared/converter/schema/SchemaToLdif.java Fri Jun 6 23:28:06 2008 @@ -23,7 +23,6 @@ import java.io.Writer; import java.util.List; -import org.apache.directory.shared.converter.schema.Schema; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +31,7 @@ * with the Apache DS meta schema format * * @author Apache Directory Project + * @version $Rev$, $Date$ */ public class SchemaToLdif { Modified: directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java (original) +++ directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SchemaConstants.java Fri Jun 6 23:28:06 2008 @@ -40,7 +40,7 @@ String[] ALL_OPERATIONAL_ATTRIBUTES_ARRAY = new String[]{ ALL_OPERATIONAL_ATTRIBUTES }; // ---- ObjectClasses ----------------------------------------------------- - // Krb5Principal + // Krb5Principal String KRB5_PRINCIPAL_OC = "krb5Principal"; String KRB5_PRINCIPAL_OC_OID = "1.3.6.1.4.1.5322.10.2.1"; @@ -343,7 +343,7 @@ // Ref String REF_AT = "ref"; String REF_AT_OID = "2.16.840.1.113730.3.1.34"; - + // DisplayName String DISPLAY_NAME_AT = "displayName"; String DISPLAY_NAME_AT_OID = "2.16.840.1.113730.3.1.241"; Modified: directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SupportedSaslMechanisms.java URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SupportedSaslMechanisms.java?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SupportedSaslMechanisms.java (original) +++ directory/shared/branches/bigbang/ldap-constants/src/main/java/org/apache/directory/shared/ldap/constants/SupportedSaslMechanisms.java Fri Jun 6 23:28:06 2008 @@ -31,7 +31,7 @@ String CRAM_MD5 = "CRAM-MD5"; String DIGEST_MD5 = "DIGEST-MD5"; String GSSAPI = "GSSAPI"; - String SIMPLE = "SIMPLE"; + String PLAIN = "PLAIN"; /** Not a SASL JDK supported mechanism */ String NTLM = "NTLM"; Modified: directory/shared/branches/bigbang/ldap/pom.xml URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/pom.xml?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/pom.xml (original) +++ directory/shared/branches/bigbang/ldap/pom.xml Fri Jun 6 23:28:06 2008 @@ -98,7 +98,7 @@ org.apache.maven.plugins maven-antlr-plugin - ACIItem.g ACIItemChecker.g openldap.g schema-extension.g schema-qdstring.g schema-value.g schema.g subtree-specification.g SubtreeSpecificationChecker.g TriggerSpecification.g + ACIItem.g ACIItemChecker.g schema-extension.g schema-qdstring.g schema-value.g schema.g subtree-specification.g SubtreeSpecificationChecker.g TriggerSpecification.g Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItem.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItem.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItem.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItem.g Fri Jun 6 23:28:06 2008 @@ -145,7 +145,7 @@ */ public void init( Map oidsMap ) { - this.oidsMap = oidsMap; + this.oidsMap = oidsMap; } /** Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItemChecker.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItemChecker.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItemChecker.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/ACIItemChecker.g Fri Jun 6 23:28:06 2008 @@ -422,7 +422,7 @@ OPEN_CURLY ( SP )* distinguishedName ( SP )* ( SEP ( SP )* distinguishedName ( SP )* - )* + )* CLOSE_CURLY ; Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/SubtreeSpecificationChecker.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/SubtreeSpecificationChecker.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/SubtreeSpecificationChecker.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/SubtreeSpecificationChecker.g Fri Jun 6 23:28:06 2008 @@ -236,12 +236,12 @@ filter { - log.debug( "entered filter()" ); + log.debug( "entered filter()" ); } - : - ( filterToken:FILTER { FilterParser.parse( filterToken.getText() ); } ) - ; - exception + : + ( filterToken:FILTER { FilterParser.parse( filterToken.getText() ); } ) + ; + exception catch [Exception e] { throw new RecognitionException( "filterParser failed. " + e.getMessage() ); Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/TriggerSpecification.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/TriggerSpecification.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/TriggerSpecification.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/TriggerSpecification.g Fri Jun 6 23:28:06 2008 @@ -79,9 +79,9 @@ private String triggerStoredProcedureName; - private List triggerStoredProcedureParameters; - - private List triggerStoredProcedureOptions; + private List triggerStoredProcedureParameters; + + private List triggerStoredProcedureOptions; private List spSpecs; @@ -165,7 +165,7 @@ ( modifyStoredProcedureParameterList )? CLOSE_PARAN ( SP )* SEMI ( SP )* { - spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); + spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); })+ ; @@ -180,7 +180,7 @@ ( addStoredProcedureParameterList )? CLOSE_PARAN ( SP )* SEMI ( SP )* { - spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); + spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); } )+ ; @@ -196,7 +196,7 @@ ( deleteStoredProcedureParameterList )? CLOSE_PARAN ( SP )* SEMI ( SP )* { - spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); + spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); } )+ ; @@ -215,7 +215,7 @@ ( modifyDNStoredProcedureParameterList )? CLOSE_PARAN ( SP )* SEMI ( SP )* { - spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); + spSpecs.add( new SPSpec(triggerStoredProcedureName, triggerStoredProcedureOptions, triggerStoredProcedureParameters ) ); } )+ ; @@ -236,9 +236,9 @@ : ID_CALL { - triggerStoredProcedureName = null; - triggerStoredProcedureParameters = new ArrayList(); - triggerStoredProcedureOptions = new ArrayList(); + triggerStoredProcedureName = null; + triggerStoredProcedureParameters = new ArrayList(); + triggerStoredProcedureOptions = new ArrayList(); } ( SP )+ triggerStoredProcedureName=fullyQualifiedStoredProcedureName ( SP )* ( genericStoredProcedureOptionList ( SP )* )? @@ -349,7 +349,7 @@ } : ID_ldapContext ( SP )+ ldapContext=distinguishedName { triggerStoredProcedureParameters.add( StoredProcedureParameter.Generic_LDAP_CONTEXT.instance( ldapContext ) ); } - ; + ; // ----------------------------------------------------------------------------- Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/schema-extension.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/schema-extension.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/schema-extension.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/schema-extension.g Fri Jun 6 23:28:06 2008 @@ -39,18 +39,31 @@ k = 2 ; exportVocab=AntlrSchemaExtension ; charVocabulary = '\u0000'..'\uFFFE'; - caseSensitive = true ; + caseSensitive = false ; defaultErrorHandler = false ; } -protected WHSP : (options{greedy=true;}: ' ' )+ {$setType(Token.SKIP);} ; +protected WHSP + : + ( options {greedy=true;} : + ' ' + | + '\t' + | + '\r' (options {greedy=true;} : '\n')? { newline(); } + | + '\n' { newline(); } + )+ + { $setType(Token.SKIP); } //ignore this token + ; + protected QUOTE : '\'' ; //protected ESC : '\\' ; XKEY : xstring:XSTRING { setText(xstring.getText().trim()); }; XVALUES : values:VALUES { setText(values.getText().trim()); }; -protected XSTRING : ( "X-" ( 'a'..'z' | 'A'..'Z' | '-' | '_' )+ WHSP ) ; +protected XSTRING : ( "x-" ( 'a'..'z' | '-' | '_' )+ (WHSP)? ) ; protected VALUES : ( VALUE | '(' VALUE ( ('$')? VALUE )* ')' ) ; protected VALUE : (WHSP)? ( QUOTED_STRING ) (options {greedy=true;}: WHSP)? ; protected QUOTED_STRING : ( QUOTE (~'\'')* QUOTE ) ; @@ -90,7 +103,7 @@ { try { - AntlrSchemaQdstringLexer lexer = new AntlrSchemaQdstringLexer(new StringReader(s)); + AntlrSchemaQdstringLexer lexer = new AntlrSchemaQdstringLexer(new StringReader(s)); AntlrSchemaQdstringParser parser = new AntlrSchemaQdstringParser(lexer); qdstrings = parser.qdstrings(); } Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/schema-qdstring.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/schema-qdstring.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/schema-qdstring.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/schema-qdstring.g Fri Jun 6 23:28:06 2008 @@ -23,6 +23,8 @@ import java.util.ArrayList; import java.util.List; +import org.apache.directory.shared.ldap.schema.parser.ParserMonitor; + } @@ -38,20 +40,30 @@ k = 2 ; exportVocab=AntlrSchemaQdstring ; charVocabulary = '\u0000'..'\uFFFE'; - caseSensitive = true ; + caseSensitive = false ; defaultErrorHandler = false ; } -WHSP : ( ' ' ) {$setType(Token.SKIP);} ; +WHSP + : + ( options {greedy=true;} : + ' ' + | + '\t' + | + '\r' (options {greedy=true;} : '\n')? { newline(); } + | + '\n' { newline(); } + )+ + { $setType(Token.SKIP); } //ignore this token + ; + LPAR : '(' ; RPAR : ')' ; QUOTE : '\'' ; QDSTRING : ( QUOTE (~'\'')* QUOTE ) ; - - - /** * An antlr generated schema parser. This is a sub-parser used to parse * qdstring and qdstrings according to RFC4512. @@ -66,29 +78,48 @@ //buildAST=true ; } +{ + private ParserMonitor monitor = null; + public void setParserMonitor( ParserMonitor monitor ) + { + this.monitor = monitor; + } + private void matchedProduction( String msg ) + { + if ( null != monitor ) + { + monitor.matchedProduction( msg ); + } + } +} + /** * qdstrings = qdstring / ( LPAREN WSP qdstringlist WSP RPAREN ) * qdstringlist = [ qdstring *( SP qdstring ) ] */ qdstrings returns [List qdstrings] { - qdstrings = new ArrayList(); + matchedProduction( "AntlrSchemaQdstringParser.qdstrings()" ); + qdstrings = new ArrayList(); String qdstring = null; } : ( ( - q:QDSTRING - { - qdstring = q.getText(); - if(qdstring.startsWith("'")) { - qdstring = qdstring.substring(1, qdstring.length()); - } - if(qdstring.endsWith("'")) { - qdstring = qdstring.substring(0, qdstring.length()-1); - } - qdstrings.add(qdstring); - } + q:QDSTRING + { + qdstring = q.getText(); + if(qdstring.startsWith("'")) { + qdstring = qdstring.substring(1, qdstring.length()); + } + if(qdstring.endsWith("'")) { + qdstring = qdstring.substring(0, qdstring.length()-1); + } + qdstring = qdstring.replaceAll("\\\\5C", "\\\\"); + qdstring = qdstring.replaceAll("\\\\5c", "\\\\"); + qdstring = qdstring.replaceAll("\\\\27", "'"); + qdstrings.add(qdstring); + } ) | ( LPAR qdstring=qdstring { qdstrings.add(qdstring); } ( qdstring=qdstring { qdstrings.add(qdstring); } )* RPAR ) @@ -110,20 +141,23 @@ * QUTF1 = %x00-26 / %x28-5B / %x5D-7F */ qdstring returns [String qdstring=null] + { + matchedProduction( "AntlrSchemaQdstringParser.qdstring()" ); + } : ( q:QDSTRING { qdstring = q.getText(); if(qdstring.startsWith("'")) { - qdstring = qdstring.substring(1, qdstring.length()); - } - if(qdstring.endsWith("'")) { - qdstring = qdstring.substring(0, qdstring.length()-1); - } - qdstring = qdstring.replaceAll("\\\\5C", "\\\\"); - qdstring = qdstring.replaceAll("\\\\5c", "\\\\"); - qdstring = qdstring.replaceAll("\\\\27", "'"); + qdstring = qdstring.substring(1, qdstring.length()); + } + if(qdstring.endsWith("'")) { + qdstring = qdstring.substring(0, qdstring.length()-1); + } + qdstring = qdstring.replaceAll("\\\\5C", "\\\\"); + qdstring = qdstring.replaceAll("\\\\5c", "\\\\"); + qdstring = qdstring.replaceAll("\\\\27", "'"); } ) ; Modified: directory/shared/branches/bigbang/ldap/src/main/antlr/schema-value.g URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/antlr/schema-value.g?rev=664290&r1=664289&r2=664290&view=diff ============================================================================== --- directory/shared/branches/bigbang/ldap/src/main/antlr/schema-value.g (original) +++ directory/shared/branches/bigbang/ldap/src/main/antlr/schema-value.g Fri Jun 6 23:28:06 2008 @@ -23,6 +23,8 @@ import java.util.List; import java.util.ArrayList; +import org.apache.directory.shared.ldap.schema.parser.ParserMonitor; + } @@ -38,33 +40,66 @@ k = 3 ; exportVocab=AntlrSchemaValue ; charVocabulary = '\3'..'\377' ; - caseSensitive = true ; + caseSensitive = false ; defaultErrorHandler = false ; } -//WHSP : (' ') {$setType(Token.SKIP);} ; -SP : ( ' ' )+ { setText(" "); }; +WHSP + : + ( options {greedy=true;} : + ' ' + | + '\t' + | + '\r' (options {greedy=true;} : '\n')? { newline(); } + | + '\n' { newline(); } + | + '#' (~'\n')* '\n' { newline(); } + )+ + { setText(" "); } + //{$setType(Token.SKIP);} //ignore this token + ; LPAR : '(' ; RPAR : ')' ; +protected CHAR : 'a'..'z' ; protected LDIGIT : '1'..'9' ; protected DIGIT : '0'..'9' ; protected NUMBER : DIGIT | ( LDIGIT (DIGIT)+ ) ; +protected NUMBER2 : (DIGIT)+ ; protected NUMERICOID : NUMBER ( '.' NUMBER )+ ; +protected HYPEN : '-'; +protected OTHER : '_' | ';' | '.'; +protected DESCR: CHAR ( CHAR | DIGIT | HYPEN )* ; +protected QUIRKS_DESCR: ( CHAR | DIGIT | HYPEN | OTHER )+ ; QUOTE : '\'' ; DOLLAR : '$' ; LCURLY : '{' ; RCURLY : '}' ; -DESCR : ( 'a'..'z' | 'A'..'Z' ) ( 'a'..'z' | 'A'..'Z' | '0'..'9' | '-' )* ; -LEN : LCURLY n:NUMBER RCURLY { setText(n.getText()); } ; +LEN : LCURLY n:NUMBER2 RCURLY { setText(n.getText()); } ; + -NUMBER_OR_NUMERICOID : +DESCR_OR_QUIRKS_DESCR : + ( NUMERICOID QUIRKS_DESCR ) => QUIRKS_DESCR { $setType( QUIRKS_DESCR ); } + | + ( NUMBER QUIRKS_DESCR ) => QUIRKS_DESCR { $setType( QUIRKS_DESCR ); } + | + ( HYPEN QUIRKS_DESCR ) => QUIRKS_DESCR { $setType( QUIRKS_DESCR ); } + | + ( OTHER QUIRKS_DESCR ) => QUIRKS_DESCR { $setType( QUIRKS_DESCR ); } + | + ( DESCR QUIRKS_DESCR ) => QUIRKS_DESCR { $setType( QUIRKS_DESCR ); } + | + ( DESCR ) { $setType( DESCR ); } + | ( NUMBER '.' ) => NUMERICOID { $setType( NUMERICOID ); } | ( NUMBER ) { $setType( NUMBER ); } ; + /** * An antlr generated schema parser. This is a sub-parser used to parse * numericoid, oid, oids, qdescr, qdescrs according to RFC4512. @@ -79,18 +114,81 @@ //buildAST=true ; } +{ + private ParserMonitor monitor = null; + public void setParserMonitor( ParserMonitor monitor ) + { + this.monitor = monitor; + } + private void matchedProduction( String msg ) + { + if ( null != monitor ) + { + monitor.matchedProduction( msg ); + } + } +} /** * noidlen = numericoid [ LCURLY len RCURLY ] * len = number */ noidlen returns [AntlrSchemaParser.NoidLen noidlen = new AntlrSchemaParser.NoidLen()] + { + matchedProduction( "AntlrSchemaValueParser.noidlen()" ); + } : ( - o:NUMERICOID { noidlen.noid = o.getText(); } - ( - l:LEN { noidlen.len = Integer.parseInt(l.getText()); } - )? + (LPAR)? + (WHSP)? + (QUOTE)? + ( + ( d4:DESCR { noidlen.noid = d4.getText(); } ) + | + ( n2:NUMERICOID { noidlen.noid = n2.getText(); } ) + ) + (QUOTE)? + (WHSP)? + (RPAR)? + ( + l:LEN { noidlen.len = Integer.parseInt(l.getText()); } + (QUOTE)? + (WHSP)? + (RPAR)? + )? + ) + ; + + + /** + * noidlen = numericoid [ LCURLY len RCURLY ] + * len = number + */ +quirksNoidlen returns [AntlrSchemaParser.NoidLen noidlen = new AntlrSchemaParser.NoidLen()] + { + matchedProduction( "AntlrSchemaValueParser.quirksNoidlen()" ); + } + : + ( + (LPAR)? + (WHSP)? + (QUOTE)? + ( + ( q2:QUIRKS_DESCR { noidlen.noid = q2.getText(); } ) + | + ( d4:DESCR { noidlen.noid = d4.getText(); } ) + | + ( n2:NUMERICOID { noidlen.noid = n2.getText(); } ) + ) + (QUOTE)? + (WHSP)? + (RPAR)? + ( + l:LEN { noidlen.len = Integer.parseInt(l.getText()); } + (QUOTE)? + (WHSP)? + (RPAR)? + )? ) ; @@ -99,9 +197,22 @@ * numericoid = number 1*( DOT number ) */ numericoid returns [String numericoid=null] + { + matchedProduction( "AntlrSchemaValueParser.numericoid()" ); + } : ( - (SP)? n:NUMERICOID (SP)? { numericoid = n.getText(); } + (WHSP)? + (LPAR (WHSP)? )? + ( + ( QUOTE n1:NUMERICOID { numericoid = n1.getText(); } QUOTE ) + | + ( n2:NUMERICOID { numericoid = n2.getText(); } ) + ) + ( + (WHSP)? + (RPAR)? + ) ) ; @@ -117,15 +228,22 @@ * */ oid returns [String oid=null] + { + matchedProduction( "AntlrSchemaValueParser.oid()" ); + } : ( - (SP)? - ( - n:NUMERICOID { oid = n.getText(); } - | - d:DESCR { oid = d.getText(); } - ) - (SP)? + (WHSP)? + ( + ( QUOTE n1:NUMERICOID { oid = n1.getText(); } QUOTE ) + | + ( n2:NUMERICOID { oid = n2.getText(); } ) + | + ( QUOTE d1:DESCR { oid = d1.getText(); } QUOTE ) + | + ( d2:DESCR { oid = d2.getText(); } ) + ) + (options {greedy=true;} : WHSP)? ) ; @@ -136,23 +254,24 @@ */ oids returns [List oids] { + matchedProduction( "AntlrSchemaValueParser.oids()" ); oids = new ArrayList(); String oid = null; } : ( ( - oid=oid { oids.add(oid); } - ) + oid=oid { oids.add(oid); } + ) | - ( - LPAR - oid=oid { oids.add(oid); } - ( - DOLLAR - oid=oid { oids.add(oid); } - )* - RPAR + ( + LPAR + oid=oid { oids.add(oid); } + ( + (DOLLAR)? + oid=oid { oids.add(oid); } + )* + RPAR ) ) ; @@ -162,12 +281,17 @@ * qdescr = SQUOTE descr SQUOTE */ qdescr returns [String qdescr=null] + { + matchedProduction( "AntlrSchemaValueParser.qdescr()" ); + } : ( - (SP)? - QUOTE - d:DESCR { qdescr = d.getText(); } - QUOTE + (WHSP)? + ( + ( QUOTE d1:DESCR { qdescr = d1.getText(); } QUOTE ) + | + ( d2:DESCR { qdescr = d2.getText(); } ) + ) ) ; @@ -178,37 +302,112 @@ */ qdescrs returns [List qdescrs] { - qdescrs = new ArrayList(); + matchedProduction( "AntlrSchemaValueParser.qdescrs()" ); + qdescrs = new ArrayList(); String qdescr = null; } : ( ( - qdescr=qdescr { qdescrs.add(qdescr); } - ) + qdescr=qdescr { qdescrs.add(qdescr); } + ) | + ( + + LPAR + qdescr=qdescr { qdescrs.add(qdescr); } + (options {greedy=true;} : WHSP)? + (DOLLAR)? + (options {greedy=true;} : WHSP)? + ( + qdescr=qdescr { qdescrs.add(qdescr); } + (options {greedy=true;} : WHSP)? + (DOLLAR)? + (options {greedy=true;} : WHSP)? + )* + RPAR + ) + ) + ; + + + + /** + * qdescr = SQUOTE descr SQUOTE + */ +quirksQdescr returns [String qdescr=null] + { + matchedProduction( "AntlrSchemaValueParser.qdescr()" ); + } + : + ( + (WHSP)? + ( + ( QUOTE d1:QUIRKS_DESCR { qdescr = d1.getText(); } QUOTE ) + | + ( d2:QUIRKS_DESCR { qdescr = d2.getText(); } ) + | + ( QUOTE d3:DESCR { qdescr = d3.getText(); } QUOTE ) + | + ( d4:DESCR { qdescr = d4.getText(); } ) + | + ( QUOTE n1:NUMERICOID { qdescr = n1.getText(); } QUOTE ) + | + ( n2:NUMERICOID { qdescr = n2.getText(); } ) + ) + (options {greedy=true;} : WHSP)? + ) + ; + + + /** + * qdescrs = qdescr / ( LPAREN WSP qdescrlist WSP RPAREN ) + * qdescrlist = [ qdescr *( SP qdescr ) ] + */ +quirksQdescrs returns [List qdescrs] + { + matchedProduction( "AntlrSchemaValueParser.qdescrs()" ); + qdescrs = new ArrayList(); + String qdescr = null; + } + : + ( ( - LPAR - qdescr=qdescr { qdescrs.add(qdescr); } - ( - SP - qdescr=qdescr { qdescrs.add(qdescr); } - )* - (SP)? - RPAR - ) + qdescr=quirksQdescr { qdescrs.add(qdescr); } + ) + | + ( + LPAR + qdescr=quirksQdescr { qdescrs.add(qdescr); } + (options {greedy=true;} : WHSP)? + (DOLLAR)? + (options {greedy=true;} : WHSP)? + ( + qdescr=quirksQdescr { qdescrs.add(qdescr); } + (options {greedy=true;} : WHSP)? + (DOLLAR)? + (options {greedy=true;} : WHSP)? + )* + RPAR + ) ) ; + + + /** * ruleid = number * number = DIGIT / ( LDIGIT 1*DIGIT ) * */ ruleid returns [Integer ruleid=null] + { + matchedProduction( "AntlrSchemaValueParser.ruleid()" ); + } : ( - (SP)? + (WHSP)? n:NUMBER { ruleid = Integer.parseInt(n.getText()); } ) ; @@ -220,24 +419,25 @@ */ ruleids returns [List ruleids] { + matchedProduction( "AntlrSchemaValueParser.ruleids()" ); ruleids = new ArrayList(); Integer ruleid = null; } : ( ( - ruleid=ruleid { ruleids.add(ruleid); } - ) + ruleid=ruleid { ruleids.add(ruleid); } + ) | ( - LPAR - ruleid=ruleid { ruleids.add(ruleid); } - ( - SP - ruleid=ruleid { ruleids.add(ruleid); } - )* - (SP)? - RPAR + LPAR + ruleid=ruleid { ruleids.add(ruleid); } + ( + WHSP + ruleid=ruleid { ruleids.add(ruleid); } + )* + (WHSP)? + RPAR ) ) ;