directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r488345 [9/12] - in /directory/sandbox/pamarcelot/ldapstudio: ldapstudio-browser-core/ ldapstudio-browser-core/META-INF/ ldapstudio-browser-core/about_files/ ldapstudio-browser-core/lib/ ldapstudio-browser-core/src/ ldapstudio-browser-core/...
Date Mon, 18 Dec 2006 17:15:08 GMT
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ModifyValueJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ModifyValueJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ModifyValueJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ModifyValueJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.ValueModifiedEvent;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Value;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+
+
+public class ModifyValueJob extends AbstractModificationJob
+{
+
+    private IAttribute attribute;
+
+    private IValue oldValue;
+
+    private Object newRawValue;
+
+    private ValueModifiedEvent event;
+
+
+    public ModifyValueJob( IAttribute attribute, IValue oldValue, Object newRawValue )
+    {
+        this.attribute = attribute;
+        this.oldValue = oldValue;
+        this.newRawValue = newRawValue;
+        setName( BrowserCoreMessages.jobs__modify_value_name );
+    }
+
+
+    protected void executeAsyncModificationJob( ExtendedProgressMonitor monitor ) throws ModelModificationException
+    {
+
+        monitor.beginTask( BrowserCoreMessages.jobs__modify_value_task, 2 );
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+        monitor.worked( 1 );
+
+        IValue newValue = new Value( attribute, newRawValue );
+        attribute.modifyValue( oldValue, newValue, this );
+        attribute.getEntry().getConnection().modify( oldValue, newValue, monitor );
+
+        this.event = new ValueModifiedEvent( attribute.getEntry().getConnection(), attribute.getEntry(), attribute,
+            oldValue, newValue, this );
+    }
+
+
+    protected IEntry getModifiedEntry()
+    {
+        return attribute.getEntry();
+    }
+
+
+    protected String[] getAffectedAttributeNames()
+    {
+        return new String[]
+            { this.attribute.getDescription() };
+    }
+
+
+    protected void runNotification()
+    {
+        if ( this.event != null )
+        {
+            EventRegistry.fireEntryUpdated( this.event, this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return BrowserCoreMessages.jobs__modify_value_error;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/MoveEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/MoveEntriesJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/MoveEntriesJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/MoveEntriesJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,177 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.EntryMovedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+
+
+public class MoveEntriesJob extends AbstractAsyncBulkJob implements ModelModifier
+{
+
+    private IConnection connection;
+
+    private IEntry[] oldEntries;
+
+    private IEntry newParent;
+
+    private IEntry[] newEntries;
+
+    private Set searchesToUpdateSet = new HashSet();
+
+
+    public MoveEntriesJob( IEntry[] entries, IEntry newParent )
+    {
+        this.connection = newParent.getConnection();
+        this.oldEntries = entries;
+        this.newParent = newParent;
+
+        setName( entries.length == 1 ? BrowserCoreMessages.jobs__move_entry_name_1
+            : BrowserCoreMessages.jobs__move_entry_name_n );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        return new IConnection[]
+            { connection };
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.add( newParent );
+        l.addAll( Arrays.asList( oldEntries ) );
+        return l.toArray();
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor monitor )
+    {
+
+        monitor.beginTask( BrowserCoreMessages.bind(
+            oldEntries.length == 1 ? BrowserCoreMessages.jobs__move_entry_task_1
+                : BrowserCoreMessages.jobs__move_entry_task_n, new String[]
+                {} ), 3 );
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+        monitor.worked( 1 );
+
+        this.newEntries = new IEntry[oldEntries.length];
+
+        for ( int i = 0; i < oldEntries.length; i++ )
+        {
+
+            IEntry oldEntry = oldEntries[i];
+            IEntry oldParent = oldEntry.getParententry();
+            DN newDn = new DN( oldEntry.getRdn(), newParent.getDn() );
+
+            // move in directory
+            // TODO: use manual/simulated move, if move of subtree is not
+            // supported
+            int errorStatusSize1 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$
+            connection.move( oldEntry, newParent.getDn(), monitor );
+            int errorStatusSize2 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$
+
+            if ( errorStatusSize1 == errorStatusSize2 )
+            {
+                // move in parent
+                oldParent.deleteChild( oldEntry, this );
+                IEntry newEntry = connection.getEntry( newDn, monitor );
+                this.newEntries[i] = newEntry;
+                newParent.addChild( newEntry, this );
+                newParent.setHasMoreChildren( false, this );
+
+                newEntry.setHasChildrenHint( oldEntry.hasChildren(), this );
+                if ( oldEntry.isChildrenInitialized() )
+                {
+                    InitializeChildrenJob.initializeChildren( newEntry, monitor );
+                }
+
+                // move in searches
+                ISearch[] searches = connection.getSearchManager().getSearches();
+                for ( int j = 0; j < searches.length; j++ )
+                {
+                    ISearch search = searches[j];
+                    if ( search.getSearchResults() != null )
+                    {
+                        ISearchResult[] searchResults = search.getSearchResults();
+                        for ( int k = 0; k < searchResults.length; k++ )
+                        {
+                            ISearchResult result = searchResults[k];
+                            if ( oldEntry.equals( result.getEntry() ) )
+                            {
+                                ISearchResult[] newsrs = new ISearchResult[searchResults.length - 1];
+                                System.arraycopy( searchResults, 0, newsrs, 0, k );
+                                System.arraycopy( searchResults, k + 1, newsrs, k, searchResults.length - k - 1 );
+                                search.setSearchResults( newsrs );
+                                searchResults = newsrs;
+                                k--;
+                                searchesToUpdateSet.add( search );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+    protected void runNotification()
+    {
+        for ( int i = 0; i < newEntries.length; i++ )
+        {
+            if ( oldEntries[i] != null && newEntries[i] != null )
+            {
+                EventRegistry.fireEntryUpdated( new EntryMovedEvent( oldEntries[i], newEntries[i], this ), this );
+            }
+        }
+        for ( Iterator it = searchesToUpdateSet.iterator(); it.hasNext(); )
+        {
+            ISearch search = ( ISearch ) it.next();
+            EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.SEARCH_PERFORMED ), this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return oldEntries.length == 1 ? BrowserCoreMessages.jobs__move_entry_error_1
+            : BrowserCoreMessages.jobs__move_entry_error_n;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/OpenConnectionsJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/OpenConnectionsJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/OpenConnectionsJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/OpenConnectionsJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,115 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+
+
+public class OpenConnectionsJob extends AbstractAsyncBulkJob
+{
+
+    private IConnection[] connections;
+
+
+    public OpenConnectionsJob( IConnection connection )
+    {
+        this( new IConnection[]
+            { connection } );
+    }
+
+
+    public OpenConnectionsJob( IConnection[] connections )
+    {
+        this.connections = connections;
+        setName( connections.length == 1 ? BrowserCoreMessages.jobs__open_connections_name_1
+            : BrowserCoreMessages.jobs__open_connections_name_n );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        return new IConnection[0];
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.addAll( Arrays.asList( connections ) );
+        return l.toArray();
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return connections.length == 1 ? BrowserCoreMessages.jobs__open_connections_error_1
+            : BrowserCoreMessages.jobs__open_connections_error_n;
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor monitor )
+    {
+
+        monitor.beginTask( " ", connections.length * 6 + 1 ); //$NON-NLS-1$
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+
+        for ( int i = 0; i < connections.length; i++ )
+        {
+            if ( connections[i].canOpen() )
+            {
+
+                monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__open_connections_task,
+                    new String[]
+                        { this.connections[i].getName() } ) );
+                monitor.worked( 1 );
+
+                connections[i].open( monitor );
+            }
+        }
+    }
+
+
+    protected void runNotification()
+    {
+        for ( int i = 0; i < connections.length; i++ )
+        {
+            if ( connections[i].isOpened() )
+            {
+                EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( connections[i],
+                    ConnectionUpdateEvent.CONNECTION_OPENED ), this );
+            }
+            else
+            {
+                EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( connections[i],
+                    ConnectionUpdateEvent.CONNECTION_CLOSED ), this );
+            }
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReadEntryJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReadEntryJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReadEntryJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReadEntryJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+
+
+public class ReadEntryJob extends AbstractAsyncBulkJob
+{
+
+    private IConnection connection;
+
+    private DN dn;
+
+    private IEntry readEntry;
+
+
+    public ReadEntryJob( IConnection connection, DN dn )
+    {
+        this.connection = connection;
+        this.dn = dn;
+        this.readEntry = null;
+
+        setName( BrowserCoreMessages.jobs__read_entry_name );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        return new IConnection[]
+            { connection };
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.add( connection );
+        return l.toArray();
+    }
+
+
+    public IEntry getReadEntry()
+    {
+        return readEntry;
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return BrowserCoreMessages.jobs__read_entry_error;
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor pm ) throws ModelModificationException
+    {
+        readEntry = connection.getEntryFromCache( dn );
+        if ( readEntry == null )
+        {
+
+            pm.beginTask( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__read_entry_task, new String[]
+                { dn.toString() } ), 2 );
+            pm.reportProgress( " " ); //$NON-NLS-1$
+            pm.worked( 1 );
+
+            readEntry = connection.getEntry( dn, pm );
+        }
+    }
+
+
+    protected void runNotification()
+    {
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReloadSchemasJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReloadSchemasJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReloadSchemasJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/ReloadSchemasJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+
+
+public class ReloadSchemasJob extends AbstractAsyncBulkJob
+{
+
+    private IConnection[] connections;
+
+
+    public ReloadSchemasJob( IConnection[] connections )
+    {
+        this.connections = connections;
+        setName( connections.length == 1 ? BrowserCoreMessages.jobs__reload_schemas_name_1
+            : BrowserCoreMessages.jobs__reload_schemas_name_n );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        return connections;
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.addAll( Arrays.asList( connections ) );
+        return l.toArray();
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor monitor )
+    {
+
+        monitor.beginTask( " ", connections.length + 1 ); //$NON-NLS-1$
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+
+        for ( int i = 0; i < connections.length; i++ )
+        {
+
+            monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__reload_schemas_task, new String[]
+                { connections[i].getName() } ) );
+            monitor.worked( 1 );
+
+            if ( connections[i].isOpened() )
+            {
+                connections[i].reloadSchema( monitor );
+            }
+        }
+    }
+
+
+    protected void runNotification()
+    {
+        for ( int i = 0; i < connections.length; i++ )
+        {
+            EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( connections[i],
+                ConnectionUpdateEvent.CONNECTION_SCHEMA_LOADED ), this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return connections.length == 1 ? BrowserCoreMessages.jobs__reload_schemas_error_1
+            : BrowserCoreMessages.jobs__reload_schemas_error_n;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameEntryJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameEntryJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameEntryJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameEntryJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,162 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.EntryRenamedEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.core.model.RDN;
+
+
+public class RenameEntryJob extends AbstractAsyncBulkJob implements ModelModifier
+{
+
+    private IConnection connection;
+
+    private IEntry oldEntry;
+
+    private RDN newRdn;
+
+    private boolean deleteOldRdn;
+
+    private IEntry newEntry;
+
+    private Set searchesToUpdateSet = new HashSet();
+
+
+    public RenameEntryJob( IEntry entry, RDN newRdn, boolean deleteOldRdn )
+    {
+        this.connection = entry.getConnection();
+        this.oldEntry = entry;
+        this.newRdn = newRdn;
+        this.deleteOldRdn = deleteOldRdn;
+
+        setName( BrowserCoreMessages.jobs__rename_entry_name );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        return new IConnection[]
+            { connection };
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.add( oldEntry.getParententry() );
+        return l.toArray();
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor monitor )
+    {
+
+        monitor.beginTask( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__rename_entry_task, new String[]
+            { this.oldEntry.getDn().toString() } ), 3 );
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+        monitor.worked( 1 );
+
+        IEntry parent = oldEntry.getParententry();
+        DN newDn = new DN( newRdn, parent.getDn() );
+
+        // rename in directory
+        // TODO: use manual/simulated rename, if rename of subtree is not
+        // supported
+        connection.rename( oldEntry, newDn, deleteOldRdn, monitor );
+
+        if ( !monitor.errorsReported() )
+        {
+            // rename in parent
+            parent.deleteChild( oldEntry, this );
+            this.newEntry = connection.getEntry( newDn, monitor );
+            parent.addChild( newEntry, this );
+            parent.setHasMoreChildren( false, this );
+
+            newEntry.setHasChildrenHint( oldEntry.hasChildren(), this );
+            if ( oldEntry.isChildrenInitialized() )
+            {
+                InitializeChildrenJob.initializeChildren( newEntry, monitor );
+            }
+
+            // rename in searches
+            ISearch[] searches = connection.getSearchManager().getSearches();
+            for ( int j = 0; j < searches.length; j++ )
+            {
+                ISearch search = searches[j];
+                if ( search.getSearchResults() != null )
+                {
+                    ISearchResult[] searchResults = search.getSearchResults();
+                    for ( int k = 0; k < searchResults.length; k++ )
+                    {
+                        ISearchResult result = searchResults[k];
+                        if ( oldEntry.equals( result.getEntry() ) )
+                        {
+                            ISearchResult[] newsrs = new ISearchResult[searchResults.length - 1];
+                            System.arraycopy( searchResults, 0, newsrs, 0, k );
+                            System.arraycopy( searchResults, k + 1, newsrs, k, searchResults.length - k - 1 );
+                            search.setSearchResults( newsrs );
+                            searchResults = newsrs;
+                            k--;
+                            searchesToUpdateSet.add( search );
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+
+    protected void runNotification()
+    {
+        if ( oldEntry != null && newEntry != null )
+        {
+            EventRegistry.fireEntryUpdated( new EntryRenamedEvent( oldEntry, newEntry, this ), this );
+        }
+        for ( Iterator it = searchesToUpdateSet.iterator(); it.hasNext(); )
+        {
+            ISearch search = ( ISearch ) it.next();
+            EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.SEARCH_PERFORMED ), this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return BrowserCoreMessages.jobs__rename_entry_error;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameValuesJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameValuesJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameValuesJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/RenameValuesJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.ValueRenamedEvent;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Attribute;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Value;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+
+
+public class RenameValuesJob extends AbstractModificationJob
+{
+
+    private IEntry entry;
+
+    private IValue[] oldValues;
+
+    private String newAttributeName;
+
+    private ValueRenamedEvent event;
+
+
+    public RenameValuesJob( IEntry entry, IValue[] oldValues, String newAttributeName )
+    {
+        this.entry = entry;
+        this.oldValues = oldValues;
+        this.newAttributeName = newAttributeName;
+
+        setName( oldValues.length == 1 ? BrowserCoreMessages.jobs__rename_value_name_1
+            : BrowserCoreMessages.jobs__rename_value_name_n );
+    }
+
+
+    protected void executeAsyncModificationJob( ExtendedProgressMonitor monitor ) throws ModelModificationException
+    {
+
+        monitor.beginTask( oldValues.length == 1 ? BrowserCoreMessages.jobs__rename_value_task_1
+            : BrowserCoreMessages.jobs__rename_value_task_n, 2 );
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+        monitor.worked( 1 );
+
+        for ( int i = 0; i < oldValues.length; i++ )
+        {
+            if ( oldValues[i].getAttribute().getEntry() != this.entry )
+            {
+                return;
+            }
+        }
+
+        IValue[] newValues = new IValue[oldValues.length];
+        for ( int i = 0; i < oldValues.length; i++ )
+        {
+
+            IAttribute newAttribute = entry.getAttribute( newAttributeName );
+            if ( newAttribute == null )
+            {
+                newAttribute = new Attribute( entry, newAttributeName );
+                entry.addAttribute( newAttribute, this );
+            }
+
+            newValues[i] = new Value( newAttribute, oldValues[i].getRawValue() );
+            newAttribute.addValue( newValues[i], this );
+
+            oldValues[i].getAttribute().deleteValue( oldValues[i], this );
+
+            if ( this.event == null )
+            {
+                this.event = new ValueRenamedEvent( entry.getConnection(), entry, oldValues[0], newValues[0], this );
+            }
+        }
+
+        if ( !monitor.errorsReported() )
+        {
+            entry.getConnection().create( newValues, monitor );
+        }
+        if ( !monitor.errorsReported() )
+        {
+            entry.getConnection().delete( oldValues, monitor );
+        }
+    }
+
+
+    protected IEntry getModifiedEntry()
+    {
+        return this.entry;
+    }
+
+
+    protected String[] getAffectedAttributeNames()
+    {
+        Set affectedAttributeNameSet = new HashSet();
+        affectedAttributeNameSet.add( newAttributeName );
+        for ( int i = 0; i < oldValues.length; i++ )
+        {
+            affectedAttributeNameSet.add( oldValues[i].getAttribute().getDescription() );
+        }
+        return ( String[] ) affectedAttributeNameSet.toArray( new String[affectedAttributeNameSet.size()] );
+    }
+
+
+    protected void runNotification()
+    {
+        if ( this.event != null )
+        {
+            EventRegistry.fireEntryUpdated( this.event, this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return oldValues.length == 1 ? BrowserCoreMessages.jobs__rename_value_error_1
+            : BrowserCoreMessages.jobs__rename_value_error_n;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/SearchJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/SearchJob.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/SearchJob.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/jobs/SearchJob.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,115 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.jobs;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+
+
+public class SearchJob extends AbstractAsyncBulkJob
+{
+
+    private ISearch[] searches;
+
+
+    public SearchJob( ISearch[] searches )
+    {
+        this.searches = searches;
+        setName( BrowserCoreMessages.jobs__search_name );
+    }
+
+
+    protected IConnection[] getConnections()
+    {
+        IConnection[] connections = new IConnection[searches.length];
+        for ( int i = 0; i < connections.length; i++ )
+        {
+            connections[i] = searches[i].getConnection();
+        }
+        return connections;
+    }
+
+
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.addAll( Arrays.asList( searches ) );
+        return l.toArray();
+    }
+
+
+    protected void executeBulkJob( ExtendedProgressMonitor monitor )
+    {
+
+        monitor.beginTask( " ", searches.length + 1 ); //$NON-NLS-1$
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+
+        for ( int pi = 0; pi < searches.length; pi++ )
+        {
+            ISearch search = searches[pi];
+
+            monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__search_task, new String[]
+                { search.getName() } ) );
+            monitor.worked( 1 );
+
+            if ( search.getConnection() != null && search.getConnection().isOpened() )
+            {
+
+                // // clear search result attributes
+                // if(search.getSearchResults() != null) {
+                // ISearchResult[] srs = search.getSearchResults();
+                // for (int s = 0; s < srs.length; s++) {
+                // IEntry entry = srs[s].getEntry();
+                // entry.setAttributesInitialized(false, entry.getConnection());
+                // }
+                // }
+
+                search.getConnection().search( search, monitor );
+            }
+        }
+    }
+
+
+    protected void runNotification()
+    {
+        for ( int pi = 0; pi < searches.length; pi++ )
+        {
+            EventRegistry.fireSearchUpdated( new SearchUpdateEvent( searches[pi], SearchUpdateEvent.SEARCH_PERFORMED ),
+                this );
+        }
+    }
+
+
+    protected String getErrorMessage()
+    {
+        return searches.length == 1 ? BrowserCoreMessages.jobs__search_error_1
+            : BrowserCoreMessages.jobs__search_error_n;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/AttributeHierachie.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/AttributeHierachie.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/AttributeHierachie.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/AttributeHierachie.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+
+public class AttributeHierachie
+{
+
+    private IEntry entry;
+
+    private String attributeDescription;
+
+    private IAttribute[] attributes;
+
+
+    public AttributeHierachie( IEntry entry, String attributeDescription, IAttribute[] attributes )
+    {
+        if ( entry == null || attributeDescription == null || attributes == null || attributes.length < 1
+            || attributes[0] == null )
+        {
+            throw new IllegalArgumentException( "Empty AttributeHierachie" );
+        }
+        this.entry = entry;
+        this.attributeDescription = attributeDescription;
+        this.attributes = attributes;
+    }
+
+
+    public IAttribute[] getAttributes()
+    {
+        return attributes;
+    }
+
+
+    public boolean contains( IAttribute att )
+    {
+        return Arrays.asList( attributes ).contains( att );
+    }
+
+
+    public Iterator iterator()
+    {
+        return Arrays.asList( attributes ).iterator();
+    }
+
+
+    public IAttribute getAttribute()
+    {
+        return attributes[0];
+    }
+
+
+    public int size()
+    {
+        return attributes.length;
+    }
+
+
+    public String getAttributeDescription()
+    {
+        return attributeDescription;
+    }
+
+
+    public IEntry getEntry()
+    {
+        return entry;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/BookmarkParameter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/BookmarkParameter.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/BookmarkParameter.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/BookmarkParameter.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+
+
+public class BookmarkParameter implements Serializable
+{
+
+    private static final long serialVersionUID = 105108281861642267L;
+
+    private DN dn;
+
+    private String name;
+
+
+    public BookmarkParameter()
+    {
+    }
+
+
+    public BookmarkParameter( DN dn, String name )
+    {
+        this.dn = dn;
+        this.name = name;
+    }
+
+
+    public DN getDn()
+    {
+        return dn;
+    }
+
+
+    public void setDn( DN dn )
+    {
+        this.dn = dn;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ConnectionParameter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ConnectionParameter.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ConnectionParameter.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ConnectionParameter.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,239 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+
+
+public class ConnectionParameter implements Serializable
+{
+
+    private static final long serialVersionUID = 3679909600732887964L;
+
+    private String name;
+
+    private String host;
+
+    private int encryptionMethod;
+
+    private int port;
+
+    private boolean fetchBaseDNs;
+
+    private DN baseDN;
+
+    private int timeLimit;
+
+    private int countLimit;
+
+    private int aliasesDereferencingMethod;
+
+    private int referralsHandlingMethod;
+
+    private int authMethod;
+
+    private String bindPrincipal;
+
+    private String bindPassword;
+
+    private String connectionProviderClassName;
+
+
+    public ConnectionParameter()
+    {
+    }
+
+
+    public DN getBaseDN()
+    {
+        return baseDN;
+    }
+
+
+    public void setBaseDN( DN baseDN )
+    {
+        this.baseDN = baseDN;
+    }
+
+
+    public int getCountLimit()
+    {
+        return countLimit;
+    }
+
+
+    public void setCountLimit( int countLimit )
+    {
+        this.countLimit = countLimit;
+    }
+
+
+    public String getHost()
+    {
+        return host;
+    }
+
+
+    public void setHost( String host )
+    {
+        this.host = host;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public int getPort()
+    {
+        return port;
+    }
+
+
+    public void setPort( int port )
+    {
+        this.port = port;
+    }
+
+
+    public int getTimeLimit()
+    {
+        return timeLimit;
+    }
+
+
+    public void setTimeLimit( int timeLimit )
+    {
+        this.timeLimit = timeLimit;
+    }
+
+
+    public boolean isFetchBaseDNs()
+    {
+        return fetchBaseDNs;
+    }
+
+
+    public void setFetchBaseDNs( boolean fetchBaseDNs )
+    {
+        this.fetchBaseDNs = fetchBaseDNs;
+    }
+
+
+    public void setBindDN( DN bindDN )
+    {
+        this.setBindPrincipal( bindDN.toString() );
+    }
+
+
+    public String getBindPrincipal()
+    {
+        return bindPrincipal;
+    }
+
+
+    public void setBindPrincipal( String bindPrincipal )
+    {
+        this.bindPrincipal = bindPrincipal;
+    }
+
+
+    public String getBindPassword()
+    {
+        return bindPassword;
+    }
+
+
+    public void setBindPassword( String bindPassword )
+    {
+        this.bindPassword = bindPassword;
+    }
+
+
+    public int getAuthMethod()
+    {
+        return authMethod;
+    }
+
+
+    public void setAuthMethod( int authMethod )
+    {
+        this.authMethod = authMethod;
+    }
+
+
+    public String getConnectionProviderClassName()
+    {
+        return connectionProviderClassName;
+    }
+
+
+    public void setConnectionProviderClassName( String connectionProviderClassName )
+    {
+        this.connectionProviderClassName = connectionProviderClassName;
+    }
+
+
+    public int getEncryptionMethod()
+    {
+        return encryptionMethod;
+    }
+
+
+    public void setEncryptionMethod( int encryptionMethod )
+    {
+        this.encryptionMethod = encryptionMethod;
+    }
+
+
+    public int getAliasesDereferencingMethod()
+    {
+        return aliasesDereferencingMethod;
+    }
+
+
+    public void setAliasesDereferencingMethod( int aliasesDereferencingMethod )
+    {
+        this.aliasesDereferencingMethod = aliasesDereferencingMethod;
+    }
+
+
+    public int getReferralsHandlingMethod()
+    {
+        return referralsHandlingMethod;
+    }
+
+
+    public void setReferralsHandlingMethod( int referralsHandlingMethod )
+    {
+        this.referralsHandlingMethod = referralsHandlingMethod;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/Control.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/Control.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/Control.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/Control.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,176 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+
+import org.apache.directory.ldapstudio.browser.core.model.ldif.lines.LdifControlLine;
+
+
+public class Control implements Serializable
+{
+
+    private static final long serialVersionUID = -1289018814649849178L;
+
+    public static final Control SUBENTRIES_CONTROL = new Control( "Subentries Control", "1.3.6.1.4.1.4203.1.10.1",
+        false, new byte[]
+            { 0x01, 0x01, ( byte ) 0xFF } );
+
+    private String name;
+
+    private String oid;
+
+    private boolean critical;
+
+    private transient byte[] controlValue;
+
+
+    public Control()
+    {
+
+    }
+
+
+    public Control( String name, String oid, boolean critical, byte[] controlValue )
+    {
+        super();
+        this.name = name == null ? "" : name;
+        this.oid = oid;
+        this.critical = critical;
+        this.controlValue = controlValue;
+    }
+
+
+    // public static Control parseControl(String controlLdif) throws
+    // ParseException {
+    //		
+    // if("".equals(controlLdif)) {
+    // return NONE_CONTOL;
+    // }
+    //		
+    // try {
+    // String ldif =
+    // "dn: cn=dummy" +
+    // BrowserCoreConstants.LINE_SEPARATOR +
+    // "control: " +
+    // controlLdif +
+    // BrowserCoreConstants.LINE_SEPARATOR
+    // ;
+    //			
+    // LdifParser parser = new LdifParser();
+    // LdifFile model = parser.parse(ldif);
+    // LdifPart part = model.getLastContainer().getLastPart();
+    // LdifControlLine ldifControlLine = (LdifControlLine)part;
+    // if(!ldifControlLine.isValid()) {
+    // throw new Exception(ldifControlLine.getInvalidString());
+    // }
+    //			
+    // Control control = new Control("", ldifControlLine.getUnfoldedOid(),
+    // ldifControlLine.isCritical(),
+    // ldifControlLine.getControlValueAsBinary());
+    // return control;
+    // }
+    // catch (Exception e) {
+    // throw new ParseException(e.getMessage(), 0);
+    // }
+    // }
+
+    public byte[] getControlValue()
+    {
+        return controlValue;
+    }
+
+
+    public String getOid()
+    {
+        return oid;
+    }
+
+
+    public boolean isCritical()
+    {
+        return critical;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public String toString()
+    {
+
+        if ( oid == null )
+        {
+            return "";
+        }
+
+        LdifControlLine line = LdifControlLine.create( getOid(), isCritical() ? " true" : " false", getControlValue() );
+        String s = line.toRawString();
+        s = s.substring( line.getRawControlSpec().length(), s.length() );
+        s = s.substring( line.getRawControlType().length(), s.length() );
+        s = s.substring( 0, s.length() - line.getRawNewLine().length() );
+
+        // System.out.println(s);
+
+        return s;
+    }
+
+
+    public void setControlValue( byte[] controlValue )
+    {
+        this.controlValue = controlValue;
+    }
+
+
+    public void setCritical( boolean critical )
+    {
+        this.critical = critical;
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public void setOid( String oid )
+    {
+        this.oid = oid;
+    }
+
+
+    public boolean equals( Object obj )
+    {
+        if ( obj == null || !( obj instanceof Control ) )
+        {
+            return false;
+        }
+        Control other = ( Control ) obj;
+
+        return this.toString().equals( other.toString() );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/DN.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/DN.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/DN.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/DN.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,268 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
+
+
+public class DN implements Serializable
+{
+
+    private static final long serialVersionUID = 2343676941769163982L;
+
+    private RDN[] rdns;
+
+
+    public DN()
+    {
+        this.rdns = new RDN[0];
+    }
+
+
+    public DN( RDN rdn )
+    {
+
+        if ( rdn == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
+        }
+
+        this.rdns = new RDN[1];
+        this.rdns[0] = new RDN( rdn );
+    }
+
+
+    public DN( String dn ) throws NameException
+    {
+
+        if ( dn == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
+        }
+
+        // this.parseDn(dn.trim());
+        this.parseDn( dn );
+    }
+
+
+    public DN( DN dn )
+    {
+
+        if ( dn == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
+        }
+
+        this.rdns = new RDN[dn.getRdns().length];
+        for ( int i = 0; i < dn.getRdns().length; i++ )
+        {
+            this.rdns[i] = new RDN( dn.getRdns()[i] );
+        }
+    }
+
+
+    public DN( RDN rdn, DN parent )
+    {
+
+        if ( rdn == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
+        }
+        if ( parent == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
+        }
+
+        this.rdns = new RDN[parent.getRdns().length + 1];
+        this.rdns[0] = new RDN( rdn );
+        for ( int i = 0; i < parent.getRdns().length; i++ )
+        {
+            this.rdns[i + 1] = new RDN( parent.getRdns()[i] );
+        }
+    }
+
+
+    public DN( String rdn, String parent ) throws NameException
+    {
+
+        if ( rdn == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_rdn );
+        }
+        if ( parent == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_dn );
+        }
+
+        // this.parseDn(parent.trim());
+        this.parseDn( parent );
+
+        RDN[] rdns = this.rdns;
+        this.rdns = new RDN[rdns.length + 1];
+        this.rdns[0] = new RDN( rdn );
+        System.arraycopy( rdns, 0, this.rdns, 1, rdns.length );
+    }
+
+
+    public RDN getRdn()
+    {
+        if ( this.rdns.length > 0 )
+        {
+            return this.rdns[0];
+        }
+        else
+        {
+            return new RDN();
+        }
+    }
+
+
+    public DN getParentDn()
+    {
+        if ( this.rdns.length < 2 )
+        {
+            return null;
+        }
+        else
+        {
+            RDN[] parentRdns = new RDN[this.rdns.length - 1];
+            for ( int i = 1; i < this.rdns.length; i++ )
+            {
+                parentRdns[i - 1] = new RDN( this.rdns[i] );
+            }
+            DN parent = new DN();
+            parent.rdns = parentRdns;
+            return parent;
+        }
+    }
+
+
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        for ( int i = 0; i < this.rdns.length; i++ )
+        {
+            sb.append( this.rdns[i].toString() );
+            if ( i + 1 < rdns.length )
+            {
+                sb.append( "," ); //$NON-NLS-1$
+            }
+        }
+
+        return sb.toString();
+    }
+
+
+    public String toOidString( Schema schema )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        for ( int i = 0; i < this.rdns.length; i++ )
+        {
+            sb.append( this.rdns[i].toOidString( schema ) );
+            if ( i + 1 < rdns.length )
+            {
+                sb.append( "," ); //$NON-NLS-1$
+            }
+        }
+
+        return sb.toString();
+    }
+
+
+    private void parseDn( String dn ) throws NameException
+    {
+
+        List rdnList = new ArrayList( 3 );
+
+        boolean backslash = false;
+        int start = 0;
+        for ( int i = 0; i < dn.length(); i++ )
+        {
+            if ( dn.charAt( i ) == '\\' && !backslash )
+            {
+                backslash = true;
+            }
+            else
+            {
+                String rdn = null;
+                if ( dn.charAt( i ) == ',' && !backslash )
+                {
+                    rdn = dn.substring( start, i );
+                }
+                else if ( i == dn.length() - 1 )
+                {
+                    rdn = dn.substring( start );
+                }
+                if ( rdn != null )
+                {
+                    rdnList.add( new RDN( rdn ) );
+                    start = i + 1;
+
+                    // remove spaces between RDNs
+                    for ( ; start < dn.length() && dn.charAt( start ) == ' '; i++ )
+                    {
+                        start++;
+                    }
+                }
+                backslash = false;
+            }
+        }
+
+        this.rdns = ( RDN[] ) rdnList.toArray( new RDN[rdnList.size()] );
+    }
+
+
+    public RDN[] getRdns()
+    {
+        return rdns;
+    }
+
+
+    public void setRdns( RDN[] rdns )
+    {
+        this.rdns = rdns;
+    }
+
+
+    public boolean equals( Object o ) throws ClassCastException
+    {
+        if ( o instanceof DN )
+        {
+            return this.toString().equals( ( ( DN ) o ).toString() );
+        }
+        return false;
+    }
+
+
+    public int hashCode()
+    {
+        return this.toString().hashCode();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,394 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.internal.model.AttributeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.AttributePropertyPageProvider;
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.ConnectionPropertyPageProvider;
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.EntryPropertyPageProvider;
+import org.eclipse.core.runtime.IAdaptable;
+
+
+/**
+ * The IAttribute interface represents an LDAP attribute.
+ */
+public interface IAttribute extends Serializable, IAdaptable, AttributePropertyPageProvider, EntryPropertyPageProvider,
+    ConnectionPropertyPageProvider
+{
+
+    /**
+     * ( 2.5.18.3 NAME 'creatorsName' EQUALITY distinguishedNameMatch SYNTAX
+     * 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE
+     * directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_CREATORS_NAME = "creatorsName"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.18.1 NAME 'createTimestamp' EQUALITY generalizedTimeMatch
+     * ORDERING generalizedTimeOrderingMatch SYNTAX
+     * 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE
+     * directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP = "createTimestamp"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.18.4 NAME 'modifiersName' EQUALITY distinguishedNameMatch
+     * SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE
+     * NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_MODIFIERS_NAME = "modifiersName"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.18.2 NAME 'modifyTimestamp' EQUALITY generalizedTimeMatch
+     * ORDERING generalizedTimeOrderingMatch SYNTAX
+     * 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE
+     * directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP = "modifyTimestamp"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.21.9 NAME 'structuralObjectClass' EQUALITY
+     * objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38
+     * SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_STRUCTURAL_OBJECT_CLASS = "structuralObjectClass"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.21.10 NAME 'governingStructureRule' EQUALITY integerMatch
+     * SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE
+     * NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_GOVERNING_STRUCTURE_RULE = "governingStructureRule"; //$NON-NLS-1$
+
+    /**
+     * ( 1.3.6.1.1.16.4 NAME 'entryUUID' DESC 'UUID of the entry' EQUALITY
+     * uuidMatch ORDERING uuidOrderingMatch SYNTAX 1.3.6.1.1.16.1
+     * SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_ENTRY_UUID = "entryUUID"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.18.10 NAME 'subschemaSubentry' EQUALITY distinguishedNameMatch
+     * SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE
+     * NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_SUBSCHEMA_SUBENTRY = "subschemaSubentry"; //$NON-NLS-1$
+
+    /**
+     * ( 2.5.18.9 NAME 'hasSubordinates' DESC 'X.501: entry has children'
+     * EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+     * SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_HAS_SUBORDINATES = "hasSubordinates"; //$NON-NLS-1$
+
+    /**
+     * ( 1.3.1.1.4.1.453.16.2.103 NAME 'numSubordinates' DESC 'count of
+     * immediate subordinates' EQUALITY integerMatch ORDERING
+     * integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
+     * SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN
+     * 'numSubordinates Internet Draft' )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_NUM_SUBORDINATES = "numSubordinates"; //$NON-NLS-1$
+
+    /**
+     * ( 2.16.840.1.113719.1.27.4.49 NAME 'subordinateCount' DESC
+     * 'Operational Attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
+     * SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_SUBORDINATE_COUNT = "subordinateCount"; //$NON-NLS-1$
+
+    /**
+     * ( 1.3.6.1.1.4 NAME 'vendorName' EQUALITY caseExactIA5Match SYNTAX
+     * 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE
+     * dSAOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_VENDOR_NAME = "vendorName"; //$NON-NLS-1$
+
+    /**
+     * ( 1.3.6.1.1.5 NAME 'vendorVersion' EQUALITY caseExactIA5Match SYNTAX
+     * 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE
+     * dSAOperation )
+     */
+    public static final String OPERATIONAL_ATTRIBUTE_VENDOR_VERSION = "vendorVersion"; //$NON-NLS-1$
+
+    /**
+     * objectClass
+     */
+    public static final String OBJECTCLASS_ATTRIBUTE = "objectClass"; //$NON-NLS-1$
+
+    /**
+     * objectClass
+     */
+    public static final String OBJECTCLASS_ATTRIBUTE_OID = "2.5.4.0"; //$NON-NLS-1$
+
+    /**
+     * ref
+     */
+    public static final String REFERRAL_ATTRIBUTE = "ref"; //$NON-NLS-1$
+
+    /**
+     * aliasedObjectName
+     */
+    public static final String ALIAS_ATTRIBUTE = "aliasedObjectName"; //$NON-NLS-1$
+
+    /**
+     * ;
+     */
+    public static final String OPTION_DELIMITER = ";"; //$NON-NLS-1$
+
+    /**
+     * lang-
+     */
+    public static final String OPTION_LANG_PREFIX = "lang-"; //$NON-NLS-1$
+
+
+    /**
+     * Returns the entry of this attribute.
+     * 
+     * @return the entry of this attribute, never null
+     */
+    public abstract IEntry getEntry();
+
+
+    /**
+     * Returns true if this attribute is consistent. The following
+     * conditions must be fulfilled:
+     * 
+     * <ul>
+     * <li>There must be at least one value</li>
+     * <li>There mustn't be any empty value</li>
+     * </ul>
+     * 
+     * @return true if the attribute ist consistent
+     */
+    public abstract boolean isConsistent();
+
+
+    /**
+     * Returns true if this attribute is a must attribute of its entry
+     * according to the entry's subschema.
+     * 
+     * @return true if this attribute is a must attribute of its entry.
+     */
+    public abstract boolean isMustAttribute();
+
+
+    /**
+     * Returns true if this attribute is a may attribute of its entry
+     * according to the entry's subschema.
+     * 
+     * @return true if this attribute is a may attribute of its entry.
+     */
+    public abstract boolean isMayAttribute();
+
+
+    /**
+     * Returns true if this attribute is an operational attribute according
+     * to the entry's subschema.
+     * 
+     * @return true if this attribute is an operational attribute.
+     */
+    public abstract boolean isOperationalAttribute();
+
+
+    /**
+     * Return true if this attribute is the objectclass attribute.
+     * 
+     * @return true if this attribute is the objectclass attribute.
+     */
+    public abstract boolean isObjectClassAttribute();
+
+
+    /**
+     * Return true if the attribute is of type String.
+     * 
+     * @return true if the attribute is of type String.
+     */
+    public abstract boolean isString();
+
+
+    /**
+     * Return true if the attribute is of type byte[].
+     * 
+     * @return true if the attribute is of type byte[].
+     */
+    public abstract boolean isBinary();
+
+
+    /**
+     * Adds an empty value.
+     * 
+     * @param source
+     *                the ModelModifier
+     */
+    public abstract void addEmptyValue( ModelModifier source );
+
+
+    /**
+     * Removes one empty value if one is present.
+     * 
+     * @param source
+     *                the ModelModifier
+     */
+    public abstract void deleteEmptyValue( ModelModifier source );
+
+
+    /**
+     * Adds the given value to this attribute. The value's attribute must be
+     * this attribute.
+     * 
+     * @param valueToAdd
+     *                the value to add
+     * @param source
+     *                the ModelModifier
+     * @throws ModelModificationException
+     *                 if the value is null or if the value's attribute
+     *                 isn't this attribute.
+     */
+    public abstract void addValue( IValue valueToAdd, ModelModifier source ) throws ModelModificationException;
+
+
+    /**
+     * Deletes the given value from this attribute.
+     * 
+     * @param valueToDelete
+     *                the value to delete
+     * @param source
+     *                the ModelModifier
+     * @throws ModelModificationException
+     *                 if the value is null or if the value's attribute
+     *                 isn't this attribute.
+     */
+    public abstract void deleteValue( IValue valueToDelete, ModelModifier source ) throws ModelModificationException;
+
+
+    /**
+     * Replaces the old value with the new value.
+     * 
+     * @param oldValue
+     *                the value that should be replaced
+     * @param newValue
+     *                the value that should be added
+     * @param source
+     *                the ModelModifier
+     * @throws ModelModificationException
+     *                 if the value is null or if the value's attribute
+     *                 isn't this attribute.
+     */
+    public abstract void modifyValue( IValue oldValue, IValue newValue, ModelModifier source )
+        throws ModelModificationException;
+
+
+    /**
+     * Returns the values of this attribute, wrapped into IValue objects.
+     * 
+     * @return the values of this attribute, may be an empty array, never
+     *         null.
+     */
+    public abstract IValue[] getValues();
+
+
+    /**
+     * Returns the number of values in this attribute.
+     * 
+     * @return the number of values in this attribute.
+     */
+    public abstract int getValueSize();
+
+
+    /**
+     * Returns the description of this attribute.
+     * 
+     * @return the description of this attribute.
+     */
+    public abstract String getDescription();
+
+
+    /**
+     * Returns the type of this attribute (description without options).
+     * 
+     * @return the attribute type.
+     */
+    public abstract String getType();
+
+
+    /**
+     * Returns all values as byte[]. If the values aren't binary they are
+     * converted to byte[] using UTF-8 encoding.
+     * 
+     * @return The binary values
+     */
+    public abstract byte[][] getBinaryValues();
+
+
+    /**
+     * Returns the first value as string if one is present, null otherwise
+     * 
+     * @return The first value if one present, null otherwise
+     */
+    public abstract String getStringValue();
+
+
+    /**
+     * Returns all values as String. If the values aren't strings they are
+     * converted using UTF-8 encoding.
+     * 
+     * @return The string values
+     */
+    public abstract String[] getStringValues();
+
+
+    /**
+     * Returns true if the argument is also of type IAttribute and they are
+     * equal.
+     * 
+     * IAttributes are equal if there entries and there attribute
+     * description are equal.
+     * 
+     * @param o
+     *                The attribute to compare, must be of type IAttribute
+     * @return true if the argument is equal to this.
+     */
+    public abstract boolean equals( Object o );
+
+
+    /**
+     * Returns the AttributeTypeDescription of this attribute.
+     * 
+     * @return the AttributeTypeDescription of this attribute, may be the
+     *         default or a dummy
+     */
+    public abstract AttributeTypeDescription getAttributeTypeDescription();
+
+
+    /**
+     * Returns the AttributeDescription of this attribute.
+     * 
+     * @return the AttributeDescription of this attribute,.
+     */
+    public abstract AttributeDescription getAttributeDescription();
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAuthHandler.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAuthHandler.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IAuthHandler.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+public interface IAuthHandler
+{
+
+    public ICredentials getCredentials( ConnectionParameter connectionParameter );
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IBookmark.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IBookmark.java?view=auto&rev=488345
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IBookmark.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/IBookmark.java Mon Dec 18 09:15:00 2006
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model;
+
+
+import java.io.Serializable;
+
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.BookmarkPropertyPageProvider;
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.ConnectionPropertyPageProvider;
+import org.apache.directory.ldapstudio.browser.core.propertypageproviders.EntryPropertyPageProvider;
+import org.eclipse.core.runtime.IAdaptable;
+
+
+public interface IBookmark extends Serializable, IAdaptable, BookmarkPropertyPageProvider, EntryPropertyPageProvider,
+    ConnectionPropertyPageProvider
+{
+
+    public DN getDn();
+
+
+    public void setDn( DN dn );
+
+
+    public String getName();
+
+
+    public void setName( String name );
+
+
+    public IConnection getConnection();
+
+
+    public IEntry getEntry();
+
+
+    public BookmarkParameter getBookmarkParameter();
+
+
+    public void setBookmarkParameter( BookmarkParameter bookmarkParameter );
+
+}



Mime
View raw message