directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r596115 - in /directory/studio/trunk/studio-ldif-parser: ./ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/main/java/org/apache/directory/studio/ldapbrowser/ s...
Date Sun, 18 Nov 2007 19:16:30 GMT
Author: seelmann
Date: Sun Nov 18 11:16:26 2007
New Revision: 596115

URL: http://svn.apache.org/viewvc?rev=596115&view=rev
Log:
Moved LDIF parser sources from studio-ldapbrowser-core to studio-ldif-parser.

Added:
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java
      - copied, changed from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java
      - copied, changed from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java
      - copied, changed from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java   (with props)
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java
      - copied, changed from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java
      - copied, changed from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/
      - copied from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/
      - copied from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/
      - copied from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java   (with props)
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java   (with props)
Modified:
    directory/studio/trunk/studio-ldif-parser/   (props changed)
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifContainer.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java
    directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/LdifParser.java

Propchange: directory/studio/trunk/studio-ldif-parser/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov 18 11:16:26 2007
@@ -0,0 +1,3 @@
+lib
+
+target

Copied: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java (from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java?p2=directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java&r1=596113&r2=596115&rev=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEOFPart.java Sun Nov 18 11:16:26 2007
@@ -58,7 +58,7 @@
     }
 
 
-    public final String toFormattedString()
+    public final String toFormattedString( LdifFormatParameters formatParameters )
     {
         return "";
     }

Copied: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java (from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java?p2=directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java&r1=596113&r2=596115&rev=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifEnumeration.java Sun Nov 18 11:16:26 2007
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif;
 
 
-import org.apache.directory.studio.connection.core.StudioProgressMonitor;
-import org.apache.directory.studio.ldapbrowser.core.model.ConnectionException;
+import java.util.Iterator;
+
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifContainer;
 
 
@@ -30,25 +30,15 @@
 {
 
     /**
-     * 
-     * @param monitor
-     *                The monitor to check for cancellation. Don't report
-     *                errors to the monitor, throw an ConnectionException
-     *                instead.
-     * @throws ConnectionException
+     * @return true if this enumeration has more elements.
      */
-    public boolean hasNext( StudioProgressMonitor monitor ) throws ConnectionException;
+    public boolean hasNext() throws Exception;
 
 
     /**
      * 
-     * @param monitor
-     *                The monitor to check for cancellation. Don't report
-     *                errors to the monitor, throw an ConnectionException
-     *                instead.
-     * @return the next LDIF container or null if hasNext() returns false;
-     * @throws ConnectionException
+     * @return the next LDIF container or null if hasNext() returns false.
      */
-    public LdifContainer next( StudioProgressMonitor monitor ) throws ConnectionException;
+    public LdifContainer next() throws Exception;
 
 }

Copied: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java (from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java?p2=directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java&r1=596113&r2=596115&rev=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFile.java Sun Nov 18 11:16:26 2007
@@ -145,14 +145,14 @@
     }
 
 
-    public String toFormattedString()
+    public String toFormattedString( LdifFormatParameters formatParameters )
     {
         StringBuffer sb = new StringBuffer();
 
         LdifContainer[] containers = this.getContainers();
         for ( int i = 0; i < containers.length; i++ )
         {
-            sb.append( containers[i].toFormattedString() );
+            sb.append( containers[i].toFormattedString( formatParameters ) );
         }
 
         return sb.toString();

Added: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java?rev=596115&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java (added)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java Sun Nov 18 11:16:26 2007
@@ -0,0 +1,96 @@
+/*
+ *  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.studio.ldapbrowser.core.model.ldif;
+
+
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
+
+
+public class LdifFormatParameters
+{
+
+    /** The default LDIF format parameters */
+    public static final LdifFormatParameters DEFAULT = new LdifFormatParameters();
+
+    private boolean spaceAfterColon;
+    private int lineWidth;
+    private String lineSeparator;
+
+
+    /**
+     * Creates a new instance of LdifFormatParameters with the following parameters:
+     * <ul>
+     * <li>Space after colon
+     * <li>Line width 78
+     * <li>The system specific line separator
+     * </ul>
+     */
+    private LdifFormatParameters()
+    {
+        this.spaceAfterColon = true;
+        this.lineWidth = LdifParserConstants.LINE_WIDTH;
+        this.lineSeparator = LdifParserConstants.LINE_SEPARATOR;
+    }
+
+
+    public LdifFormatParameters( boolean spaceAfterColon, int lineWidth, String lineSeparator )
+    {
+        this.spaceAfterColon = spaceAfterColon;
+        this.lineWidth = lineWidth;
+        this.lineSeparator = lineSeparator;
+    }
+
+
+    public boolean isSpaceAfterColon()
+    {
+        return spaceAfterColon;
+    }
+
+
+    public void setSpaceAfterColon( boolean spaceAfterColon )
+    {
+        this.spaceAfterColon = spaceAfterColon;
+    }
+
+
+    public int getLineWidth()
+    {
+        return lineWidth;
+    }
+
+
+    public void setLineWidth( int lineWidth )
+    {
+        this.lineWidth = lineWidth;
+    }
+
+
+    public String getLineSeparator()
+    {
+        return lineSeparator;
+    }
+
+
+    public void setLineSeparator( String lineSeparator )
+    {
+        this.lineSeparator = lineSeparator;
+    }
+
+}

Propchange: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifFormatParameters.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java (from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java?p2=directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java&r1=596113&r2=596115&rev=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifInvalidPart.java Sun Nov 18 11:16:26 2007
@@ -61,7 +61,7 @@
     }
 
 
-    public final String toFormattedString()
+    public final String toFormattedString( LdifFormatParameters formatParameters )
     {
         return this.unknown;
     }

Copied: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java (from r596113, directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java?p2=directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java&p1=directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java&r1=596113&r2=596115&rev=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/LdifPart.java Sun Nov 18 11:16:26 2007
@@ -42,7 +42,7 @@
     public String toRawString();
 
 
-    public String toFormattedString();
+    public String toFormattedString( LdifFormatParameters formatParameters );
 
 
     public void adjustOffset( int adjust );

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifContainer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifContainer.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifContainer.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifContainer.java Sun Nov 18 11:16:26 2007
@@ -26,10 +26,11 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFormatParameters;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifInvalidPart;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifPart;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifLineBase;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public abstract class LdifContainer implements Serializable
@@ -91,14 +92,14 @@
 
         sb.append( getClass().getName() );
         sb.append( ":" );
-        sb.append( BrowserCoreConstants.LINE_SEPARATOR );
+        sb.append( LdifParserConstants.LINE_SEPARATOR );
 
         LdifPart[] parts = this.getParts();
         for ( int i = 0; i < parts.length; i++ )
         {
             sb.append( "    " );
             sb.append( parts[i].toString() );
-            sb.append( BrowserCoreConstants.LINE_SEPARATOR );
+            sb.append( LdifParserConstants.LINE_SEPARATOR );
         }
 
         return sb.toString();
@@ -119,14 +120,14 @@
     }
 
 
-    public final String toFormattedString()
+    public final String toFormattedString( LdifFormatParameters formatParameters )
     {
         StringBuffer sb = new StringBuffer();
 
         LdifPart[] parts = this.getParts();
         for ( int i = 0; i < parts.length; i++ )
         {
-            sb.append( parts[i].toFormattedString() );
+            sb.append( parts[i].toFormattedString( formatParameters ) );
         }
 
         return sb.toString();

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java Sun Nov 18 11:16:26 2007
@@ -23,8 +23,8 @@
 
 import java.io.Serializable;
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifAttrValLine extends LdifValueLineBase implements Serializable
@@ -83,14 +83,14 @@
         }
         else
         {
-            return new LdifAttrValLine( 0, name, ":", value, BrowserCoreConstants.LINE_SEPARATOR );
+            return new LdifAttrValLine( 0, name, ":", value, LdifParserConstants.LINE_SEPARATOR );
         }
     }
 
 
     public static LdifAttrValLine create( String name, byte[] value )
     {
-        return new LdifAttrValLine( 0, name, "::", LdifUtils.base64encode( value ), BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifAttrValLine( 0, name, "::", LdifUtils.base64encode( value ), LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifChangeTypeLine extends LdifValueLineBase
@@ -121,31 +121,31 @@
 
     public static LdifChangeTypeLine createDelete()
     {
-        return new LdifChangeTypeLine( 0, "changetype", ":", "delete", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifChangeTypeLine( 0, "changetype", ":", "delete", LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifChangeTypeLine createAdd()
     {
-        return new LdifChangeTypeLine( 0, "changetype", ":", "add", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifChangeTypeLine( 0, "changetype", ":", "add", LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifChangeTypeLine createModify()
     {
-        return new LdifChangeTypeLine( 0, "changetype", ":", "modify", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifChangeTypeLine( 0, "changetype", ":", "modify", LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifChangeTypeLine createModDn()
     {
-        return new LdifChangeTypeLine( 0, "changetype", ":", "moddn", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifChangeTypeLine( 0, "changetype", ":", "moddn", LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifChangeTypeLine createModRdn()
     {
-        return new LdifChangeTypeLine( 0, "changetype", ":", "modrdn", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifChangeTypeLine( 0, "changetype", ":", "modrdn", LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifCommentLine extends LdifNonEmptyLineBase
@@ -73,7 +73,7 @@
 
     public static LdifCommentLine create( String comment )
     {
-        return new LdifCommentLine( 0, comment, BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifCommentLine( 0, comment, LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java Sun Nov 18 11:16:26 2007
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifControlLine extends LdifValueLineBase
@@ -232,7 +232,7 @@
         {
             LdifControlLine controlLine = new LdifControlLine( 0, "control", ":", oid, criticality,
                 controlValue != null ? ":" : null, controlValue != null ? controlValue : null,
-                BrowserCoreConstants.LINE_SEPARATOR );
+                    LdifParserConstants.LINE_SEPARATOR );
             return controlLine;
         }
     }
@@ -242,7 +242,7 @@
     {
         LdifControlLine controlLine = new LdifControlLine( 0, "control", ":", oid, criticality, controlValue != null
             && controlValue.length > 0 ? "::" : null, controlValue != null && controlValue.length > 0 ? LdifUtils
-            .base64encode( controlValue ) : null, BrowserCoreConstants.LINE_SEPARATOR );
+            .base64encode( controlValue ) : null, LdifParserConstants.LINE_SEPARATOR );
         return controlLine;
     }
 

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifDeloldrdnLine extends LdifValueLineBase
@@ -106,13 +106,13 @@
 
     public static LdifDeloldrdnLine create0()
     {
-        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "0", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "0", LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifDeloldrdnLine create1()
     {
-        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "1", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "1", LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java Sun Nov 18 11:16:26 2007
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifDnLine extends LdifValueLineBase
@@ -100,11 +100,11 @@
         if ( LdifUtils.mustEncode( dn ) )
         {
             return new LdifDnLine( 0, "dn", "::", LdifUtils.base64encode( LdifUtils.utf8encode( dn ) ),
-                BrowserCoreConstants.LINE_SEPARATOR );
+                LdifParserConstants.LINE_SEPARATOR );
         }
         else
         {
-            return new LdifDnLine( 0, "dn", ":", dn, BrowserCoreConstants.LINE_SEPARATOR );
+            return new LdifDnLine( 0, "dn", ":", dn, LdifParserConstants.LINE_SEPARATOR );
         }
     }
 

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java Sun Nov 18 11:16:26 2007
@@ -21,10 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
-import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFormatParameters;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifPart;
-import org.eclipse.core.runtime.Preferences;
 
 
 /**
@@ -108,13 +106,8 @@
     }
 
 
-    public final String toFormattedString()
+    public final String toFormattedString( LdifFormatParameters formatParameters )
     {
-
-        Preferences store = BrowserCorePlugin.getDefault().getPluginPreferences();
-        boolean spaceAfterColon = store.getBoolean( BrowserCoreConstants.PREFERENCE_LDIF_SPACE_AFTER_COLON );
-        String lineSeparator = store.getString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR );
-
         String raw = toRawString();
         String unfolded = unfold( raw );
 
@@ -122,15 +115,15 @@
         {
             if ( unfolded.indexOf( "::" ) > -1 )
             {
-                unfolded = unfolded.replaceFirst( "::[ ]*", spaceAfterColon ? ":: " : "::" );
+                unfolded = unfolded.replaceFirst( "::[ ]*", formatParameters.isSpaceAfterColon() ? ":: " : "::" );
             }
             else if ( unfolded.indexOf( ":<" ) > -1 )
             {
-                unfolded = unfolded.replaceFirst( ":<[ ]*", spaceAfterColon ? ":< " : ":<" );
+                unfolded = unfolded.replaceFirst( ":<[ ]*", formatParameters.isSpaceAfterColon() ? ":< " : ":<" );
             }
             else if ( unfolded.indexOf( ":" ) > -1 )
             {
-                unfolded = unfolded.replaceFirst( ":[ ]*", spaceAfterColon ? ": " : ":" );
+                unfolded = unfolded.replaceFirst( ":[ ]*", formatParameters.isSpaceAfterColon() ? ": " : ":" );
             }
         }
 
@@ -140,13 +133,13 @@
             if ( index > -1 )
             {
                 unfolded = unfolded.substring( 0, unfolded.length() - rawNewLine.length() );
-                unfolded = unfolded + lineSeparator;
+                unfolded = unfolded + formatParameters.getLineSeparator();
             }
         }
 
         if ( this instanceof LdifValueLineBase )
         {
-            return fold( unfolded, 0 );
+            return fold( unfolded, 0, formatParameters );
         }
         else
         {
@@ -180,21 +173,17 @@
     }
 
 
-    protected static String fold( String value, int indent )
+    protected static String fold( String value, int indent, LdifFormatParameters formatParameters )
     {
-        Preferences store = BrowserCorePlugin.getDefault().getPluginPreferences();
-        int lineWidth = store.getInt( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH );
-        String lineSeparator = store.getString( BrowserCoreConstants.PREFERENCE_LDIF_LINE_SEPARATOR );
-
         StringBuffer formattedLdif = new StringBuffer();
-        int offset = lineWidth - indent;
+        int offset = formatParameters.getLineWidth() - indent;
         int endIndex = 0 + offset;
-        while ( endIndex + lineSeparator.length() < value.length() )
+        while ( endIndex + formatParameters.getLineSeparator().length() < value.length() )
         {
             formattedLdif.append( value.substring( endIndex - offset, endIndex ) );
-            formattedLdif.append( lineSeparator );
+            formattedLdif.append( formatParameters.getLineSeparator() );
             formattedLdif.append( ' ' );
-            offset = lineWidth - 1;
+            offset = formatParameters.getLineWidth() - 1;
             endIndex += offset;
         }
         String rest = value.substring( endIndex - offset, value.length() );

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifModSpecSepLine extends LdifNonEmptyLineBase
@@ -80,7 +80,7 @@
 
     public static LdifModSpecSepLine create()
     {
-        return new LdifModSpecSepLine( 0, "-", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifModSpecSepLine( 0, "-", LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifModSpecTypeLine extends LdifValueLineBase
@@ -119,19 +119,19 @@
 
     public static LdifModSpecTypeLine createAdd( String attributeName )
     {
-        return new LdifModSpecTypeLine( 0, "add", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifModSpecTypeLine( 0, "add", ":", attributeName, LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifModSpecTypeLine createReplace( String attributeName )
     {
-        return new LdifModSpecTypeLine( 0, "replace", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifModSpecTypeLine( 0, "replace", ":", attributeName, LdifParserConstants.LINE_SEPARATOR );
     }
 
 
     public static LdifModSpecTypeLine createDelete( String attributeName )
     {
-        return new LdifModSpecTypeLine( 0, "delete", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifModSpecTypeLine( 0, "delete", ":", attributeName, LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java Sun Nov 18 11:16:26 2007
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifNewrdnLine extends LdifValueLineBase
@@ -100,11 +100,11 @@
         if ( LdifUtils.mustEncode( newrdn ) )
         {
             return new LdifNewrdnLine( 0, "newrdn", "::", LdifUtils.base64encode( LdifUtils.utf8encode( newrdn ) ),
-                BrowserCoreConstants.LINE_SEPARATOR );
+                LdifParserConstants.LINE_SEPARATOR );
         }
         else
         {
-            return new LdifNewrdnLine( 0, "newrdn", ":", newrdn, BrowserCoreConstants.LINE_SEPARATOR );
+            return new LdifNewrdnLine( 0, "newrdn", ":", newrdn, LdifParserConstants.LINE_SEPARATOR );
         }
 
     }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java Sun Nov 18 11:16:26 2007
@@ -21,8 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifNewsuperiorLine extends LdifValueLineBase
@@ -101,11 +101,11 @@
         if ( LdifUtils.mustEncode( newsuperior ) )
         {
             return new LdifNewsuperiorLine( 0, "newsuperior", "::", LdifUtils.base64encode( LdifUtils
-                .utf8encode( newsuperior ) ), BrowserCoreConstants.LINE_SEPARATOR );
+                .utf8encode( newsuperior ) ), LdifParserConstants.LINE_SEPARATOR );
         }
         else
         {
-            return new LdifNewsuperiorLine( 0, "newsuperior", ":", newsuperior, BrowserCoreConstants.LINE_SEPARATOR );
+            return new LdifNewsuperiorLine( 0, "newsuperior", ":", newsuperior, LdifParserConstants.LINE_SEPARATOR );
         }
 
     }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifSepLine extends LdifLineBase
@@ -43,7 +43,7 @@
 
     public static LdifSepLine create()
     {
-        return new LdifSepLine( 0, BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifSepLine( 0, LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java Sun Nov 18 11:16:26 2007
@@ -21,7 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.core.model.ldif.lines;
 
 
-import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldifparser.LdifParserConstants;
 
 
 public class LdifVersionLine extends LdifValueLineBase
@@ -96,7 +96,7 @@
 
     public static LdifVersionLine create()
     {
-        return new LdifVersionLine( 0, "version", ":", "1", BrowserCoreConstants.LINE_SEPARATOR );
+        return new LdifVersionLine( 0, "version", ":", "1", LdifParserConstants.LINE_SEPARATOR );
     }
 
 }

Modified: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/LdifParser.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/LdifParser.java?rev=596115&r1=596113&r2=596115&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/LdifParser.java (original)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/parser/LdifParser.java Sun Nov 18 11:16:26 2007
@@ -28,8 +28,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.directory.studio.connection.core.StudioProgressMonitor;
-import org.apache.directory.studio.ldapbrowser.core.model.ConnectionException;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifEOFPart;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifEnumeration;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile;
@@ -76,23 +74,19 @@
 
     public LdifFile parse( String ldif )
     {
-
         LdifFile model = new LdifFile();
-
+        LdifEnumeration enumeration = this.parse( new StringReader( ldif ) );
         try
         {
-            LdifEnumeration enumeration = this.parse( new StringReader( ldif ) );
-            while ( enumeration.hasNext( null ) )
+            while ( enumeration.hasNext() )
             {
-                LdifContainer container = enumeration.next( null );
+                LdifContainer container = enumeration.next();
                 model.addContainer( container );
             }
         }
-        catch ( ConnectionException e )
+        catch ( Exception e )
         {
-            // doesn't occur on the internal LdifEnumeration implementation
         }
-
         return model;
     }
 
@@ -114,7 +108,7 @@
             private boolean footerParsed = false;
 
 
-            public boolean hasNext( StudioProgressMonitor monitor )
+            public boolean hasNext()
             {
                 if ( containerList.isEmpty() )
                 {
@@ -168,9 +162,9 @@
             }
 
 
-            public LdifContainer next( StudioProgressMonitor monitor )
+            public LdifContainer next()
             {
-                if ( hasNext( monitor ) )
+                if ( hasNext() )
                 {
                     return ( LdifContainer ) this.containerList.remove( 0 );
                 }

Added: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java?rev=596115&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java (added)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java Sun Nov 18 11:16:26 2007
@@ -0,0 +1,207 @@
+/*
+ *  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.studio.ldapbrowser.core.utils;
+
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.binary.Hex;
+
+
+/**
+ * Utilities for LDAP related encoding and decoding.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdifUtils
+{
+
+
+    /**
+     * Encodes the given string to UTF-8
+     *
+     * @param s the string to encode
+     *
+     * @return the byte[] the encoded value
+     */
+    public static byte[] utf8encode( String s )
+    {
+        try
+        {
+            return s.getBytes( "UTF-8" );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            return s.getBytes();
+        }
+    }
+
+
+    /**
+     * Encodes the given string into URL format.
+     *
+     * @param s the string to encode
+     *
+     * @return the string the URL encoded string
+     */
+    public static String urlEncode( String s )
+    {
+        try
+        {
+            return URLEncoder.encode( s, "UTF-8" );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            return s;
+        }
+    }
+
+
+    /**
+     * Encodes the given byte array using BASE-64 encoding.
+     *
+     * @param b the b the byte array to encode
+     *
+     * @return the BASE-64 encoded string
+     */
+    public static String base64encode( byte[] b )
+    {
+        return utf8decode( Base64.encodeBase64( b ) );
+    }
+
+
+    /**
+     * Encodes the given byte array to a sequence of
+     * its hex values.
+     *
+     * @param data the data to encode
+     * @return the HEX encoded string
+     */
+    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());
+    }
+
+
+    /**
+     * Decodes the given UTF-8 byte array to an string.
+     *
+     * @param b the b the byte array to decode
+     *
+     * @return the decoded string
+     */
+    public static String utf8decode( byte[] b )
+    {
+        try
+        {
+            return new String( b, "UTF-8" );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            return new String( b );
+        }
+    }
+
+
+    /**
+     * Decodes the given BASE-64 encoded string to its
+     * bytes presentation.
+     *
+     * @param s the s the BASE-64 encoded string
+     *
+     * @return the byte[] the decoded byte array
+     */
+    public static byte[] base64decodeToByteArray( String s )
+    {
+        return Base64.decodeBase64( utf8encode( s ) );
+    }
+
+
+    /**
+     * Checks if the given distinguished name must be encoded.
+     *
+     * @param dn the dn to check
+     *
+     * @return true, if must encode DN
+     */
+    public static boolean mustEncodeDN( String dn )
+    {
+        return mustEncode( dn );
+    }
+
+
+    /**
+     * Checks if the given string must be encoded to be
+     * used in an LDIF.
+     *
+     * @param value the value to check
+     *
+     * @return true, if must encode
+     */
+    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;
+    }
+
+}

Propchange: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/LdifUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java?rev=596115&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java (added)
+++ directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java Sun Nov 18 11:16:26 2007
@@ -0,0 +1,40 @@
+/*
+ *  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.studio.ldifparser;
+
+
+/**
+ * Constants for the LDIF Parser.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface LdifParserConstants
+{
+
+    /** The system specific line separator. */
+    public static final String LINE_SEPARATOR = System.getProperty( "line.separator" ); //$NON-NLS-1$
+    
+    /** The default line width, value is 78. */
+    public static final int LINE_WIDTH = 78;
+
+    
+}

Propchange: directory/studio/trunk/studio-ldif-parser/src/main/java/org/apache/directory/studio/ldifparser/LdifParserConstants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message