You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 15:45:45 UTC

svn commit: r592021 [1/3] - in /directory/sandbox/felixk/studio-connection-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/ src/...

Author: felixk
Date: Mon Nov  5 06:45:40 2007
New Revision: 592021

URL: http://svn.apache.org/viewvc?rev=592021&view=rev
Log:
Initial studio maven-build

Added:
    directory/sandbox/felixk/studio-connection-core/   (with props)
    directory/sandbox/felixk/studio-connection-core/META-INF/
    directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF   (with props)
    directory/sandbox/felixk/studio-connection-core/plugin.properties   (with props)
    directory/sandbox/felixk/studio-connection-core/pom.xml   (with props)
    directory/sandbox/felixk/studio-connection-core/src/
    directory/sandbox/felixk/studio-connection-core/src/main/
    directory/sandbox/felixk/studio-connection-core/src/main/java/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IModificationLogger.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Messages.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/StudioProgressMonitor.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Utils.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionUpdateListener.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/CoreEventRunner.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/EventRunnable.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/event/EventRunner.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIOException.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionWrapper.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/CancelException.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/DummySSLSocketFactory.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDISubentriesControl.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/AbstractAsyncBulkJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/AbstractConnectionJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/CheckBindJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/CheckNetworkParameterJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/CloseConnectionsJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/OpenConnectionsJob.java   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/resources/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/studio/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/studio/connection/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/studio/connection/core/
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/studio/connection/core/XmlFileFormat.xslt   (with props)
    directory/sandbox/felixk/studio-connection-core/src/main/resources/org/apache/directory/studio/connection/core/messages.properties   (with props)

Propchange: directory/sandbox/felixk/studio-connection-core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov  5 06:45:40 2007
@@ -0,0 +1,3 @@
+.settings
+lib
+target

Added: directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF Mon Nov  5 06:45:40 2007
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Directory Studio Connection Core
+Bundle-SymbolicName: org.apache.directory.studio.connection.core
+Bundle-Version: 1.0.1
+Bundle-Activator: org.apache.directory.studio.connection.core.ConnectionCorePlugin
+Bundle-Vendor: Apache Software Foundation
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.apache.directory.studio.jars
+Eclipse-LazyStart: true
+Bundle-ClassPath: lib/commons-io-1.3.1.jar,
+ .
+Export-Package: org.apache.directory.studio.connection.core,
+ org.apache.directory.studio.connection.core.event,
+ org.apache.directory.studio.connection.core.io,
+ org.apache.directory.studio.connection.core.io.jndi,
+ org.apache.directory.studio.connection.core.jobs

Propchange: directory/sandbox/felixk/studio-connection-core/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/plugin.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/plugin.properties?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/plugin.properties (added)
+++ directory/sandbox/felixk/studio-connection-core/plugin.properties Mon Nov  5 06:45:40 2007
@@ -0,0 +1,19 @@
+#  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.
+project.name=Apache Directory Studio Connection Core
+project.version=1.0.1
+project.id=org.apache.directory.studio.connection.core

Propchange: directory/sandbox/felixk/studio-connection-core/plugin.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/pom.xml?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/pom.xml (added)
+++ directory/sandbox/felixk/studio-connection-core/pom.xml Mon Nov  5 06:45:40 2007
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<!--
+    @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+    @version $Id: pom.xml 353 2007-10-28 14:59:35Z felix $
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0.2-SNAPSHOT</version>
+    </parent>
+    <artifactId>${groupId}.connection.core</artifactId>
+    <name>Apache Directory Studio Connection Core</name>
+    <packaging>jar</packaging>
+
+    <description></description>
+
+    <!-- Set path for local repository -->
+    <properties>
+        <local-repo>${project.basedir}/../local-repository</local-repo>
+    </properties>
+
+    <profiles>
+        <profile>
+            <id>prepare-for-eclipse</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>prepare-for-eclipse</id>
+                                <phase>install</phase>
+                                <goals>
+                                    <goal>copy</goal>
+                                </goals>
+                                <configuration>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>lib</outputDirectory>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>commons-io</groupId>
+                                            <artifactId>commons-io</artifactId>
+                                            <type>jar</type>
+                                        </artifactItem>
+                                    </artifactItems>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>.</directory>
+                <includes>
+                    <include>plugin.properties</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <overWrite>true</overWrite>
+                            <outputDirectory>target/classes/lib</outputDirectory>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>commons-io</groupId>
+                                    <artifactId>commons-io</artifactId>
+                                    <type>jar</type>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+                        <addMavenDescriptor>false</addMavenDescriptor>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.eclipse</groupId>
+            <artifactId>org.eclipse.osgi</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse</groupId>
+            <artifactId>org.eclipse.core.jobs</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse</groupId>
+            <artifactId>org.eclipse.equinox.common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse</groupId>
+            <artifactId>org.eclipse.core.runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: directory/sandbox/felixk/studio-connection-core/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,309 @@
+/*
+ *  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.connection.core;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
+import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper;
+import org.eclipse.core.runtime.IAdaptable;
+
+
+/**
+ * The Connection class is the central .
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Connection implements ConnectionPropertyPageProvider, IAdaptable
+{
+
+    private ConnectionParameter connectionParameter;
+
+    private JNDIConnectionWrapper jndiConnectionWrapper;
+
+
+    /**
+     * Creates a new instance of Connection.
+     *
+     * @param connectionParameter
+     */
+    public Connection( ConnectionParameter connectionParameter )
+    {
+        this.connectionParameter = connectionParameter;
+    }
+
+
+    /**
+     * @see java.lang.Object#clone()
+     */
+    public Object clone()
+    {
+        ConnectionParameter cp = new ConnectionParameter( getName(), getHost(), getPort(), getEncryptionMethod(),
+            getAuthMethod(), getBindPrincipal(), getBindPassword(), getSaslRealm(), getConnectionParameter().getExtendedProperties() );
+
+        Connection clone = new Connection( cp );
+
+        return clone;
+    }
+
+
+    /**
+     * Gets the JNDI connection wrapper.
+     * 
+     * @return the JNDI connection wrapper
+     */
+    public JNDIConnectionWrapper getJNDIConnectionWrapper()
+    {
+        if ( jndiConnectionWrapper == null )
+        {
+            jndiConnectionWrapper = new JNDIConnectionWrapper( this );
+        }
+        return jndiConnectionWrapper;
+    }
+
+
+    /**
+     * Gets the connection parameter.
+     * 
+     * @return the connection parameter
+     */
+    public ConnectionParameter getConnectionParameter()
+    {
+        return connectionParameter;
+    }
+
+
+    /**
+     * Sets the connection parameter.
+     * 
+     * @param connectionParameter the connection parameter
+     */
+    public void setConnectionParameter( ConnectionParameter connectionParameter )
+    {
+        this.connectionParameter = connectionParameter;
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Gets the auth method.
+     * 
+     * @return the auth method
+     */
+    public AuthenticationMethod getAuthMethod()
+    {
+        return connectionParameter.getAuthMethod();
+    }
+
+
+    /**
+     * Gets the bind password.
+     * 
+     * @return the bind password
+     */
+    public String getBindPassword()
+    {
+        return connectionParameter.getBindPassword();
+    }
+
+
+    /**
+     * Gets the bind principal.
+     * 
+     * @return the bind principal
+     */
+    public String getBindPrincipal()
+    {
+        return connectionParameter.getBindPrincipal();
+    }
+
+
+    /**
+     * Gets the encryption method.
+     * 
+     * @return the encryption method
+     */
+    public EncryptionMethod getEncryptionMethod()
+    {
+        return connectionParameter.getEncryptionMethod();
+    }
+
+
+    /**
+     * Gets the id.
+     * 
+     * @return the id
+     */
+    public String getId()
+    {
+        return connectionParameter.getId();
+    }
+    
+    
+    /**
+     * Gets the host.
+     * 
+     * @return the host
+     */
+    public String getHost()
+    {
+        return connectionParameter.getHost();
+    }
+
+
+    /**
+     * Gets the name.
+     * 
+     * @return the name
+     */
+    public String getName()
+    {
+        return connectionParameter.getName();
+    }
+
+
+    /**
+     * Gets the port.
+     * 
+     * @return the port
+     */
+    public int getPort()
+    {
+        return connectionParameter.getPort();
+    }
+
+    
+    public String getSaslRealm ()
+    {
+    	return connectionParameter.getSaslRealm();
+    }
+
+    /**
+     * Sets the auth method.
+     * 
+     * @param authMethod the auth method
+     */
+    public void setAuthMethod( AuthenticationMethod authMethod )
+    {
+        connectionParameter.setAuthMethod( authMethod );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the bind password.
+     * 
+     * @param bindPassword the bind password
+     */
+    public void setBindPassword( String bindPassword )
+    {
+        connectionParameter.setBindPassword( bindPassword );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the bind principal.
+     * 
+     * @param bindPrincipal the bind principal
+     */
+    public void setBindPrincipal( String bindPrincipal )
+    {
+        connectionParameter.setBindPrincipal( bindPrincipal );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the encryption method.
+     * 
+     * @param encryptionMethod the encryption method
+     */
+    public void setEncryptionMethod( EncryptionMethod encryptionMethod )
+    {
+        connectionParameter.setEncryptionMethod( encryptionMethod );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the host.
+     * 
+     * @param host the host
+     */
+    public void setHost( String host )
+    {
+        connectionParameter.setHost( host );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the name.
+     * 
+     * @param name the name
+     */
+    public void setName( String name )
+    {
+        connectionParameter.setName( name );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+
+
+    /**
+     * Sets the port.
+     * 
+     * @param port the port
+     */
+    public void setPort( int port )
+    {
+        connectionParameter.setPort( port );
+        ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+    
+    
+    public void setSaslRealm (String realm)
+    {
+    	connectionParameter.setSaslRealm(realm);
+    	ConnectionEventRegistry.fireConnectionUpdated(this, this);
+    }
+    
+    
+    /**
+     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+     */
+    public Object getAdapter( Class adapter )
+    {
+        //        if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        //        {
+        //            return new LdapSearchPageScoreComputer();
+        //        }
+        if ( adapter == Connection.class )
+        {
+            return this;
+        }
+
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,34 @@
+/*
+ *  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.connection.core;
+
+
+/**
+ * Constants for the connection core plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConnectionCoreConstants
+{
+
+    /** The line separator. */
+    public static final String LINE_SEPARATOR = System.getProperty( "line.separator" ); //$NON-NLS-1$
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,185 @@
+/*
+ *  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.connection.core;
+
+
+import org.apache.directory.studio.connection.core.event.CoreEventRunner;
+import org.apache.directory.studio.connection.core.event.EventRunner;
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ConnectionCorePlugin extends Plugin
+{
+
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = "org.apache.directory.studio.connection.core";
+
+    /** The shared instance */
+    private static ConnectionCorePlugin plugin;
+
+    /** The connection manager */
+    private ConnectionManager connectionManager;
+
+    /** The connection folder manager */
+    private ConnectionFolderManager connectionFolderManager;
+
+    /** The event runner. */
+    private EventRunner eventRunner;
+
+    /** The credential provider */
+    private IAuthHandler authHandler;
+
+
+    /**
+     * The constructor
+     */
+    public ConnectionCorePlugin()
+    {
+        plugin = this;
+    }
+
+
+    /**
+     * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+
+        if ( eventRunner == null )
+        {
+            eventRunner = new CoreEventRunner();
+        }
+
+        if ( connectionManager == null )
+        {
+            connectionManager = new ConnectionManager();
+        }
+
+        if ( connectionFolderManager == null )
+        {
+            connectionFolderManager = new ConnectionFolderManager();
+        }
+    }
+
+
+    /**
+     * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+
+        if ( eventRunner != null )
+        {
+            eventRunner = null;
+        }
+
+        if ( connectionManager != null )
+        {
+            Connection[] connections = connectionManager.getConnections();
+            for ( int i = 0; i < connections.length; i++ )
+            {
+                connections[i].getJNDIConnectionWrapper().disconnect();
+            }
+            connectionManager = null;
+        }
+
+        if ( connectionFolderManager != null )
+        {
+            connectionFolderManager = null;
+        }
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static ConnectionCorePlugin getDefault()
+    {
+        return plugin;
+    }
+
+
+    /**
+     * Gets the Connection Manager
+     *
+     * @return
+     *      the connection manager
+     */
+    public ConnectionManager getConnectionManager()
+    {
+        return connectionManager;
+    }
+
+
+    /**
+     * Gets the connection folder manager.
+     *
+     * @return the connection folder manager
+     */
+    public ConnectionFolderManager getConnectionFolderManager()
+    {
+        return connectionFolderManager;
+    }
+
+
+    /**
+     * Gets the event runner.
+     *
+     * @return the event runner
+     */
+    public EventRunner getEventRunner()
+    {
+        return eventRunner;
+    }
+
+
+    /**
+     * Gets the AuthHandler
+     *
+     * @return
+     *      the AuthHandler
+     */
+    public IAuthHandler getAuthHandler()
+    {
+        return authHandler;
+    }
+
+
+    /**
+     * Sets the AuthHandler
+     *
+     * @param authHandler
+     *      the authHandler to set
+     */
+    public void setAuthHandler( IAuthHandler authHandler )
+    {
+        this.authHandler = authHandler;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,300 @@
+/*
+ *  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.connection.core;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+
+
+/**
+ * A ConnectionFolder helps to organize connections in folders.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionFolder implements Cloneable
+{
+    private String id;
+
+    private String name;
+
+    private List<String> subFolderIds;
+
+    private List<String> connectionIds;
+
+
+    /**
+     * Creates a new instance of ConnectionFolder.
+     */
+    public ConnectionFolder()
+    {
+        this.subFolderIds = new ArrayList<String>();
+        this.connectionIds = new ArrayList<String>();
+    }
+
+
+    /**
+     * Creates a new instance of ConnectionFolder.
+     * 
+     * @param name the folder name
+     */
+    public ConnectionFolder( String name )
+    {
+        this();
+        this.id = createId();
+        this.name = name;
+    }
+
+
+    /**
+     * @see java.lang.Object#clone()
+     */
+    public Object clone()
+    {
+        ConnectionFolder folder = new ConnectionFolder( getName() );
+
+        // clone connections
+        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
+        for ( String id : connectionIds )
+        {
+            Connection connection = connectionManager.getConnectionById( id );
+            if ( connection != null )
+            {
+                Connection newConnection = ( Connection ) connection.clone();
+                connectionManager.addConnection( newConnection );
+                folder.addConnectionId( newConnection.getId() );
+            }
+        }
+        
+        // clone subfolders
+        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault().getConnectionFolderManager();
+        for ( String id : subFolderIds )
+        {
+            ConnectionFolder subFolder = connectionFolderManager.getConnectionFolderById( id );
+            if ( subFolder != null )
+            {
+                ConnectionFolder newFolder = ( ConnectionFolder ) subFolder.clone();
+                connectionFolderManager.addConnectionFolder( newFolder );
+                folder.addSubFolderId( newFolder.getId() );
+            }
+        }
+
+        return folder;
+    }
+
+
+    /**
+     * Adds the connection id to the end of the connection list.
+     * 
+     * @param connectionId the connection id
+     */
+    public void addConnectionId( String connectionId )
+    {
+        connectionIds.add( connectionId );
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Removes the connection id from the connection list.
+     * 
+     * @param connectionId the connection id
+     */
+    public void removeConnectionId( String connectionId )
+    {
+        connectionIds.remove( connectionId );
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Adds the folder id to the end of the sub-folder list.
+     * 
+     * @param folderId the folder id
+     */
+    public void addSubFolderId( String folderId )
+    {
+        subFolderIds.add( folderId );
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Removes the connection folder from the sub-folder list.
+     * 
+     * @param folderId the folder id
+     */
+    public void removeSubFolderId( String folderId )
+    {
+        subFolderIds.remove( folderId );
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Gets the id.
+     * 
+     * @return the id
+     */
+    public String getId()
+    {
+        if ( id == null )
+        {
+            id = createId();
+        }
+        return id;
+    }
+
+
+    /**
+     * Sets the id.
+     * 
+     * @param id the new id
+     */
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+
+    /**
+     * Gets the name.
+     * 
+     * @return the name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Sets the name.
+     * 
+     * @param name the new name
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Gets the sub-folder ids.
+     * 
+     * @return the sub-folder ids
+     */
+    public List<String> getSubFolderIds()
+    {
+        List<String> ids = new ArrayList<String>();
+        for ( String id : subFolderIds )
+        {
+            if ( ConnectionCorePlugin.getDefault().getConnectionFolderManager().getConnectionFolderById( id ) != null )
+            {
+                ids.add( id );
+            }
+        }
+        return ids;
+    }
+
+
+    /**
+     * Sets the sub-folder ids.
+     * 
+     * @param subFolderIds the new sub-folder ids
+     */
+    public void setSubFolderIds( List<String> subFolderIds )
+    {
+        this.subFolderIds = subFolderIds;
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Gets the connection ids.
+     * 
+     * @return the connection ids
+     */
+    public List<String> getConnectionIds()
+    {
+        List<String> ids = new ArrayList<String>();
+        for ( String id : connectionIds )
+        {
+            if ( ConnectionCorePlugin.getDefault().getConnectionManager().getConnectionById( id ) != null )
+            {
+                ids.add( id );
+            }
+        }
+        return ids;
+    }
+
+
+    /**
+     * Sets the connection ids.
+     * 
+     * @param connectionIds the new connection ids
+     */
+    public void setConnectionIds( List<String> connectionIds )
+    {
+        this.connectionIds = connectionIds;
+        ConnectionEventRegistry.fireConnectonFolderModified( this, this );
+    }
+
+
+    /**
+     * Creates a unique id.
+     * 
+     * @return the created id
+     */
+    private String createId()
+    {
+        return UUID.randomUUID().toString();
+    }
+
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return getId().hashCode();
+    }
+
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof ConnectionFolder )
+        {
+            ConnectionFolder other = ( ConnectionFolder ) obj;
+            return getId().equals( other.getId() );
+        }
+        return false;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,417 @@
+/*
+ *  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.connection.core;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.connection.core.io.ConnectionIO;
+import org.apache.directory.studio.connection.core.io.ConnectionIOException;
+
+
+/**
+ * This class is used to manage {@link ConnectionFolder}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionFolderManager implements ConnectionUpdateListener
+{
+
+    /** The root connection folder. */
+    private ConnectionFolder root;
+
+    /** The list of folders. */
+    private Set<ConnectionFolder> folderList;
+
+
+    /**
+     * Creates a new instance of ConnectionFolderManager.
+     */
+    public ConnectionFolderManager()
+    {
+        this.root = new ConnectionFolder( "" );
+        this.root.setId( "0" ); //$NON-NLS-1$s
+        this.folderList = new HashSet<ConnectionFolder>();
+
+        loadConnectionFolders();
+        ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner() );
+
+        this.folderList.add( this.root );
+    }
+
+
+    /**
+     * Gets the filename of the connection folder store.
+     *
+     * @return
+     *      the filename of the connection folder store
+     */
+    public static final String getConnectionFolderStoreFileName()
+    {
+        String filename = ConnectionCorePlugin.getDefault().getStateLocation()
+            .append( "connectionFolders.xml" ).toOSString(); //$NON-NLS-1$
+        return filename;
+    }
+
+
+    /**
+     * Adds the ConnectionFolder to the connection folder list. If there is already a
+     * connection folder with the same name the new connection folder is renamed.
+     * 
+     * @param connectionFolder the connection folder
+     */
+    public void addConnectionFolder( ConnectionFolder connectionFolder )
+    {
+        if ( getConnectionFolderByName( connectionFolder.getName() ) != null )
+        {
+            String newConnectionFolderName = Messages.bind( Messages.copy_n_of_s, "", connectionFolder.getName() ); //$NON-NLS-1$
+            for ( int i = 2; getConnectionFolderByName( newConnectionFolderName ) != null; i++ )
+            {
+                newConnectionFolderName = Messages.bind( Messages.copy_n_of_s, i + " ", connectionFolder.getName() ); //$NON-NLS-1$
+            }
+            connectionFolder.setName( newConnectionFolderName );
+        }
+
+        folderList.add( connectionFolder );
+        ConnectionEventRegistry.fireConnectonFolderModified( connectionFolder, this );
+    }
+
+
+    /**
+     * Removes the given ConnectionFolder from the connection folder list.
+     *
+     * @param connectionFolder
+     *      the connection folder to remove
+     */
+    public void removeConnectionFolder( ConnectionFolder connectionFolder )
+    {
+        folderList.remove( connectionFolder );
+        ConnectionEventRegistry.fireConnectonFolderModified( connectionFolder, this );
+    }
+
+
+    /**
+     * Gets a connection folder from its id.
+     *
+     * @param id
+     *      the id of the connection folder
+     * @return
+     *      the corresponding connection folder
+     */
+    public ConnectionFolder getConnectionFolderById( String id )
+    {
+        for ( ConnectionFolder folder : folderList )
+        {
+            if ( folder.getId().equals( id ) )
+            {
+                return folder;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Gets a connection folder from its name.
+     *
+     * @param name
+     *      the name of the connection folder
+     * @return
+     *      the corresponding connection folder
+     */
+    public ConnectionFolder getConnectionFolderByName( String name )
+    {
+        for ( ConnectionFolder folder : folderList )
+        {
+            if ( folder.getName().equals( name ) )
+            {
+                return folder;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Gets the parent connection folder of the given connection.
+     *
+     * @param connection
+     *      the connection used to search the parent
+     * @return
+     *      the parent connection folder of the given connection
+     */
+    public ConnectionFolder getParentConnectionFolder( Connection connection )
+    {
+        for ( ConnectionFolder folder : folderList )
+        {
+            if ( folder.getConnectionIds().contains( connection.getId() ) )
+            {
+                return folder;
+            }
+        }
+        return getRootConnectionFolder();
+    }
+    
+    
+    /**
+     * Gets the parent connection folder of the given connection folder 
+     * or null if the folder doesn't have a parent folder.
+     *
+     * @param connectionFolder
+     *      the connection folder used to search the parent
+     * @return
+     *      the parent connection folder of the given connection folder
+     *      or null if the folder doesn't have a parent folder
+     */
+    public ConnectionFolder getParentConnectionFolder( ConnectionFolder connectionFolder )
+    {
+        for ( ConnectionFolder folder : folderList )
+        {
+            if ( folder.getSubFolderIds().contains( connectionFolder.getId() ) )
+            {
+                return folder;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Gets the all sub-folders of the given folder including the given folder.
+     * 
+     * @param folder the folder
+     * 
+     * @return all sub-folders
+     */
+    public Set<ConnectionFolder> getAllSubFolders( ConnectionFolder folder )
+    {
+        Set<ConnectionFolder> allSubFolders = new HashSet<ConnectionFolder>();
+        
+        List<String> ids = new ArrayList<String>();
+        ids.add( folder.getId() );
+        while ( !ids.isEmpty() )
+        {
+            String id = ids.remove( 0 );
+            ConnectionFolder subFolder = getConnectionFolderById( id );
+            allSubFolders.add( subFolder );
+            
+            ids.addAll( subFolder.getSubFolderIds() );
+        }
+        
+        return allSubFolders;
+    }
+
+
+    /**
+     * Gets the all parent folders of the given folder including the given folder.
+     * 
+     * @param folder the folder
+     * 
+     * @return all parent folders
+     */
+    public Set<ConnectionFolder> getAllParentFolders( ConnectionFolder folder )
+    {
+        Set<ConnectionFolder> allParentFolders = new HashSet<ConnectionFolder>();
+        
+        do
+        {
+            allParentFolders.add( folder );
+            folder = getParentConnectionFolder( folder );
+        }
+        while ( folder != null );
+        
+        return allParentFolders;
+    }
+    
+    
+    /**
+     * Gets the root connection folder.
+     * 
+     * @return the root connection folder
+     */
+    public ConnectionFolder getRootConnectionFolder()
+    {
+        return root;
+    }
+
+
+    /**
+     * Sets the root connection folder.
+     * 
+     * @param root the new root connection folder
+     */
+    public void setRootConnectionFolder( ConnectionFolder root )
+    {
+        this.root = root;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionAdded(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionAdded( Connection connection )
+    {
+        saveConnectionFolders();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRemoved(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionRemoved( Connection connection )
+    {
+        saveConnectionFolders();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionUpdated(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionUpdated( Connection connection )
+    {
+        saveConnectionFolders();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionOpened( Connection connection )
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionClosed( Connection connection )
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
+     */
+    public void connectionFolderModified( ConnectionFolder connectionFolder )
+    {
+        saveConnectionFolders();
+    }
+
+
+    /**
+     * Saves the Connection Folders
+     */
+    private synchronized void saveConnectionFolders()
+    {
+        // To avoid a corrupt file, save object to a temp file first 
+        try
+        {
+            ConnectionIO.saveConnectionFolders( folderList, new FileOutputStream( getConnectionFolderStoreFileName()
+                + "-temp" ) );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        // move temp file to good file
+        File file = new File( getConnectionFolderStoreFileName() );
+        File tempFile = new File( getConnectionFolderStoreFileName() + "-temp" );
+        if ( file.exists() )
+        {
+            file.delete();
+        }
+
+        try
+        {
+            String content = FileUtils.readFileToString( tempFile, "UTF-8" );
+            FileUtils.writeStringToFile( file, content, "UTF-8" );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * Loads the Connection Folders
+     */
+    private synchronized void loadConnectionFolders()
+    {
+        try
+        {
+            folderList = ConnectionIO.loadConnectionFolders( new FileInputStream( getConnectionFolderStoreFileName() ) );
+        }
+        catch ( Exception e )
+        {
+            // If loading failed, try with temp file
+            try
+            {
+                folderList = ConnectionIO.loadConnectionFolders( new FileInputStream(
+                    getConnectionFolderStoreFileName() + "-temp" ) );
+            }
+            catch ( FileNotFoundException e1 )
+            {
+                // TODO Auto-generated catch block
+            }
+            catch ( ConnectionIOException e1 )
+            {
+                // TODO Auto-generated catch block
+            }
+        }
+
+        if ( !folderList.isEmpty() )
+        {
+            for ( ConnectionFolder folder : folderList )
+            {
+                if ( "0".equals( folder.getId() ) )
+                {
+                    root = folder;
+                }
+            }
+        }
+        else
+        {
+            Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
+            for ( Connection connection : connections )
+            {
+                root.addConnectionId( connection.getId() );
+            }
+        }
+
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,314 @@
+/*
+ *  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.connection.core;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.connection.core.io.ConnectionIO;
+import org.apache.directory.studio.connection.core.io.ConnectionIOException;
+
+
+/**
+ * This class is used to manage {@link Connection}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionManager implements ConnectionUpdateListener
+{
+
+    /** The list of connections. */
+    private Set<Connection> connectionList;
+
+
+    /**
+     * Creates a new instance of ConnectionManager.
+     */
+    public ConnectionManager()
+    {
+        this.connectionList = new HashSet<Connection>();
+        loadConnections();
+        ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner() );
+    }
+
+
+    /**
+     * Gets the filename of the Connection Store.
+     *
+     * @return
+     *      the filename of the Connection Store
+     */
+    public static final String getConnectionStoreFileName()
+    {
+        String filename = ConnectionCorePlugin.getDefault().getStateLocation().append( "connections.xml" ).toOSString(); //$NON-NLS-1$
+        return filename;
+    }
+
+
+    /**
+     * Adds the connection to the end of the connection list. If there is
+     * already a connection with this name, the new connection is renamed.
+     *
+     * @param connection the connection to add
+     */
+    public void addConnection( Connection connection )
+    {
+        if ( getConnectionByName( connection.getConnectionParameter().getName() ) != null )
+        {
+            String newConnectionName = Messages.bind( Messages.copy_n_of_s,
+                "", connection.getConnectionParameter().getName() ); //$NON-NLS-1$
+            for ( int i = 2; getConnectionByName( newConnectionName ) != null; i++ )
+            {
+                newConnectionName = Messages.bind( Messages.copy_n_of_s,
+                    i + " ", connection.getConnectionParameter().getName() ); //$NON-NLS-1$
+            }
+            connection.getConnectionParameter().setName( newConnectionName );
+        }
+
+        connectionList.add( connection );
+        ConnectionEventRegistry.fireConnectionAdded( connection, this );
+    }
+
+
+    /**
+     * Gets a connection from its id.
+     *
+     * @param id
+     *      the id of the Connection
+     * @return
+     *      the corresponding Connection
+     */
+    public Connection getConnectionById( String id )
+    {
+        for ( Connection conn:connectionList )
+        {
+            if ( conn.getConnectionParameter().getId().equals( id ) )
+            {
+                return conn;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Gets a connection from its name.
+     *
+     * @param name
+     *      the name of the Connection
+     * @return
+     *      the corresponding Connection
+     */
+    public Connection getConnectionByName( String name )
+    {
+        for ( Connection conn:connectionList )
+        {
+            if ( conn.getConnectionParameter().getName().equals( name ) )
+            {
+                return conn;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Removes the given Connection from the Connection list.
+     *
+     * @param connection
+     *      the connection to remove
+     */
+    public void removeConnection( Connection connection )
+    {
+        connectionList.remove( connection );
+        ConnectionEventRegistry.fireConnectionRemoved( connection, this );
+    }
+
+
+    /**
+     * Gets an array containing all the Connections.
+     *
+     * @return
+     *      an array containing all the Connections
+     */
+    public Connection[] getConnections()
+    {
+        return ( Connection[] ) connectionList.toArray( new Connection[0] );
+    }
+
+
+    /**
+     * Gets the number of Connections.
+     *
+     * @return
+     *      the number of Connections
+     */
+    public int getConnectionCount()
+    {
+        return connectionList.size();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionAdded(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionAdded( Connection connection )
+    {
+        saveConnections();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRemoved(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionRemoved( Connection connection )
+    {
+        saveConnections();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionUpdated(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionUpdated( Connection connection )
+    {
+        saveConnections();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionOpened( Connection connection )
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
+     */
+    public void connectionClosed( Connection connection )
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
+     */
+    public void connectionFolderModified( ConnectionFolder connectionFolder )
+    {
+    }
+
+
+    /**
+     * Saves the Connections
+     */
+    private synchronized void saveConnections()
+    {
+        Set<ConnectionParameter> connectionParameters = new HashSet<ConnectionParameter>();
+        for ( Connection connection : connectionList )
+        {
+            connectionParameters.add( connection.getConnectionParameter() );
+        }
+
+        // To avoid a corrupt file, save object to a temp file first 
+        try
+        {
+            ConnectionIO.save( connectionParameters, new FileOutputStream( getConnectionStoreFileName() + "-temp" ) );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        // move temp file to good file
+        File file = new File( getConnectionStoreFileName() );
+        File tempFile = new File( getConnectionStoreFileName() + "-temp" );
+        if ( file.exists() )
+        {
+            file.delete();
+        }
+
+        try
+        {
+            String content = FileUtils.readFileToString( tempFile, "UTF-8" );
+            FileUtils.writeStringToFile( file, content, "UTF-8" );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * Loads the Connections
+     */
+    private synchronized void loadConnections()
+    {
+        Set<ConnectionParameter> connectionParameters = null;
+
+        try
+        {
+            connectionParameters = ConnectionIO.load( new FileInputStream( getConnectionStoreFileName() ) );
+        }
+        catch ( Exception e )
+        {
+            // If loading failed, try with temp file
+            try
+            {
+                connectionParameters = ConnectionIO
+                    .load( new FileInputStream( getConnectionStoreFileName() + "-temp" ) );
+            }
+            catch ( FileNotFoundException e1 )
+            {
+                // TODO Auto-generated catch block
+                return;
+            }
+            catch ( ConnectionIOException e1 )
+            {
+                // TODO Auto-generated catch block
+                return;
+            }
+        }
+
+        if ( connectionParameters != null )
+        {
+            for ( ConnectionParameter connectionParameter : connectionParameters )
+            {
+                Connection conn = new Connection( connectionParameter );
+                connectionList.add( conn );
+            }
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,502 @@
+/*
+ *  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.connection.core;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+
+/**
+ * A Bean class to hold the connection parameters.
+ * It is used to make connections persistent.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionParameter
+{
+
+    /**
+     * Enum for the used encryption method.
+     * 
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    public enum EncryptionMethod
+    {
+
+        /** No encryption. */
+        NONE,
+
+        /** SSL encryption. */
+        LDAPS,
+
+        /** Encryption using Start TLS extension. */
+        START_TLS
+    }
+
+    /**
+     * Enum for the used authentication method.
+     * 
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    public enum AuthenticationMethod
+    {
+
+        /** No authentication, anonymous bind. */
+        NONE,
+
+        /** Simple authentication, simple bind. */
+        SIMPLE,
+
+        /** SASL authentication using DIGEST-MD5. */
+        SASL_DIGEST_MD5,
+
+        /** SASL authentication using CRAM-MD5. */
+        SASL_CRAM_MD5,
+
+        /** SASL authentication using GSSAPI. */
+        SASL_GSSAPI
+
+    }
+
+    /** The unique id. */
+    private String id;
+
+    /** The symbolic name. */
+    private String name;
+    
+    /** The host name or IP address of the LDAP server. */
+    private String host;
+
+    /** The port of the LDAP server. */
+    private int port;
+
+    /** The encryption method. */
+    private EncryptionMethod encryptionMethod;
+
+    /** The authentication method. */
+    private AuthenticationMethod authMethod;
+
+    /** The bind principal, typically a DN. */
+    private String bindPrincipal;
+
+    /** The bind password. */
+    private String bindPassword;
+    
+    /** The SASL realm **/
+    private String saslRealm;
+
+    /** The extended properties. */
+    private Map<String, String> extendedProperties;
+
+
+
+    /**
+     * Creates a new instance of ConnectionParameter.
+     */
+    public ConnectionParameter()
+    {
+        this.extendedProperties = new HashMap<String, String>();
+    }
+
+
+    /**
+     * Creates a new instance of ConnectionParameter.
+     * 
+     * @param name the connection name
+     * @param host the host
+     * @param port the port
+     * @param encryptionMethod the encryption method
+     * @param authMethod the authentication method
+     * @param bindPrincipal the bind principal
+     * @param bindPassword the bind password
+     * @param extendedProperties the extended properties
+     */
+    public ConnectionParameter( String name, String host, int port, EncryptionMethod encryptionMethod,
+        AuthenticationMethod authMethod, String bindPrincipal, String bindPassword, String saslRealm,
+        Map<String, String> extendedProperties )
+    {
+        this.id = createId();
+        this.name = name;
+        this.host = host;
+        this.port = port;
+        this.encryptionMethod = encryptionMethod;
+        this.authMethod = authMethod;
+        this.bindPrincipal = bindPrincipal;
+        this.bindPassword = bindPassword;
+        this.saslRealm = saslRealm;
+        this.extendedProperties = new HashMap<String, String>();
+        if ( extendedProperties != null )
+        {
+            this.extendedProperties.putAll( extendedProperties );
+        }
+    }
+
+
+    /**
+     * Gets the auth method.
+     * 
+     * @return the auth method
+     */
+    public AuthenticationMethod getAuthMethod()
+    {
+        return authMethod;
+    }
+
+
+    /**
+     * Sets the auth method.
+     * 
+     * @param authMethod the auth method
+     */
+    public void setAuthMethod( AuthenticationMethod authMethod )
+    {
+        this.authMethod = authMethod;
+    }
+
+
+    /**
+     * Gets the bind password.
+     * 
+     * @return the bind password
+     */
+    public String getBindPassword()
+    {
+        return bindPassword;
+    }
+
+
+    /**
+     * Sets the bind password.
+     * 
+     * @param bindPassword the bind password
+     */
+    public void setBindPassword( String bindPassword )
+    {
+        this.bindPassword = bindPassword;
+    }
+    
+    
+    /**
+     * Gets the SASL realm
+     * @return the sasl realm
+     */
+    public String getSaslRealm (){
+    	return saslRealm;
+    }
+    
+    
+    /**
+     * Sets the SASL realm
+     * @param saslRealm the sasl realm
+     */
+    public void setSaslRealm (String saslRealm){
+    	this.saslRealm = saslRealm;
+    }
+
+
+    /**
+     * Gets the bind principal.
+     * 
+     * @return the bind principal
+     */
+    public String getBindPrincipal()
+    {
+        return bindPrincipal;
+    }
+
+
+    /**
+     * Sets the bind principal.
+     * 
+     * @param bindPrincipal the bind principal
+     */
+    public void setBindPrincipal( String bindPrincipal )
+    {
+        this.bindPrincipal = bindPrincipal;
+    }
+
+
+    /**
+     * Gets the encryption method.
+     * 
+     * @return the encryption method
+     */
+    public EncryptionMethod getEncryptionMethod()
+    {
+        return encryptionMethod;
+    }
+
+
+    /**
+     * Sets the encryption method.
+     * 
+     * @param encryptionMethod the encryption method
+     */
+    public void setEncryptionMethod( EncryptionMethod encryptionMethod )
+    {
+        this.encryptionMethod = encryptionMethod;
+    }
+
+
+    /**
+     * Gets the id.
+     * 
+     * @return the id
+     */
+    public String getId()
+    {
+        if ( id == null )
+        {
+            id = createId();
+        }
+        return id;
+    }
+
+
+    /**
+     * Sets the id.
+     * 
+     * @param id the id
+     */
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+
+    /**
+     * Gets the host.
+     * 
+     * @return the host
+     */
+    public String getHost()
+    {
+        return host;
+    }
+
+
+    /**
+     * Sets the host.
+     * 
+     * @param host the host
+     */
+    public void setHost( String host )
+    {
+        this.host = host;
+    }
+
+
+    /**
+     * Gets the name.
+     * 
+     * @return the name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Sets the name.
+     * 
+     * @param name the name
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the port.
+     * 
+     * @return the port
+     */
+    public int getPort()
+    {
+        return port;
+    }
+
+
+    /**
+     * Sets the port.
+     * 
+     * @param port the port
+     */
+    public void setPort( int port )
+    {
+        this.port = port;
+    }
+
+
+    /**
+     * Gets the extended properties.
+     * 
+     * @return the extended properties
+     */
+    public Map<String, String> getExtendedProperties()
+    {
+        return extendedProperties;
+    }
+
+
+    /**
+     * Sets the extended properties.
+     * 
+     * @param extendedProperties the extended properties
+     */
+    public void setExtendedProperties( Map<String, String> extendedProperties )
+    {
+        this.extendedProperties = extendedProperties;
+    }
+
+
+    /**
+     * Sets the extended property.
+     * 
+     * @param key the key
+     * @param value the value
+     */
+    public void setExtendedProperty( String key, String value )
+    {
+        extendedProperties.put( key, value );
+    }
+
+
+    /**
+     * Gets the extended property.
+     * 
+     * @param key the key
+     * 
+     * @return the extended property or null if the property doesn't exist
+     */
+    public String getExtendedProperty( String key )
+    {
+        return extendedProperties.get( key );
+    }
+
+
+    /**
+     * Sets the extended int property.
+     * 
+     * @param key the key
+     * @param value the value
+     */
+    public void setExtendedIntProperty( String key, int value )
+    {
+        extendedProperties.put( key, new Integer( value ).toString() );
+    }
+
+
+    /**
+     * Gets the extended int property.
+     * 
+     * @param key the key
+     * 
+     * @return the extended int property or -1 if the property doesn't exist
+     */
+    public int getExtendedIntProperty( String key )
+    {
+        String s = extendedProperties.get( key );
+        if ( s != null )
+        {
+            return new Integer( s ).intValue();
+        }
+        else
+        {
+            return -1;
+        }
+    }
+
+
+    /**
+     * Sets the extended bool property.
+     * 
+     * @param key the key
+     * @param value the value
+     */
+    public void setExtendedBoolProperty( String key, boolean value )
+    {
+        extendedProperties.put( key, Boolean.valueOf( value ).toString() );
+    }
+
+
+    /**
+     * Gets the extended bool property.
+     * 
+     * @param key the key
+     * 
+     * @return the extended bool property or false if the property doesn'T exist
+     */
+    public boolean getExtendedBoolProperty( String key )
+    {
+        String s = extendedProperties.get( key );
+        if ( s != null )
+        {
+            return Boolean.valueOf( s ).booleanValue();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Creates a unique id.
+     * 
+     * @return the created id
+     */
+    private String createId()
+    {
+        return UUID.randomUUID().toString();
+    }
+
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return getId().hashCode();
+    }
+
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof ConnectionParameter )
+        {
+            ConnectionParameter other = ( ConnectionParameter ) obj;
+            return getId().equals( other.getId() );
+        }
+        return false;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,38 @@
+/*
+ *  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.connection.core;
+
+
+import org.eclipse.core.runtime.IAdaptable;
+
+
+/**
+ * Tagging interface for objects that provide input for the connection
+ * property page. Implementations must also implement the IAdaptable interface
+ * and the getAdaptable() metho must return the right {@link Connection} object. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConnectionPropertyPageProvider extends IAdaptable
+{
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionPropertyPageProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.connection.core;
+
+
+/**
+ * Default implementation of ICredentials.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Credentials implements ICredentials
+{
+
+    /** The bind principal. */
+    private String bindPrincipal;
+
+    /** The bind password. */
+    private String bindPassword;
+
+    /** The connection parameter. */
+    private ConnectionParameter connectionParameter;
+
+
+    /**
+     * Creates a new instance of Credentials.
+     *
+     * @param bindPrincipal the bind principal, typically a DN
+     * @param bindPassword the bind password
+     * @param connectionParameter the connection parameter
+     */
+    public Credentials( String bindPrincipal, String bindPassword, ConnectionParameter connectionParameter )
+    {
+        this.bindPrincipal = bindPrincipal;
+        this.bindPassword = bindPassword;
+        this.connectionParameter = connectionParameter;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ConnectionParameter getConnectionParameter()
+    {
+        return connectionParameter;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBindPrincipal()
+    {
+        return bindPrincipal;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBindPassword()
+    {
+        return bindPassword;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Credentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,44 @@
+/*
+ *  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.connection.core;
+
+
+/**
+ * Callback interface to request credentials from a 
+ * higher-level layer (from the UI plugin).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IAuthHandler
+{
+
+    /**
+     * Gets credentials from this authentication handler. 
+     * The credentials are used to bind to the given connection. 
+     * The authentication handler may display a dialog to the user.
+     * 
+     * @param connectionParameter the connection to bind to
+     * @return the credentials
+     */
+    public ICredentials getCredentials( ConnectionParameter connectionParameter );
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/IAuthHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java?rev=592021&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java (added)
+++ directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java Mon Nov  5 06:45:40 2007
@@ -0,0 +1,56 @@
+/*
+ *  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.connection.core;
+
+
+/**
+ * An ICredential holds authentication information for a connection. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ICredentials
+{
+
+    /**
+     * Gets the connection parameter.
+     * 
+     * @return the connection parameter
+     */
+    public ConnectionParameter getConnectionParameter();
+
+
+    /**
+     * Gets the bind principal, typically a DN.
+     * 
+     * @return the bind principal
+     */
+    public String getBindPrincipal();
+
+
+    /**
+     * Gets the bind password.
+     * 
+     * @return the bind password
+     */
+    public String getBindPassword();
+
+}

Propchange: directory/sandbox/felixk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ICredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native