directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592082 [14/20] - in /directory/sandbox/felixk/studio-ldapbrowser-core: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ s...
Date Mon, 05 Nov 2007 16:52:07 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifEOFContainer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifEOFContainer.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifEOFContainer.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifEOFContainer.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,49 @@
+/*
+ *  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.container;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifEOFPart;
+
+
+public class LdifEOFContainer extends LdifContainer
+{
+
+    private static final long serialVersionUID = -570235244832982061L;
+
+
+    protected LdifEOFContainer()
+    {
+    }
+
+
+    public LdifEOFContainer( LdifEOFPart eofPart )
+    {
+        super( eofPart );
+    }
+
+
+    public boolean isValid()
+    {
+        return getLastPart() instanceof LdifEOFPart;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifEOFContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifInvalidContainer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifInvalidContainer.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifInvalidContainer.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifInvalidContainer.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,49 @@
+/*
+ *  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.container;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifInvalidPart;
+
+
+public class LdifInvalidContainer extends LdifContainer
+{
+
+    private static final long serialVersionUID = -6967822536130425931L;
+
+
+    protected LdifInvalidContainer()
+    {
+    }
+
+
+    public LdifInvalidContainer( LdifInvalidPart invalid )
+    {
+        super( invalid );
+    }
+
+
+    public boolean isValid()
+    {
+        return false;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifInvalidContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifModSpec.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifModSpec.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifModSpec.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifModSpec.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,208 @@
+/*
+ *  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.container;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifPart;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifModSpecSepLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifModSpecTypeLine;
+
+
+public class LdifModSpec extends LdifContainer implements LdifPart
+{
+
+    private static final long serialVersionUID = 6708749639253050273L;
+
+
+    protected LdifModSpec()
+    {
+    }
+
+
+    public LdifModSpec( LdifModSpecTypeLine modSpecTypeLine )
+    {
+        super( modSpecTypeLine );
+    }
+
+
+    public void addAttrVal( LdifAttrValLine attrVal )
+    {
+        if ( attrVal == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( attrVal );
+    }
+
+
+    public void finish( LdifModSpecSepLine modSpecSepLine )
+    {
+        if ( modSpecSepLine == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( modSpecSepLine );
+    }
+
+
+    public LdifModSpecTypeLine getModSpecType()
+    {
+        return ( LdifModSpecTypeLine ) this.parts.get( 0 );
+    }
+
+
+    public LdifAttrValLine[] getAttrVals()
+    {
+        List l = new ArrayList();
+        for ( Iterator it = this.parts.iterator(); it.hasNext(); )
+        {
+            Object o = it.next();
+            if ( o instanceof LdifAttrValLine )
+            {
+                l.add( o );
+            }
+        }
+        return ( LdifAttrValLine[] ) l.toArray( new LdifAttrValLine[l.size()] );
+    }
+
+
+    public LdifModSpecSepLine getModSpecSep()
+    {
+        if ( getLastPart() instanceof LdifModSpecSepLine )
+        {
+            return ( LdifModSpecSepLine ) getLastPart();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public boolean isAdd()
+    {
+        return this.getModSpecType().isAdd();
+    }
+
+
+    public boolean isReplace()
+    {
+        return this.getModSpecType().isReplace();
+    }
+
+
+    public boolean isDelete()
+    {
+        return this.getModSpecType().isDelete();
+    }
+
+
+    public static LdifModSpec createAdd( String attributeName )
+    {
+        return new LdifModSpec( LdifModSpecTypeLine.createAdd( attributeName ) );
+    }
+
+
+    public static LdifModSpec createReplace( String attributeName )
+    {
+        return new LdifModSpec( LdifModSpecTypeLine.createReplace( attributeName ) );
+    }
+
+
+    public static LdifModSpec createDelete( String attributeName )
+    {
+        return new LdifModSpec( LdifModSpecTypeLine.createDelete( attributeName ) );
+    }
+
+
+    public boolean isValid()
+    {
+        if ( !super.isAbstractValid() )
+        {
+            return false;
+        }
+
+        if ( this.getModSpecType() == null )
+        {
+            return false;
+        }
+
+        LdifAttrValLine[] attrVals = this.getAttrVals();
+        if ( attrVals.length > 0 )
+        {
+            String att = this.getModSpecType().getUnfoldedAttributeDescription();
+            for ( int i = 0; i < attrVals.length; i++ )
+            {
+                if ( !att.equals( attrVals[i].getUnfoldedAttributeDescription() ) )
+                {
+                    return false;
+                }
+            }
+        }
+
+        if ( isAdd() )
+        {
+            return attrVals.length > 0;
+        }
+        else if ( isDelete() )
+        {
+            return true;
+        }
+        else if ( isReplace() )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getModSpecType() == null )
+        {
+            return "Missing mod spec line ";
+        }
+        else if ( isAdd() && this.getAttrVals().length == 0 )
+        {
+            return "Modification must contain attribute value lines ";
+        }
+
+        LdifAttrValLine[] attrVals = this.getAttrVals();
+        if ( attrVals.length > 0 )
+        {
+            String att = this.getModSpecType().getUnfoldedAttributeDescription();
+            for ( int i = 0; i < attrVals.length; i++ )
+            {
+                if ( !att.equals( attrVals[i].getUnfoldedAttributeDescription() ) )
+                {
+                    return "Attribute descriptions don't match";
+                }
+            }
+        }
+
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifModSpec.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifRecord.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifRecord.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifRecord.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifRecord.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,123 @@
+/*
+ *  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.container;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifEOFPart;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifPart;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifCommentLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifDnLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifSepLine;
+
+
+public abstract class LdifRecord extends LdifContainer
+{
+
+    protected LdifRecord()
+    {
+    }
+
+
+    protected LdifRecord( LdifDnLine dn )
+    {
+        super( dn );
+    }
+
+
+    public void addComment( LdifCommentLine comment )
+    {
+        if ( comment == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( comment );
+    }
+
+
+    public void finish( LdifSepLine sep )
+    {
+        if ( sep == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( sep );
+    }
+
+
+    public void finish( LdifEOFPart eof )
+    {
+        if ( eof == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( eof );
+    }
+
+
+    public LdifDnLine getDnLine()
+    {
+        return ( LdifDnLine ) this.parts.get( 0 );
+    }
+
+
+    public LdifSepLine getSepLine()
+    {
+        for ( Iterator it = this.parts.iterator(); it.hasNext(); )
+        {
+            Object o = it.next();
+            if ( o instanceof LdifSepLine )
+            {
+                return ( LdifSepLine ) o;
+            }
+        }
+
+        return null;
+    }
+
+
+    public String getInvalidString()
+    {
+        LdifDnLine dnLine = getDnLine();
+        LdifSepLine sepLine = getSepLine();
+
+        if ( dnLine == null )
+            return "Record must start with DN";
+        else if ( !dnLine.isValid() )
+            return dnLine.getInvalidString();
+
+        if ( sepLine == null )
+            return "Record must end with an empty line";
+        else if ( !sepLine.isValid() )
+            return sepLine.getInvalidString();
+
+        return super.getInvalidString();
+    }
+
+
+    protected boolean isAbstractValid()
+    {
+        if ( !super.isAbstractValid() )
+        {
+            return false;
+        }
+
+        LdifPart lastPart = getLastPart();
+        return this.getDnLine().isValid() && ( lastPart instanceof LdifSepLine || lastPart instanceof LdifEOFPart )
+            && lastPart.isValid();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifSepContainer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifSepContainer.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifSepContainer.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifSepContainer.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,62 @@
+/*
+ *  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.container;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifSepLine;
+
+
+public class LdifSepContainer extends LdifContainer
+{
+
+    private static final long serialVersionUID = 479360761136440710L;
+
+
+    protected LdifSepContainer()
+    {
+    }
+
+
+    public LdifSepContainer( LdifSepLine sep )
+    {
+        super( sep );
+    }
+
+
+    public void addSep( LdifSepLine sep )
+    {
+        if ( sep == null )
+            throw new IllegalArgumentException( "null argument" );
+        this.parts.add( sep );
+    }
+
+
+    public boolean isValid()
+    {
+        if ( !super.isAbstractValid() )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifSepContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifVersionContainer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifVersionContainer.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifVersionContainer.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifVersionContainer.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,54 @@
+/*
+ *  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.container;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifVersionLine;
+
+
+public class LdifVersionContainer extends LdifContainer
+{
+
+    private static final long serialVersionUID = -6373331266642629348L;
+
+
+    protected LdifVersionContainer()
+    {
+    }
+
+
+    public LdifVersionContainer( LdifVersionLine versionLine )
+    {
+        super( versionLine );
+    }
+
+
+    public boolean isValid()
+    {
+        if ( !super.isAbstractValid() )
+        {
+            return false;
+        }
+
+        return getLastPart() instanceof LdifVersionLine;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/container/LdifVersionContainer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java Mon Nov  5 08:51:43 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.lines;
+
+
+import java.io.Serializable;
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifAttrValLine extends LdifValueLineBase implements Serializable
+{
+
+    private static final long serialVersionUID = 2818131653565822685L;
+
+
+    protected LdifAttrValLine()
+    {
+    }
+
+
+    public LdifAttrValLine( int offset, String attributeDescripton, String valueType, String value, String newLine )
+    {
+        super( offset, attributeDescripton, valueType, value, newLine );
+    }
+
+
+    public String getRawAttributeDescription()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedAttributeDescription()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedAttributeDescription().length() == 0 )
+        {
+            return "Missing attribute name";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifAttrValLine create( String name, String value )
+    {
+        if ( LdifUtils.mustEncode( value ) )
+        {
+            return create( name, LdifUtils.utf8encode( value ) );
+        }
+        else
+        {
+            return new LdifAttrValLine( 0, name, ":", value, BrowserCoreConstants.LINE_SEPARATOR );
+        }
+    }
+
+
+    public static LdifAttrValLine create( String name, byte[] value )
+    {
+        return new LdifAttrValLine( 0, name, "::", LdifUtils.base64encode( value ), BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifAttrValLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,151 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifChangeTypeLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = 8613980677301250589L;
+
+
+    protected LdifChangeTypeLine()
+    {
+    }
+
+
+    public LdifChangeTypeLine( int offset, String rawChangeTypeSpec, String rawValueType, String rawChangeType,
+        String rawNewLine )
+    {
+        super( offset, rawChangeTypeSpec, rawValueType, rawChangeType, rawNewLine );
+    }
+
+
+    public String getRawChangeTypeSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedChangeTypeSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawChangeType()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedChangeType()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isAdd()
+    {
+        return this.getUnfoldedChangeType().equals( "add" );
+    }
+
+
+    public boolean isDelete()
+    {
+        return this.getUnfoldedChangeType().equals( "delete" );
+    }
+
+
+    public boolean isModify()
+    {
+        return this.getUnfoldedChangeType().equals( "modify" );
+    }
+
+
+    public boolean isModDn()
+    {
+        return this.getUnfoldedChangeType().equals( "moddn" ) || this.getUnfoldedChangeType().equals( "modrdn" );
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedChangeTypeSpec().length() == 0 )
+        {
+            return "Missing spec 'changetype'";
+        }
+        else if ( this.getUnfoldedChangeType().length() == 0 )
+        {
+            return "Missing changetype";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifChangeTypeLine createDelete()
+    {
+        return new LdifChangeTypeLine( 0, "changetype", ":", "delete", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifChangeTypeLine createAdd()
+    {
+        return new LdifChangeTypeLine( 0, "changetype", ":", "add", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifChangeTypeLine createModify()
+    {
+        return new LdifChangeTypeLine( 0, "changetype", ":", "modify", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifChangeTypeLine createModDn()
+    {
+        return new LdifChangeTypeLine( 0, "changetype", ":", "moddn", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifChangeTypeLine createModRdn()
+    {
+        return new LdifChangeTypeLine( 0, "changetype", ":", "modrdn", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifChangeTypeLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,79 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifCommentLine extends LdifNonEmptyLineBase
+{
+
+    private static final long serialVersionUID = -4810053047583328865L;
+
+
+    protected LdifCommentLine()
+    {
+    }
+
+
+    public LdifCommentLine( int offset, String rawComment, String rawNewLine )
+    {
+        super( offset, rawComment, rawNewLine );
+    }
+
+
+    public String getRawComment()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedComment()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        return super.getInvalidString();
+    }
+
+
+    public static LdifCommentLine create( String comment )
+    {
+        return new LdifCommentLine( 0, comment, BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifCommentLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,249 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifControlLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = -3961159214439218610L;
+
+    private String rawCriticality;
+
+    private String rawControlValueType;
+
+    private String rawControlValue;
+
+
+    protected LdifControlLine()
+    {
+    }
+
+
+    public LdifControlLine( int offset, String rawControlSpec, String rawControlType, String rawOid,
+        String rawCriticality, String rawControlValueType, String rawControlValue, String rawNewLine )
+    {
+        super( offset, rawControlSpec, rawControlType, rawOid, rawNewLine );
+        this.rawCriticality = rawCriticality;
+        this.rawControlValueType = rawControlValueType;
+        this.rawControlValue = rawControlValue;
+    }
+
+
+    public String getRawControlSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedControlSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawControlType()
+    {
+        return super.getRawValueType();
+    }
+
+
+    public String getUnfoldedControlType()
+    {
+        return super.getUnfoldedValueType();
+    }
+
+
+    public String getRawOid()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedOid()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String getRawCriticality()
+    {
+        return getNonNull( this.rawCriticality );
+    }
+
+
+    public String getUnfoldedCriticality()
+    {
+        return unfold( this.getRawCriticality() );
+    }
+
+
+    public boolean isCritical()
+    {
+        return this.getUnfoldedCriticality().endsWith( "true" );
+    }
+
+
+    public String getRawControlValueType()
+    {
+        return getNonNull( this.rawControlValueType );
+    }
+
+
+    public String getUnfoldedControlValueType()
+    {
+        return unfold( this.getRawControlValueType() );
+    }
+
+
+    public String getRawControlValue()
+    {
+        return getNonNull( this.rawControlValue );
+    }
+
+
+    public String getUnfoldedControlValue()
+    {
+        return unfold( this.getRawControlValue() );
+    }
+
+
+    public String toRawString()
+    {
+        return this.getRawControlSpec() + this.getRawControlType() + this.getRawOid() + this.getRawCriticality()
+            + this.getRawControlValueType() + this.getRawControlValue() + this.getRawNewLine();
+    }
+
+
+    public boolean isValid()
+    {
+        return this.getUnfoldedControlSpec().length() > 0
+            && this.getUnfoldedControlType().length() > 0
+            && this.getUnfoldedOid().length() > 0
+            && ( this.rawCriticality == null || this.getUnfoldedCriticality().endsWith( "true" ) || this
+                .getUnfoldedCriticality().endsWith( "false" ) )
+            && ( ( this.rawControlValueType == null && this.rawControlValue == null ) || ( this.rawControlValueType != null && this.rawControlValue != null ) )
+            && this.getUnfoldedNewLine().length() > 0;
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedControlSpec().length() == 0 )
+        {
+            return "Missing 'control'";
+        }
+        else if ( this.getUnfoldedOid().length() == 0 )
+        {
+            return "Missing OID";
+        }
+        else if ( ( this.rawCriticality != null && !this.getUnfoldedCriticality().endsWith( "true" ) && !this
+            .getUnfoldedCriticality().endsWith( "false" ) ) )
+        {
+            return "Invalid criticality, must be 'true' or 'false'";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    /**
+     * 
+     * @return the binary representation of the control value, may be null
+     */
+    public final byte[] getControlValueAsBinary()
+    {
+        Object o = getControlValueAsObject();
+        if ( o instanceof String )
+        {
+            return LdifUtils.utf8encode( ( String ) o );
+        }
+        else if ( o instanceof byte[] )
+        {
+            return ( byte[] ) o;
+        }
+        else
+        {
+            return new byte[0];
+        }
+    }
+
+
+    public final Object getControlValueAsObject()
+    {
+        if ( this.isControlValueTypeSafe() )
+        {
+            return this.getUnfoldedControlValue();
+        }
+        else if ( this.isControlValueTypeBase64() )
+        {
+            return LdifUtils.base64decodeToByteArray( this.getUnfoldedControlValue() );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public boolean isControlValueTypeBase64()
+    {
+        return this.getUnfoldedControlValueType().startsWith( "::" );
+    }
+
+
+    public boolean isControlValueTypeSafe()
+    {
+        return this.getUnfoldedControlValueType().startsWith( ":" ) && !this.isControlValueTypeBase64();
+    }
+
+
+    public static LdifControlLine create( String oid, String criticality, String controlValue )
+    {
+        if ( LdifUtils.mustEncode( controlValue ) )
+        {
+            return create( oid, criticality, LdifUtils.utf8encode( controlValue ) );
+        }
+        else
+        {
+            LdifControlLine controlLine = new LdifControlLine( 0, "control", ":", oid, criticality,
+                controlValue != null ? ":" : null, controlValue != null ? controlValue : null,
+                BrowserCoreConstants.LINE_SEPARATOR );
+            return controlLine;
+        }
+    }
+
+
+    public static LdifControlLine create( String oid, String criticality, byte[] controlValue )
+    {
+        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 );
+        return controlLine;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifControlLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,118 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifDeloldrdnLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = 7427736453871426864L;
+
+
+    protected LdifDeloldrdnLine()
+    {
+    }
+
+
+    public LdifDeloldrdnLine( int offset, String rawDeleteOldrdnSpec, String rawValueType, String rawDeleteOldrdn,
+        String rawNewLine )
+    {
+        super( offset, rawDeleteOldrdnSpec, rawValueType, rawDeleteOldrdn, rawNewLine );
+    }
+
+
+    public String getRawDeleteOldrdnSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedDeleteOldrdnSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawDeleteOldrdn()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedDeleteOldrdn()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public boolean isDeleteOldRdn()
+    {
+        return "1".equals( this.getUnfoldedDeleteOldrdn() );
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        if ( !super.isValid() )
+            return false;
+
+        return ( "0".equals( getUnfoldedDeleteOldrdn() ) || "1".equals( getUnfoldedDeleteOldrdn() ) );
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedDeleteOldrdnSpec().length() == 0 )
+        {
+            return "Missing delete old RDN spec 'deleteoldrdn'";
+        }
+        else if ( !"0".equals( getUnfoldedDeleteOldrdn() ) && !"1".equals( getUnfoldedDeleteOldrdn() ) )
+        {
+            return "Invalid value of delete old RDN, must be '0' or '1'";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifDeloldrdnLine create0()
+    {
+        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "0", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifDeloldrdnLine create1()
+    {
+        return new LdifDeloldrdnLine( 0, "deleteoldrdn", ":", "1", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDeloldrdnLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,111 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifDnLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = 6180172049870560007L;
+
+
+    protected LdifDnLine()
+    {
+    }
+
+
+    public LdifDnLine( int offset, String rawDnSpec, String rawValueType, String rawDn, String rawNewLine )
+    {
+        super( offset, rawDnSpec, rawValueType, rawDn, rawNewLine );
+    }
+
+
+    public String getRawDnSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedDnSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawDn()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedDn()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedDnSpec().length() == 0 )
+        {
+            return "Missing DN spec 'dn'";
+        }
+        else if ( this.getUnfoldedDn().length() == 0 )
+        {
+            return "Missing DN";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifDnLine create( String dn )
+    {
+        if ( LdifUtils.mustEncode( dn ) )
+        {
+            return new LdifDnLine( 0, "dn", "::", LdifUtils.base64encode( LdifUtils.utf8encode( dn ) ),
+                BrowserCoreConstants.LINE_SEPARATOR );
+        }
+        else
+        {
+            return new LdifDnLine( 0, "dn", ":", dn, BrowserCoreConstants.LINE_SEPARATOR );
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifDnLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java Mon Nov  5 08:51:43 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.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.LdifPart;
+import org.eclipse.core.runtime.Preferences;
+
+
+/**
+ * Base class for all lines in a LDIF file.
+ * 
+ * 
+ */
+public abstract class LdifLineBase implements LdifPart
+{
+
+    private String rawNewLine;
+
+    private int offset;
+
+
+    protected LdifLineBase()
+    {
+    }
+
+
+    protected LdifLineBase( int offset, String rawNewLine )
+    {
+        super();
+        this.rawNewLine = rawNewLine;
+        this.offset = offset;
+    }
+
+
+    public final String getRawNewLine()
+    {
+        return getNonNull( this.rawNewLine );
+    }
+
+
+    public String getUnfoldedNewLine()
+    {
+        return unfold( this.getRawNewLine() );
+    }
+
+
+    public final void adjustOffset( int adjust )
+    {
+        this.offset += adjust;
+    }
+
+
+    public final int getOffset()
+    {
+        return this.offset;
+    }
+
+
+    public final int getLength()
+    {
+        return this.toRawString().length();
+    }
+
+
+    public boolean isValid()
+    {
+        return this.rawNewLine != null;
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.rawNewLine == null )
+        {
+            return "Missing new line";
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public String toRawString()
+    {
+        return this.getRawNewLine();
+    }
+
+
+    public final String toFormattedString()
+    {
+
+        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 );
+
+        if ( this instanceof LdifValueLineBase )
+        {
+            if ( unfolded.indexOf( "::" ) > -1 )
+            {
+                unfolded = unfolded.replaceFirst( "::[ ]*", spaceAfterColon ? ":: " : "::" );
+            }
+            else if ( unfolded.indexOf( ":<" ) > -1 )
+            {
+                unfolded = unfolded.replaceFirst( ":<[ ]*", spaceAfterColon ? ":< " : ":<" );
+            }
+            else if ( unfolded.indexOf( ":" ) > -1 )
+            {
+                unfolded = unfolded.replaceFirst( ":[ ]*", spaceAfterColon ? ": " : ":" );
+            }
+        }
+
+        if ( rawNewLine != null )
+        {
+            int index = unfolded.lastIndexOf( rawNewLine );
+            if ( index > -1 )
+            {
+                unfolded = unfolded.substring( 0, unfolded.length() - rawNewLine.length() );
+                unfolded = unfolded + lineSeparator;
+            }
+        }
+
+        if ( this instanceof LdifValueLineBase )
+        {
+            return fold( unfolded, 0 );
+        }
+        else
+        {
+            return unfolded;
+        }
+    }
+
+
+    public final String toString()
+    {
+        String text = toRawString();
+        text = text.replaceAll( "\n", "\\\\n" );
+        text = text.replaceAll( "\r", "\\\\r" );
+        return getClass().getName() + " (" + getOffset() + "," + getLength() + "): '" + text + "'";
+    }
+
+
+    protected static String getNonNull( String s )
+    {
+        return s != null ? s : "";
+    }
+
+
+    protected static String unfold( String s )
+    {
+        s = s.replaceAll( "\n\r ", "" );
+        s = s.replaceAll( "\r\n ", "" );
+        s = s.replaceAll( "\n ", "" );
+        s = s.replaceAll( "\r ", "" );
+        return s;
+    }
+
+
+    protected static String fold( String value, int indent )
+    {
+        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 endIndex = 0 + offset;
+        while ( endIndex + lineSeparator.length() < value.length() )
+        {
+            formattedLdif.append( value.substring( endIndex - offset, endIndex ) );
+            formattedLdif.append( lineSeparator );
+            formattedLdif.append( ' ' );
+            offset = lineWidth - 1;
+            endIndex += offset;
+        }
+        String rest = value.substring( endIndex - offset, value.length() );
+        formattedLdif.append( rest );
+
+        // return
+        return formattedLdif.toString();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifLineBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,86 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifModSpecSepLine extends LdifNonEmptyLineBase
+{
+
+    private static final long serialVersionUID = -6411592502825895865L;
+
+
+    protected LdifModSpecSepLine()
+    {
+    }
+
+
+    public LdifModSpecSepLine( int offset, String rawMinus, String rawNewLine )
+    {
+        super( offset, rawMinus, rawNewLine );
+    }
+
+
+    public String getRawMinus()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedMinus()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid() && this.getUnfoldedMinus().equals( "-" );
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( !this.getUnfoldedMinus().equals( "-" ) )
+        {
+            return "Missing '-'";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifModSpecSepLine create()
+    {
+        return new LdifModSpecSepLine( 0, "-", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecSepLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,137 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifModSpecTypeLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = 82623220224991909L;
+
+
+    protected LdifModSpecTypeLine()
+    {
+    }
+
+
+    public LdifModSpecTypeLine( int offset, String rawModType, String rawValueType, String rawAttributeDescription,
+        String rawNewLine )
+    {
+        super( offset, rawModType, rawValueType, rawAttributeDescription, rawNewLine );
+    }
+
+
+    public String getRawModType()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedModType()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawAttributeDescription()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedAttributeDescription()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isAdd()
+    {
+        return this.getUnfoldedModType().equals( "add" );
+    }
+
+
+    public boolean isReplace()
+    {
+        return this.getUnfoldedModType().equals( "replace" );
+    }
+
+
+    public boolean isDelete()
+    {
+        return this.getUnfoldedModType().equals( "delete" );
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid() && ( this.isAdd() || this.isReplace() || this.isDelete() );
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedModType().length() == 0 )
+        {
+            return "Missing modification type 'add', 'replace' or 'delete'";
+        }
+        else if ( !this.isAdd() && !this.isReplace() && !this.isDelete() )
+        {
+            return "Invalid modification type, expected 'add', 'replace' or 'delete'";
+        }
+        else if ( this.getUnfoldedAttributeDescription().length() == 0 )
+        {
+            return "Missing attribute";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifModSpecTypeLine createAdd( String attributeName )
+    {
+        return new LdifModSpecTypeLine( 0, "add", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifModSpecTypeLine createReplace( String attributeName )
+    {
+        return new LdifModSpecTypeLine( 0, "replace", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+
+    public static LdifModSpecTypeLine createDelete( String attributeName )
+    {
+        return new LdifModSpecTypeLine( 0, "delete", ":", attributeName, BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifModSpecTypeLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,112 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifNewrdnLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = -4393976438427677361L;
+
+
+    protected LdifNewrdnLine()
+    {
+    }
+
+
+    public LdifNewrdnLine( int offset, String rawNewrdnSpec, String rawValueType, String rawNewrdn, String rawNewLine )
+    {
+        super( offset, rawNewrdnSpec, rawValueType, rawNewrdn, rawNewLine );
+    }
+
+
+    public String getRawNewrdnSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedNewrdnSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawNewrdn()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedNewrdn()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedNewrdnSpec().length() == 0 )
+        {
+            return "Missing new RDN spec 'newrdn'";
+        }
+        else if ( this.getUnfoldedNewrdn().length() == 0 )
+        {
+            return "Missing new RDN";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifNewrdnLine create( String newrdn )
+    {
+        if ( LdifUtils.mustEncode( newrdn ) )
+        {
+            return new LdifNewrdnLine( 0, "newrdn", "::", LdifUtils.base64encode( LdifUtils.utf8encode( newrdn ) ),
+                BrowserCoreConstants.LINE_SEPARATOR );
+        }
+        else
+        {
+            return new LdifNewrdnLine( 0, "newrdn", ":", newrdn, BrowserCoreConstants.LINE_SEPARATOR );
+        }
+
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewrdnLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,113 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifNewsuperiorLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = -8614298286815271694L;
+
+
+    protected LdifNewsuperiorLine()
+    {
+    }
+
+
+    public LdifNewsuperiorLine( int offset, String rawNewSuperiorSpec, String rawValueType, String rawNewSuperiorDn,
+        String rawNewLine )
+    {
+        super( offset, rawNewSuperiorSpec, rawValueType, rawNewSuperiorDn, rawNewLine );
+    }
+
+
+    public String getRawNewSuperiorSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedNewSuperiorSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawNewSuperiorDn()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedNewSuperiorDn()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedNewSuperiorSpec().length() == 0 )
+        {
+            return "Missing new superior spec 'newsuperior'";
+        }
+        else if ( this.getUnfoldedNewSuperiorDn().length() == 0 )
+        {
+            return "Missing new superior DN";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifNewsuperiorLine create( String newsuperior )
+    {
+        if ( LdifUtils.mustEncode( newsuperior ) )
+        {
+            return new LdifNewsuperiorLine( 0, "newsuperior", "::", LdifUtils.base64encode( LdifUtils
+                .utf8encode( newsuperior ) ), BrowserCoreConstants.LINE_SEPARATOR );
+        }
+        else
+        {
+            return new LdifNewsuperiorLine( 0, "newsuperior", ":", newsuperior, BrowserCoreConstants.LINE_SEPARATOR );
+        }
+
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNewsuperiorLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNonEmptyLineBase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNonEmptyLineBase.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNonEmptyLineBase.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNonEmptyLineBase.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,85 @@
+/*
+ *  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.lines;
+
+
+public abstract class LdifNonEmptyLineBase extends LdifLineBase
+{
+
+    private String rawLineStart;
+
+
+    protected LdifNonEmptyLineBase()
+    {
+    }
+
+
+    public LdifNonEmptyLineBase( int offset, String rawLineStart, String rawNewLine )
+    {
+        super( offset, rawNewLine );
+        this.rawLineStart = rawLineStart;
+    }
+
+
+    public String getRawLineStart()
+    {
+        return getNonNull( this.rawLineStart );
+    }
+
+
+    public String getUnfoldedLineStart()
+    {
+        return unfold( this.getRawLineStart() );
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid() && this.rawLineStart != null;
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.rawLineStart == null )
+        {
+            return "Missing line start";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public String toRawString()
+    {
+        return this.getRawLineStart() + this.getRawNewLine();
+    }
+
+
+    public boolean isFolded()
+    {
+        String rawString = toRawString();
+        return rawString.indexOf( "\n " ) > -1 || rawString.indexOf( "\r " ) > -1;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifNonEmptyLineBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,49 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifSepLine extends LdifLineBase
+{
+
+    private static final long serialVersionUID = 1682910718363816158L;
+
+
+    protected LdifSepLine()
+    {
+    }
+
+
+    public LdifSepLine( int offset, String rawNewLine )
+    {
+        super( offset, rawNewLine );
+    }
+
+
+    public static LdifSepLine create()
+    {
+        return new LdifSepLine( 0, BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifSepLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifValueLineBase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifValueLineBase.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifValueLineBase.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifValueLineBase.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,215 @@
+/*
+ *  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.lines;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+
+
+public class LdifValueLineBase extends LdifNonEmptyLineBase
+{
+
+    private static final long serialVersionUID = -7030930374861554147L;
+
+    private String rawValueType;
+
+    private String rawValue;
+
+
+    protected LdifValueLineBase()
+    {
+    }
+
+
+    public LdifValueLineBase( int offset, String rawLineStart, String rawValueType, String rawValue, String rawNewLine )
+    {
+        super( offset, rawLineStart, rawNewLine );
+
+        this.rawValueType = rawValueType;
+        this.rawValue = rawValue;
+    }
+
+
+    public String getRawValueType()
+    {
+        return getNonNull( this.rawValueType );
+    }
+
+
+    public String getUnfoldedValueType()
+    {
+        return unfold( this.getRawValueType() );
+    }
+
+
+    public String getRawValue()
+    {
+        return getNonNull( this.rawValue );
+    }
+
+
+    public String getUnfoldedValue()
+    {
+        return unfold( this.getRawValue() );
+    }
+
+
+    public String toRawString()
+    {
+        return this.getRawLineStart() + this.getRawValueType() + this.getRawValue() + this.getRawNewLine();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid() && this.rawValueType != null && this.rawValue != null;
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.rawValueType == null )
+        {
+            return "Missing value type ':', '::' or ':<'";
+        }
+        else if ( this.rawValue == null )
+        {
+            return "Missing value";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    /**
+     * 
+     * @return the string representation of the value, non-base64, unfolded
+     */
+    public final String getValueAsString()
+    {
+        Object o = getValueAsObject();
+        if ( o instanceof String )
+        {
+            return ( String ) o;
+        }
+        else if ( o instanceof byte[] )
+        {
+            return LdifUtils.utf8decode( ( byte[] ) o );
+        }
+        else
+        {
+            return "";
+        }
+    }
+
+
+    /**
+     * 
+     * @return the binary representation of the real value, non-base64,
+     *         unfolded
+     */
+    public final byte[] getValueAsBinary()
+    {
+        Object o = getValueAsObject();
+        if ( o instanceof String )
+        {
+            return LdifUtils.utf8encode( ( String ) o );
+        }
+        else if ( o instanceof byte[] )
+        {
+            return ( byte[] ) o;
+        }
+        else
+        {
+            return new byte[0];
+        }
+    }
+
+
+    /**
+     * Returns the real data:
+     * <ul>
+     * <li>The unfolded String if value is a safe value.
+     * </li>
+     * <li>A byte array if value is base64 encoded.
+     * </li>
+     * <li>A byte array if value references an URL.
+     * </li>
+     * </ul>
+     * 
+     * @return the real value or null
+     */
+    public final Object getValueAsObject()
+    {
+        if ( this.isValueTypeSafe() )
+        {
+            return this.getUnfoldedValue();
+        }
+        else if ( this.isValueTypeBase64() )
+        {
+            return LdifUtils.base64decodeToByteArray( this.getUnfoldedValue() );
+        }
+        else if ( this.isValueTypeURL() )
+        {
+            try
+            {
+                File file = new File( this.getUnfoldedValue() );
+                byte[] data = new byte[( int ) file.length()];
+                FileInputStream fis = new FileInputStream( file );
+                fis.read( data );
+                return data;
+            }
+            catch ( IOException ioe )
+            {
+                return null;
+            }
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public boolean isValueTypeURL()
+    {
+        return this.getUnfoldedValueType().startsWith( ":<" );
+    }
+
+
+    public boolean isValueTypeBase64()
+    {
+        return this.getUnfoldedValueType().startsWith( "::" );
+    }
+
+
+    public boolean isValueTypeSafe()
+    {
+        return this.getUnfoldedValueType().startsWith( ":" ) && !this.isValueTypeBase64() && !this.isValueTypeURL();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifValueLineBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,102 @@
+/*
+ *  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.lines;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+
+
+public class LdifVersionLine extends LdifValueLineBase
+{
+
+    private static final long serialVersionUID = 7302151354496025254L;
+
+
+    protected LdifVersionLine()
+    {
+    }
+
+
+    public LdifVersionLine( int offset, String rawVersionSpec, String rawValueType, String rawVersion, String rawNewLine )
+    {
+        super( offset, rawVersionSpec, rawValueType, rawVersion, rawNewLine );
+    }
+
+
+    public String getRawVersionSpec()
+    {
+        return super.getRawLineStart();
+    }
+
+
+    public String getUnfoldedVersionSpec()
+    {
+        return super.getUnfoldedLineStart();
+    }
+
+
+    public String getRawVersion()
+    {
+        return super.getRawValue();
+    }
+
+
+    public String getUnfoldedVersion()
+    {
+        return super.getUnfoldedValue();
+    }
+
+
+    public String toRawString()
+    {
+        return super.toRawString();
+    }
+
+
+    public boolean isValid()
+    {
+        return super.isValid();
+    }
+
+
+    public String getInvalidString()
+    {
+        if ( this.getUnfoldedVersionSpec().length() == 0 )
+        {
+            return "Missing version spec";
+        }
+        else if ( this.getUnfoldedVersion().length() == 0 )
+        {
+            return "Missing version";
+        }
+        else
+        {
+            return super.getInvalidString();
+        }
+    }
+
+
+    public static LdifVersionLine create()
+    {
+        return new LdifVersionLine( 0, "version", ":", "1", BrowserCoreConstants.LINE_SEPARATOR );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ldif/lines/LdifVersionLine.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message