You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/12/18 18:32:09 UTC
svn commit: r488355 [8/10] - in /directory/sandbox/pamarcelot/ldapstudio:
ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/
ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/
ldapstudio-browse...
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueLexer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueLexer.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueLexer.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueLexer.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,618 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schemavalue.g" -> "SchemaValueLexer.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.util.*;
+
+import java.io.InputStream;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.TokenStreamRecognitionException;
+import antlr.CharStreamException;
+import antlr.CharStreamIOException;
+import antlr.ANTLRException;
+import java.io.Reader;
+import java.util.Hashtable;
+import antlr.CharScanner;
+import antlr.InputBuffer;
+import antlr.ByteBuffer;
+import antlr.CharBuffer;
+import antlr.Token;
+import antlr.CommonToken;
+import antlr.RecognitionException;
+import antlr.NoViableAltForCharException;
+import antlr.MismatchedCharException;
+import antlr.TokenStream;
+import antlr.ANTLRHashString;
+import antlr.LexerSharedInputState;
+import antlr.collections.impl.BitSet;
+import antlr.SemanticException;
+
+
+public class SchemaValueLexer extends antlr.CharScanner implements SchemaValueTokenTypes, TokenStream
+{
+ public SchemaValueLexer( InputStream in )
+ {
+ this( new ByteBuffer( in ) );
+ }
+
+
+ public SchemaValueLexer( Reader in )
+ {
+ this( new CharBuffer( in ) );
+ }
+
+
+ public SchemaValueLexer( InputBuffer ib )
+ {
+ this( new LexerSharedInputState( ib ) );
+ }
+
+
+ public SchemaValueLexer( LexerSharedInputState state )
+ {
+ super( state );
+ caseSensitiveLiterals = true;
+ setCaseSensitive( false );
+ literals = new Hashtable();
+ }
+
+
+ public Token nextToken() throws TokenStreamException
+ {
+ Token theRetToken = null;
+ tryAgain: for ( ;; )
+ {
+ Token _token = null;
+ int _ttype = Token.INVALID_TYPE;
+ resetText();
+ try
+ { // for char stream error handling
+ try
+ { // for lexical error handling
+ switch ( LA( 1 ) )
+ {
+ case ' ':
+ {
+ mWHSP( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '(':
+ {
+ mLPAR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case ')':
+ {
+ mRPAR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '\'':
+ {
+ mQUOTE( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '$':
+ {
+ mDOLLAR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case '}':
+ {
+ mRBRACKET( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ mDESCR( true );
+ theRetToken = _returnToken;
+ break;
+ }
+ default:
+ if ( ( LA( 1 ) == '{' ) && ( ( LA( 2 ) >= '0' && LA( 2 ) <= '9' ) ) )
+ {
+ mLEN( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) && ( _tokenSet_0.member( LA( 2 ) ) ) )
+ {
+ mNUMERICOID( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( LA( 1 ) == '{' ) && ( true ) )
+ {
+ mLBRACKET( true );
+ theRetToken = _returnToken;
+ }
+ else if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) && ( true ) )
+ {
+ mDIGIT( true );
+ theRetToken = _returnToken;
+ }
+ else
+ {
+ if ( LA( 1 ) == EOF_CHAR )
+ {
+ uponEOF();
+ _returnToken = makeToken( Token.EOF_TYPE );
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(),
+ getColumn() );
+ }
+ }
+ }
+ if ( _returnToken == null )
+ continue tryAgain; // found SKIP token
+ _ttype = _returnToken.getType();
+ _ttype = testLiteralsTable( _ttype );
+ _returnToken.setType( _ttype );
+ return _returnToken;
+ }
+ catch ( RecognitionException e )
+ {
+ throw new TokenStreamRecognitionException( e );
+ }
+ }
+ catch ( CharStreamException cse )
+ {
+ if ( cse instanceof CharStreamIOException )
+ {
+ throw new TokenStreamIOException( ( ( CharStreamIOException ) cse ).io );
+ }
+ else
+ {
+ throw new TokenStreamException( cse.getMessage() );
+ }
+ }
+ }
+ }
+
+
+ public final void mWHSP( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = WHSP;
+ int _saveIndex;
+
+ {
+ match( ' ' );
+ }
+ _ttype = Token.SKIP;
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mLPAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LPAR;
+ int _saveIndex;
+
+ match( '(' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mRPAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = RPAR;
+ int _saveIndex;
+
+ match( ')' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mQUOTE( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = QUOTE;
+ int _saveIndex;
+
+ match( '\'' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mDOLLAR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = DOLLAR;
+ int _saveIndex;
+
+ match( '$' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mLBRACKET( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LBRACKET;
+ int _saveIndex;
+
+ match( '{' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mRBRACKET( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = RBRACKET;
+ int _saveIndex;
+
+ match( '}' );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mLEN( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = LEN;
+ int _saveIndex;
+
+ mLBRACKET( false );
+ {
+ int _cnt11 = 0;
+ _loop11: do
+ {
+ if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) )
+ {
+ mDIGIT( false );
+ }
+ else
+ {
+ if ( _cnt11 >= 1 )
+ {
+ break _loop11;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt11++;
+ }
+ while ( true );
+ }
+ mRBRACKET( false );
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mDIGIT( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = DIGIT;
+ int _saveIndex;
+
+ {
+ matchRange( '0', '9' );
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mNUMERICOID( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = NUMERICOID;
+ int _saveIndex;
+
+ {
+ int _cnt16 = 0;
+ _loop16: do
+ {
+ if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) )
+ {
+ matchRange( '0', '9' );
+ }
+ else
+ {
+ if ( _cnt16 >= 1 )
+ {
+ break _loop16;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt16++;
+ }
+ while ( true );
+ }
+ {
+ int _cnt20 = 0;
+ _loop20: do
+ {
+ if ( ( LA( 1 ) == '.' ) )
+ {
+ match( '.' );
+ {
+ int _cnt19 = 0;
+ _loop19: do
+ {
+ if ( ( ( LA( 1 ) >= '0' && LA( 1 ) <= '9' ) ) )
+ {
+ matchRange( '0', '9' );
+ }
+ else
+ {
+ if ( _cnt19 >= 1 )
+ {
+ break _loop19;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(),
+ getColumn() );
+ }
+ }
+
+ _cnt19++;
+ }
+ while ( true );
+ }
+ }
+ else
+ {
+ if ( _cnt20 >= 1 )
+ {
+ break _loop20;
+ }
+ else
+ {
+ throw new NoViableAltForCharException( ( char ) LA( 1 ), getFilename(), getLine(), getColumn() );
+ }
+ }
+
+ _cnt20++;
+ }
+ while ( true );
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ public final void mDESCR( boolean _createToken ) throws RecognitionException, CharStreamException,
+ TokenStreamException
+ {
+ int _ttype;
+ Token _token = null;
+ int _begin = text.length();
+ _ttype = DESCR;
+ int _saveIndex;
+
+ {
+ matchRange( 'a', 'z' );
+ }
+ {
+ _loop24: do
+ {
+ switch ( LA( 1 ) )
+ {
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ matchRange( 'a', 'z' );
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ matchRange( '0', '9' );
+ break;
+ }
+ case '-':
+ {
+ match( '-' );
+ break;
+ }
+ case ';':
+ {
+ match( ';' );
+ break;
+ }
+ case '.':
+ {
+ match( '.' );
+ break;
+ }
+ default:
+ {
+ break _loop24;
+ }
+ }
+ }
+ while ( true );
+ }
+ if ( _createToken && _token == null && _ttype != Token.SKIP )
+ {
+ _token = makeToken( _ttype );
+ _token.setText( new String( text.getBuffer(), _begin, text.length() - _begin ) );
+ }
+ _returnToken = _token;
+ }
+
+
+ private static final long[] mk_tokenSet_0()
+ {
+ long[] data =
+ { 288019269919178752L, 0L, 0L, 0L, 0L };
+ return data;
+ }
+
+ public static final BitSet _tokenSet_0 = new BitSet( mk_tokenSet_0() );
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueParser.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueParser.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueParser.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schemavalue.g" -> "SchemaValueParser.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.util.*;
+
+import antlr.TokenBuffer;
+import antlr.TokenStreamException;
+import antlr.TokenStreamIOException;
+import antlr.ANTLRException;
+import antlr.LLkParser;
+import antlr.Token;
+import antlr.TokenStream;
+import antlr.RecognitionException;
+import antlr.NoViableAltException;
+import antlr.MismatchedTokenException;
+import antlr.SemanticException;
+import antlr.ParserSharedInputState;
+import antlr.collections.impl.BitSet;
+
+
+public class SchemaValueParser extends antlr.LLkParser implements SchemaValueTokenTypes
+{
+
+ protected SchemaValueParser( TokenBuffer tokenBuf, int k )
+ {
+ super( tokenBuf, k );
+ tokenNames = _tokenNames;
+ }
+
+
+ public SchemaValueParser( TokenBuffer tokenBuf )
+ {
+ this( tokenBuf, 3 );
+ }
+
+
+ protected SchemaValueParser( TokenStream lexer, int k )
+ {
+ super( lexer, k );
+ tokenNames = _tokenNames;
+ }
+
+
+ public SchemaValueParser( TokenStream lexer )
+ {
+ this( lexer, 3 );
+ }
+
+
+ public SchemaValueParser( ParserSharedInputState state )
+ {
+ super( state, 3 );
+ tokenNames = _tokenNames;
+ }
+
+
+ public final String[] oids() throws RecognitionException, TokenStreamException
+ {
+ String[] oids;
+
+ oids = new String[0];
+ List oidList = new ArrayList();
+ String oid = null;
+
+ {
+ switch ( LA( 1 ) )
+ {
+ case NUMERICOID:
+ case DESCR:
+ {
+ {
+ oid = oid();
+ oidList.add( oid );
+ }
+ break;
+ }
+ case LPAR:
+ {
+ {
+ match( LPAR );
+ oid = oid();
+ oidList.add( oid );
+ {
+ _loop30: do
+ {
+ if ( ( LA( 1 ) == DOLLAR ) )
+ {
+ match( DOLLAR );
+ oid = oid();
+ oidList.add( oid );
+ }
+ else
+ {
+ break _loop30;
+ }
+
+ }
+ while ( true );
+ }
+ match( RPAR );
+ }
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltException( LT( 1 ), getFilename() );
+ }
+ }
+ }
+
+ oids = ( String[] ) oidList.toArray( new String[oidList.size()] );
+
+ return oids;
+ }
+
+
+ public final String oid() throws RecognitionException, TokenStreamException
+ {
+ String oid = null;
+
+ Token n = null;
+ Token d = null;
+
+ {
+ switch ( LA( 1 ) )
+ {
+ case NUMERICOID:
+ {
+ n = LT( 1 );
+ match( NUMERICOID );
+ oid = n.getText();
+ break;
+ }
+ case DESCR:
+ {
+ d = LT( 1 );
+ match( DESCR );
+ oid = d.getText();
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltException( LT( 1 ), getFilename() );
+ }
+ }
+ }
+ return oid;
+ }
+
+
+ public final String[] qdescrs() throws RecognitionException, TokenStreamException
+ {
+ String[] qdescrs;
+
+ qdescrs = new String[0];
+ List qdescrList = new ArrayList();
+ String qdescr = null;
+
+ {
+ switch ( LA( 1 ) )
+ {
+ case QUOTE:
+ {
+ {
+ qdescr = qdescr();
+ qdescrList.add( qdescr );
+ }
+ break;
+ }
+ case LPAR:
+ {
+ {
+ match( LPAR );
+ qdescr = qdescr();
+ qdescrList.add( qdescr );
+ {
+ _loop38: do
+ {
+ if ( ( LA( 1 ) == QUOTE ) )
+ {
+ qdescr = qdescr();
+ qdescrList.add( qdescr );
+ }
+ else
+ {
+ break _loop38;
+ }
+
+ }
+ while ( true );
+ }
+ match( RPAR );
+ }
+ break;
+ }
+ default:
+ {
+ throw new NoViableAltException( LT( 1 ), getFilename() );
+ }
+ }
+ }
+
+ qdescrs = ( String[] ) qdescrList.toArray( new String[qdescrList.size()] );
+
+ return qdescrs;
+ }
+
+
+ public final String qdescr() throws RecognitionException, TokenStreamException
+ {
+ String qdescr = null;
+
+ Token d = null;
+
+ {
+ match( QUOTE );
+ d = LT( 1 );
+ match( DESCR );
+ qdescr = d.getText();
+ match( QUOTE );
+ }
+ return qdescr;
+ }
+
+ public static final String[] _tokenNames =
+ { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "WHSP", "LPAR", "RPAR", "QUOTE", "DOLLAR", "LBRACKET",
+ "RBRACKET", "LEN", "DIGIT", "NUMERICOID", "DESCR" };
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+// $ANTLR 2.7.5 (20050128): "schemavalue.g" -> "SchemaValueLexer.java"$
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+
+import java.util.*;
+
+
+public interface SchemaValueTokenTypes
+{
+ int EOF = 1;
+
+ int NULL_TREE_LOOKAHEAD = 3;
+
+ int WHSP = 4;
+
+ int LPAR = 5;
+
+ int RPAR = 6;
+
+ int QUOTE = 7;
+
+ int DOLLAR = 8;
+
+ int LBRACKET = 9;
+
+ int RBRACKET = 10;
+
+ int LEN = 11;
+
+ int DIGIT = 12;
+
+ int NUMERICOID = 13;
+
+ int DESCR = 14;
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.txt
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.txt?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.txt (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.txt Mon Dec 18 09:32:03 2006
@@ -0,0 +1,13 @@
+// $ANTLR 2.7.5 (20050128): schemavalue.g -> SchemaValueTokenTypes.txt$
+SchemaValue // output token vocab name
+WHSP=4
+LPAR=5
+RPAR=6
+QUOTE=7
+DOLLAR=8
+LBRACKET=9
+RBRACKET=10
+LEN=11
+DIGIT=12
+NUMERICOID=13
+DESCR=14
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schema.g
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schema.g?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schema.g (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schema.g Mon Dec 18 09:32:03 2006
@@ -0,0 +1,273 @@
+header {
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+import java.io.* ;
+import java.util.* ;
+import org.apache.directory.ldapstudio.browser.core.model.schema.*;
+
+}
+
+// ----------------------------------------------------------------------------
+// Main Lexer
+// ----------------------------------------------------------------------------
+
+class SchemaLexer extends Lexer;
+
+options {
+ k = 5 ;
+ //importVocab=NonQuote ;
+ exportVocab=Schema ;
+ charVocabulary = '\3'..'\377' ;
+ caseSensitive = false ;
+ //testLiterals = true ;
+ defaultErrorHandler = false ;
+}
+
+WHSP : (options{greedy=true;}: ' ' )+ {$setType(Token.SKIP);} ;
+
+LPAR : '(' ;
+RPAR : ')' ;
+QUOTE : '\'' ;
+DOLLAR : '$' ;
+LBRACKET : '{' ;
+RBRACKET : '}' ;
+
+LEN : LBRACKET ('0'..'9')+ RBRACKET ;
+
+USAGE_USERAPPLICATIONS : "userapplications" ;
+USAGE_DIRECTORYOPERATION : "directoryoperation" ;
+USAGE_DISTRIBUTEDOPERATION : "distributedoperation" ;
+USAGE_DSAOPERATION : "dsaoperation" ;
+
+STARTNUMERICOID : ( LPAR ( numericoid:VALUE ) ) { setText(numericoid.getText().trim()); } ;
+//NAME : ( "name" WHSP qdescrs:QDESCRS (WHSP)? ) { setText(qdescrs.getText()); } ; // use QDSTRINGS to allow apache-ds ldapsyntaxes
+NAME : ( "name" WHSP qdstrings:VALUES ) { setText(qdstrings.getText().trim()); } ;
+DESC : ( "desc" WHSP qdstring:VALUES ) { setText(qdstring.getText().trim()); } ;
+SUP : ( "sup" WHSP sup:VALUES ) { setText(sup.getText().trim()); } ;
+MUST : ( "must" WHSP must:VALUES ) { setText(must.getText().trim()); } ;
+MAY : ( "may" WHSP may:VALUES ) { setText(may.getText()); } ;
+EQUALITY : ( "equality" WHSP equality:VALUES ) { setText(equality.getText().trim()); } ;
+ORDERING : ( "ordering" WHSP ordering:VALUES ) { setText(ordering.getText().trim()); } ;
+SUBSTR : ( "substr" WHSP substr:VALUES ) { setText(substr.getText().trim()); } ;
+SYNTAX : ( "syntax" WHSP syntax:VALUES (len:LEN)? ) { setText(syntax.getText().trim() + (len!=null?len.getText().trim():"")); } ;
+//USAGE : ( "usage" WHSP ( USAGE_USERAPPLICATIONS | USAGE_DIRECTORYOPERATION | USAGE_DISTRIBUTEDOPERATION | USAGE_DSAOPERATION ) (WHSP)? ) ;
+USAGE : ( "usage" WHSP op:VALUES ) { setText(op.getText().trim()); } ;
+APPLIES : ( "applies" WHSP applies:VALUES ) { setText(applies.getText().trim()); } ;
+
+X : ( "x-" ( 'a'..'z' | '0'..'9' | '-' | '_' )+ WHSP VALUES ) {$setType(Token.SKIP);} ;
+
+SINGLE_VALUE : ( "single-value" (WHSP)? ) ;
+COLLECTIVE : ( "collective" (WHSP)? ) ;
+NO_USER_MODIFICATION : ( "no-user-modification" (WHSP)? ) ;
+OBSOLETE : ( "obsolete" (WHSP)? ) ;
+ABSTRACT : ( "abstract" (WHSP)? ) ;
+STRUCTURAL : ( "structural" (WHSP)? ) ;
+AUXILIARY : ( "auxiliary" (WHSP)? ) ;
+
+//APACHE_SYNTAX_NAME : ( "name" WHSP qdstring:QDSTRING (WHSP)? ) { setText(qdstring.getText()); } ;
+
+
+
+protected VALUES : ( VALUE | LPAR VALUE ( (DOLLAR)? VALUE )* RPAR ) ;
+protected VALUE : (WHSP)? ( QUOTED_STRING | UNQUOTED_STRING ) (options {greedy=true;}: WHSP)? ;
+//protected UNQUOTED_STRING : ( ~('\''|' '|'('|')'|'{'|'}'|'$') (options{greedy=true;}: ~' ')* ) ;
+protected UNQUOTED_STRING : (options{greedy=true;}: 'a'..'z' | '0'..'9' | '-' | ';' | '.' )+ ;
+protected QUOTED_STRING : ( QUOTE (~'\'')* QUOTE ) ;
+
+
+
+//protected QDESCRS : ( QDESCR | ( LPAR (WHSP)? ( QDESCR (WHSP)? )+ RPAR ) ) ;
+//protected QDESCR : ( QUOTE DESCR QUOTE ) ;
+//protected DESCR : ( 'a'..'z') ( 'a'..'z' | '0'..'9' | '-' | ';' )* ;
+//protected QDSTRINGS : ( QDESCR | ( LPAR (WHSP)? QDESCR (options{greedy=true;}: (WHSP)? QDESCR )* (WHSP)? RPAR ) ) ;
+//protected QDSTRING : ( QUOTE DESCR QUOTE ) ;
+//protected NONQUOTE : (~'\'')* ;
+//protected OIDS : ( OID | ( LPAR (WHSP)? OID (options{greedy=true;}: (WHSP)? DOLLAR (WHSP)? OID )* (WHSP)? RPAR ) ) ;
+//protected OID : ( NUMERICOID | DESCR ) ;
+//protected NUMERICOID : ( ('0'..'9')+ ( '.' ('0'..'9')+ )+ ) ;
+
+
+
+
+class SchemaParser extends Parser;
+options {
+ k = 3 ;
+ defaultErrorHandler = false ;
+ //buildAST=true ;
+}
+
+{
+ public static final void main(String[] args) {
+ try {
+
+ //"( 11.222.333.4444 NAME ( 'test1' 'test2' ) DESC 'a b c' OBSOLETE SUP top ABSTRACT MUST ( cn ) may ( givenName $ sn) )"
+ //"( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC 'RFC2256: organizational unit this object belongs to' SUP name EQUALITY caseIgnoreMatch SYNTAX 1.2.3.4.5{32} COLLECTIVE USAGE userApplications )"
+ //"( 2.5.4.11 DESC 'a b c' )"
+ //"( 1.3.6.1.4.1.4203.1.2.1 NAME 'caseExactIA5SubstringsMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
+ //"( 2.5.13.0 NAME 'objectIdentifierMatch' APPLIES ( supportedApplicationContext $ supportedFeatures $ supportedExtension $ supportedControl ) )"
+ //"( 1.2.840.113548.3.1.4.11110 NAME 'ciscoccnatPAUserPIN' DESC 'User Defined Attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN ( 'Cisco AVVID' 'user defined' ) )"
+ SchemaLexer mainLexer = new SchemaLexer(new StringReader(
+"( 1.3.6.1.4.1.1466.115.121.1.48 NAME 'Supplier And Consumer' )"
+ ));
+
+ SchemaParser parser = new SchemaParser(mainLexer);
+ //ObjectClassDescription d = parser.objectClassDescription();
+ //AttributeTypeDescription d = parser.attributeTypeDescription();
+ LdapSyntaxDescription d = parser.syntaxDescription();
+ //MatchingRuleDescription d = parser.matchingRuleDescription();
+ //MatchingRuleUseDescription d = parser.matchingRuleUseDescription();
+ System.out.println(d.toString());
+ } catch(Exception e) {
+ System.err.println("exception: "+e);
+ e.printStackTrace();
+ }
+ }
+
+}
+
+
+objectClassDescription returns [ObjectClassDescription ocd = new ObjectClassDescription()]
+ :
+ ( oid:STARTNUMERICOID { ocd.setNumericOID(oid.getText()); } )
+ (
+ ( name:NAME { ocd.setNames(qdescrs(name.getText())); } )
+ |
+ ( desc:DESC { ocd.setDesc(qdstring(desc.getText())); } )
+ |
+ ( OBSOLETE { ocd.setObsolete( true ); } )
+ |
+ ( sup:SUP { ocd.setSuperiorObjectClassDescriptionNames(oids(sup.getText())); } )
+ |
+ ( ABSTRACT { ocd.setAbstract( true ); }
+ |
+ STRUCTURAL { ocd.setStructural( true ); }
+ |
+ AUXILIARY { ocd.setAuxiliary( true ); }
+ )
+ |
+ ( must:MUST { ocd.setMustAttributeTypeDescriptionNames(oids(must.getText())); } )
+ |
+ ( may:MAY { ocd.setMayAttributeTypeDescriptionNames(oids(may.getText())); } )
+ )*
+ RPAR
+ ;
+
+attributeTypeDescription returns [AttributeTypeDescription atd = new AttributeTypeDescription()]
+ :
+ ( oid:STARTNUMERICOID { atd.setNumericOID(oid.getText()); } )
+ (
+ ( name:NAME { atd.setNames(qdescrs(name.getText())); } )
+ |
+ ( desc:DESC { atd.setDesc(qdstring(desc.getText())); } )
+ |
+ ( OBSOLETE { atd.setObsolete( true ); } )
+ |
+ ( sup:SUP { atd.setSuperiorAttributeTypeDescriptionName(oid(sup.getText())); } )
+ |
+ ( equality:EQUALITY { atd.setEqualityMatchingRuleDescriptionOID(oid(equality.getText())); } )
+ |
+ ( ordering:ORDERING { atd.setOrderingMatchingRuleDescriptionOID(oid(ordering.getText())); } )
+ |
+ ( substr:SUBSTR { atd.setSubstringMatchingRuleDescriptionOID(oid(substr.getText())); } )
+ |
+ ( syntax:SYNTAX { atd.setSyntaxDescriptionNumericOIDPlusLength(qdstring(syntax.getText())); } )
+ |
+ ( SINGLE_VALUE { atd.setSingleValued( true ); } )
+ |
+ ( COLLECTIVE { atd.setCollective( true ); } )
+ |
+ ( NO_USER_MODIFICATION { atd.setNoUserModification( true ); } )
+ |
+ ( usage:USAGE { atd.setUsage(usage.getText()); } )
+ )*
+ RPAR
+ ;
+
+syntaxDescription returns [LdapSyntaxDescription lsd = new LdapSyntaxDescription()]
+ :
+ ( oid:STARTNUMERICOID { lsd.setNumericOID(oid.getText()); } )
+ (
+ ( desc:DESC { lsd.setDesc(qdstring(desc.getText())); } )
+ |
+ ( name:NAME { lsd.setDesc(qdstring(name.getText())); } )
+ )*
+ RPAR
+ ;
+
+matchingRuleDescription returns [MatchingRuleDescription mrd = new MatchingRuleDescription()]
+ :
+ ( oid:STARTNUMERICOID { mrd.setNumericOID(oid.getText()); } )
+ (
+ ( name:NAME { mrd.setNames(qdescrs(name.getText())); } )
+ |
+ ( desc:DESC { mrd.setDesc(qdstring(desc.getText())); } )
+ |
+ ( OBSOLETE { mrd.setObsolete( true ); } )
+ |
+ ( syntax:SYNTAX { mrd.setSyntaxDescriptionNumericOID(syntax.getText()); } )
+ )*
+ RPAR
+ ;
+
+matchingRuleUseDescription returns [MatchingRuleUseDescription mrud = new MatchingRuleUseDescription()]
+ :
+ ( oid:STARTNUMERICOID { mrud.setNumericOID(oid.getText()); } )
+ (
+ ( name:NAME { mrud.setNames(qdescrs(name.getText())); } )
+ |
+ ( desc:DESC { mrud.setDesc(qdstring(desc.getText())); } )
+ |
+ ( OBSOLETE { mrud.setObsolete( true ); } )
+ |
+ ( applies:APPLIES { mrud.setAppliesAttributeTypeDescriptionOIDs(oids(applies.getText())); } )
+ )*
+ RPAR
+ ;
+
+
+
+oid [String s] returns [String oid]
+ {
+ SchemaValueLexer lexer = new SchemaValueLexer(new StringReader(s));
+ SchemaValueParser parser = new SchemaValueParser(lexer);
+ oid = parser.oid();
+ }
+ :
+ ;
+
+oids [String s] returns [String[] oids]
+ {
+ SchemaValueLexer lexer = new SchemaValueLexer(new StringReader(s));
+ SchemaValueParser parser = new SchemaValueParser(lexer);
+ oids = parser.oids();
+ }
+ :
+ ;
+
+qdescrs [String s] returns [String[] qdescrs]
+ {
+ SchemaValueLexer lexer = new SchemaValueLexer(new StringReader(s));
+ SchemaValueParser parser = new SchemaValueParser(lexer);
+ qdescrs = parser.qdescrs();
+ }
+ :
+ ;
+
+qdstring [String s] returns [String qdstring]
+ {
+ if(s == null) {
+ qdstring = null;
+ }
+ else {
+ if(s.startsWith("'")) {
+ s = s.substring(1, s.length());
+ }
+ if(s.endsWith("'")) {
+ s = s.substring(0, s.length()-1);
+ }
+ qdstring = s;
+ }
+ }
+ :
+ ;
+
\ No newline at end of file
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schemavalue.g
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schemavalue.g?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schemavalue.g (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schemavalue.g Mon Dec 18 09:32:03 2006
@@ -0,0 +1,97 @@
+header {
+package org.apache.directory.ldapstudio.browser.core.model.schema.parser;
+
+import java.util.* ;
+
+}
+
+class SchemaValueLexer extends Lexer;
+
+options {
+ k = 2 ;
+ //importVocab=NonQuote ;
+ exportVocab=SchemaValue ;
+ charVocabulary = '\3'..'\377' ;
+ caseSensitive = false ;
+ //testLiterals = true ;
+ defaultErrorHandler = false ;
+}
+
+WHSP : ( ' ' ) {$setType(Token.SKIP);} ;
+
+LPAR : '(' ;
+RPAR : ')' ;
+
+QUOTE : '\'' ;
+DOLLAR : '$' ;
+LBRACKET : '{' ;
+RBRACKET : '}' ;
+LEN : LBRACKET (DIGIT)+ RBRACKET ;
+DIGIT : ('0'..'9') ;
+NUMERICOID : ('0'..'9')+ ( '.' ('0'..'9')+ )+ ;
+DESCR : ( 'a'..'z') ( 'a'..'z' | '0'..'9' | '-' | ';' | '.' )* ;
+
+
+
+class SchemaValueParser extends Parser;
+options {
+ k = 3 ;
+ defaultErrorHandler = false ;
+ //buildAST=true ;
+}
+
+
+oids returns [String[] oids]
+ {
+ oids = new String[0];
+ List oidList = new ArrayList();
+ String oid = null;
+ }
+ :
+ (
+ ( oid=oid { oidList.add(oid); } )
+ |
+ ( LPAR oid=oid { oidList.add(oid); } ( DOLLAR oid=oid { oidList.add(oid); } )* RPAR )
+ )
+ {
+ oids = (String[])oidList.toArray(new String[oidList.size()]);
+ }
+ ;
+
+
+oid returns [String oid=null]
+ :
+ (
+ n:NUMERICOID { oid = n.getText(); }
+ |
+ d:DESCR { oid = d.getText(); }
+ )
+ ;
+
+
+qdescrs returns [String[] qdescrs]
+ {
+ qdescrs = new String[0];
+ List qdescrList = new ArrayList();
+ String qdescr = null;
+ }
+ :
+ (
+ ( qdescr=qdescr { qdescrList.add(qdescr); } )
+ |
+ ( LPAR qdescr=qdescr { qdescrList.add(qdescr); } ( qdescr=qdescr { qdescrList.add(qdescr); } )* RPAR )
+ )
+ {
+ qdescrs = (String[])qdescrList.toArray(new String[qdescrList.size()]);
+ }
+ ;
+
+qdescr returns [String qdescr=null]
+ :
+ (
+ QUOTE d:DESCR { qdescr = d.getText(); } QUOTE
+ )
+ ;
+
+
+
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/AttributePropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/AttributePropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/AttributePropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/AttributePropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface AttributePropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/BookmarkPropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/BookmarkPropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/BookmarkPropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/BookmarkPropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface BookmarkPropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ConnectionPropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ConnectionPropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ConnectionPropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ConnectionPropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface ConnectionPropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/EntryPropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/EntryPropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/EntryPropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/EntryPropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface EntryPropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/SearchPropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/SearchPropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/SearchPropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/SearchPropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface SearchPropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ValuePropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ValuePropertyPageProvider.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ValuePropertyPageProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ValuePropertyPageProvider.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.propertypageproviders;
+
+
+public interface ValuePropertyPageProvider
+{
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdapFilterUtils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdapFilterUtils.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdapFilterUtils.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdapFilterUtils.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.utils;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+
+
+public class LdapFilterUtils
+{
+
+ public static String getFilter( IValue value )
+ {
+ if ( value.isString() )
+ {
+ return "(" + value.getAttribute().getDescription() + "=" + getEncodedValue( value.getStringValue() ) + ")";
+ }
+ else
+ {
+ StringBuffer filter = new StringBuffer();
+ filter.append( "(" );
+ filter.append( value.getAttribute().getDescription() );
+ filter.append( "=" );
+
+ byte[] bytes = value.getBinaryValue();
+ for ( int i = 0; i < bytes.length; i++ )
+ {
+ int b = ( int ) bytes[i];
+ if ( b < 0 )
+ b = 256 + b;
+ String s = Integer.toHexString( b );
+ filter.append( "\\" );
+ if ( s.length() == 1 )
+ filter.append( "0" );
+ filter.append( s );
+ }
+
+ filter.append( ")" );
+ return filter.toString();
+ }
+ }
+
+
+ /**
+ *
+ * From RFC2254:
+ *
+ * <pre>
+ * If a value should contain any of the following characters
+ * Character ASCII value
+ * ---------------------------
+ * * 0x2a
+ * ( 0x28
+ * ) 0x29
+ * \ 0x5c
+ * NUL 0x00
+ * the character must be encoded as the backslash '\' character (ASCII
+ * 0x5c) followed by the two hexadecimal digits representing the ASCII
+ * value of the encoded character. The case of the two hexadecimal
+ * digits is not significant.
+ * </pre>
+ */
+ public static String getEncodedValue( String value )
+ {
+ value = value.replaceAll( "\\\\", "\\\\5c" );
+ value = value.replaceAll( "" + '\u0000', "\\\\00" );
+ value = value.replaceAll( "\\*", "\\\\2a" );
+ value = value.replaceAll( "\\(", "\\\\28" );
+ value = value.replaceAll( "\\)", "\\\\29" );
+ return value;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdifUtils.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdifUtils.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdifUtils.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.utils;
+
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+
+
+public class LdifUtils
+{
+
+ public static byte[] utf8encode( String s )
+ {
+ try
+ {
+ return s.getBytes( "UTF-8" );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ return s.getBytes();
+ }
+ }
+
+
+ public static String urlEncode( String s )
+ {
+ try
+ {
+ return URLEncoder.encode( s, "UTF-8" );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ return s;
+ }
+ }
+
+
+ public static String base64encode( byte[] b )
+ {
+ return utf8decode( Base64.encodeBase64( b ) );
+ }
+
+
+ public static String hexEncode( byte[] data )
+ {
+ if ( data == null )
+ return null;
+
+ char[] c = Hex.encodeHex( data );
+ String s = new String( c );
+ return s;
+
+ // StringBuffer sb = new StringBuffer(data.length*3);
+ // for(int i=0; i<data.length; i++) {
+ // int b = (int)data[i];
+ // if(b<0) b=256+b;
+ // String s = Integer.toHexString(b)/*.toUpperCase()*/;
+ // if(s.length() ==1) s = "0" + s; //$NON-NLS-1$
+ // sb.append(s);
+ // if(i+1 < data.length)
+ // sb.append(' ');
+ // }
+ // return(sb.toString());
+ }
+
+
+ public static String utf8decode( byte[] b )
+ {
+ try
+ {
+ return new String( b, "UTF-8" );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ return new String( b );
+ }
+ }
+
+
+ public static byte[] base64decodeToByteArray( String s )
+ {
+ return Base64.decodeBase64( utf8encode( s ) );
+ }
+
+
+ public static boolean mustEncodeDN( String dn )
+ {
+ return mustEncode( dn );
+ }
+
+
+ public static boolean mustEncode( byte[] b )
+ {
+
+ if ( b == null || b.length < 1 )
+ {
+ return false;
+ }
+
+ if ( b[0] == ' ' || b[0] == ':' || b[0] == '<' )
+ {
+ return true;
+ }
+ if ( b[b.length - 1] == ' ' )
+ {
+ return true;
+ }
+
+ for ( int i = 0; i < b.length; i++ )
+ {
+ if ( b[i] == '\n' || b[i] == '\r' || b[i] == '\u0000' || b[i] > '\u007F' )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ public static boolean mustEncode( String value )
+ {
+
+ if ( value == null || value.length() < 1 )
+ {
+ return false;
+ }
+
+ if ( value.startsWith( " " ) || value.startsWith( ":" ) || value.startsWith( "<" ) )
+ {
+ return true;
+ }
+ if ( value.endsWith( " " ) )
+ {
+ return true;
+ }
+
+ for ( int i = 0; i < value.length(); i++ )
+ {
+ if ( value.charAt( i ) == '\r' || value.charAt( i ) == '\n' || value.charAt( i ) == '\u0000'
+ || value.charAt( i ) > '\u007F' )
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ public static String getStringValue( IValue value, int binaryEncoding )
+ {
+ String s;
+ byte[] binary = value.getBinaryValue();
+ if ( value.isBinary() && LdifUtils.mustEncode( binary ) )
+ {
+ if ( binaryEncoding == BrowserCoreConstants.BINARYENCODING_BASE64 )
+ {
+ s = LdifUtils.base64encode( binary );
+ }
+ else if ( binaryEncoding == BrowserCoreConstants.BINARYENCODING_HEX )
+ {
+ s = LdifUtils.hexEncode( binary );
+ }
+ else
+ {
+ s = BrowserCoreConstants.BINARY;
+ }
+
+ }
+ else
+ {
+ s = value.getStringValue();
+
+ }
+ return s;
+ }
+
+}
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/ModelConverter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/ModelConverter.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/ModelConverter.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/ModelConverter.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.ldapstudio.browser.core.utils;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Attribute;
+import org.apache.directory.ldapstudio.browser.core.internal.model.DummyEntry;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Value;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+import org.apache.directory.ldapstudio.browser.core.model.NameException;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.LdifPart;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifChangeAddRecord;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifChangeRecord;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContentRecord;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifRecord;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifAttrValLine;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifChangeTypeLine;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifCommentLine;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifControlLine;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifDnLine;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifSepLine;
+
+
+public class ModelConverter
+{
+
+ public static DummyEntry ldifContentRecordToEntry( LdifContentRecord ldifContentRecord, IConnection connection )
+ throws NameException, ModelModificationException
+ {
+ return createIntern( ldifContentRecord, connection );
+ }
+
+
+ public static DummyEntry ldifChangeAddRecordToEntry( LdifChangeAddRecord ldifChangeAddRecord, IConnection connection )
+ throws NameException, ModelModificationException
+ {
+ return createIntern( ldifChangeAddRecord, connection );
+ }
+
+
+ private static DummyEntry createIntern( LdifRecord ldifRecord, IConnection connection ) throws NameException,
+ ModelModificationException
+ {
+
+ LdifPart[] parts = ldifRecord.getParts();
+
+ EventRegistry.suspendEventFireingInCurrentThread();
+
+ DummyEntry entry = new DummyEntry( new DN( ldifRecord.getDnLine().getValueAsString() ), connection );
+
+ for ( int i = 0; i < parts.length; i++ )
+ {
+ if ( parts[i] instanceof LdifAttrValLine )
+ {
+ LdifAttrValLine line = ( LdifAttrValLine ) parts[i];
+ String attributeName = line.getUnfoldedAttributeDescription();
+ Object value = line.getValueAsObject();
+ IAttribute attribute = entry.getAttribute( attributeName );
+ if ( attribute == null )
+ {
+ attribute = new Attribute( entry, attributeName );
+ entry.addAttribute( attribute, null );
+ }
+ attribute.addValue( new Value( attribute, value ), null );
+ }
+ else if ( !( parts[i] instanceof LdifDnLine ) && !( parts[i] instanceof LdifSepLine ) )
+ {
+ String name = parts[i].toRawString();
+ name = name.replaceAll( "\n", "" );
+ name = name.replaceAll( "\r", "" );
+ IAttribute attribute = new Attribute( entry, name );
+ attribute.addValue( new Value( attribute, parts[i] ), null );
+ entry.addAttribute( attribute, null );
+ // IAttribute attribute = entry.getAttribute("");
+ // if(attribute == null) {
+ // attribute = new Attribute(entry, "");
+ // entry.addAttribute(attribute, null);
+ // }
+ // attribute.addValue(new Value(attribute, parts[i]), null);
+ }
+ }
+
+ EventRegistry.resumeEventFireingInCurrentThread();
+
+ return entry;
+ }
+
+
+ public static LdifChangeAddRecord entryToLdifChangeAddRecord( IEntry entry )
+ {
+
+ boolean mustCreateChangeTypeLine = true;
+ IAttribute[] attributes = entry.getAttributes();
+ for ( int i = 0; i < attributes.length; i++ )
+ {
+ IValue[] values = attributes[i].getValues();
+ for ( int ii = 0; ii < values.length; ii++ )
+ {
+ IValue value = values[ii];
+ if ( value.getRawValue() instanceof LdifPart )
+ {
+ mustCreateChangeTypeLine = false;
+ }
+ }
+ }
+
+ // LdifChangeAddRecord record =
+ // LdifChangeAddRecord.create(entry.getDn().toString());
+ LdifChangeAddRecord record = new LdifChangeAddRecord( LdifDnLine.create( entry.getDn().toString() ) );
+ if ( mustCreateChangeTypeLine )
+ {
+ addControls( record, entry );
+ record.setChangeType( LdifChangeTypeLine.createAdd() );
+ }
+
+ for ( int i = 0; i < attributes.length; i++ )
+ {
+ String name = attributes[i].getDescription();
+ IValue[] values = attributes[i].getValues();
+ for ( int ii = 0; ii < values.length; ii++ )
+ {
+ IValue value = values[ii];
+ if ( value.getRawValue() instanceof LdifPart )
+ {
+ LdifPart part = ( LdifPart ) value.getRawValue();
+ if ( part instanceof LdifChangeTypeLine )
+ {
+ record.setChangeType( ( LdifChangeTypeLine ) part );
+ }
+ else if ( part instanceof LdifCommentLine )
+ {
+ record.addComment( ( LdifCommentLine ) part );
+ }
+ else if ( part instanceof LdifControlLine )
+ {
+ record.addControl( ( LdifControlLine ) part );
+ }
+ }
+ else if ( value.isString() )
+ {
+ record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
+ }
+ else
+ {
+ record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
+ }
+ }
+ }
+
+ record.finish( LdifSepLine.create() );
+
+ return record;
+ }
+
+
+ public static LdifContentRecord entryToLdifContentRecord( IEntry entry )
+ {
+
+ LdifContentRecord record = LdifContentRecord.create( entry.getDn().toString() );
+
+ IAttribute[] attributes = entry.getAttributes();
+ for ( int i = 0; i < attributes.length; i++ )
+ {
+ String name = attributes[i].getDescription();
+ IValue[] values = attributes[i].getValues();
+ for ( int ii = 0; ii < values.length; ii++ )
+ {
+ IValue value = values[ii];
+ if ( value.getRawValue() instanceof LdifPart )
+ {
+ LdifPart part = ( LdifPart ) value.getRawValue();
+ if ( part instanceof LdifCommentLine )
+ {
+ record.addComment( ( LdifCommentLine ) part );
+ }
+ }
+ else if ( value.isString() )
+ {
+ record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
+ }
+ else
+ {
+ record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
+ }
+ }
+ }
+
+ record.finish( LdifSepLine.create() );
+
+ return record;
+ }
+
+
+ public static LdifAttrValLine valueToLdifAttrValLine( IValue value )
+ {
+
+ LdifAttrValLine line;
+ if ( value.isString() )
+ {
+ line = LdifAttrValLine.create( value.getAttribute().getDescription(), value.getStringValue() );
+ }
+ else
+ {
+ line = LdifAttrValLine.create( value.getAttribute().getDescription(), value.getBinaryValue() );
+ }
+ return line;
+ }
+
+
+ public static IValue ldifAttrValLineToValue( LdifAttrValLine line, IEntry entry )
+ {
+ try
+ {
+ IAttribute attribute = new Attribute( entry, line.getUnfoldedAttributeDescription() );
+ IValue value = new Value( attribute, line.getValueAsObject() );
+ return value;
+ }
+ catch ( Exception e )
+ {
+ return null;
+ }
+ }
+
+
+ public static LdifDnLine dnToLdifDnLine( DN dn )
+ {
+ LdifDnLine line = LdifDnLine.create( dn.toString() );
+ return line;
+ }
+
+
+ public static void addControls( LdifChangeRecord cr, IEntry entry )
+ {
+ if ( entry.isReferral() )
+ {
+ cr.addControl( LdifControlLine.create( IConnection.CONTROL_MANAGEDSAIT, null, ( String ) null ) );
+ }
+ }
+
+}