You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2010/07/20 11:28:27 UTC
svn commit: r965771 - in /directory/studio/trunk: ldapservers.apacheds.v156/
ldapservers.apacheds.v156/resources/conf/
ldapservers.apacheds.v156/src/main/java/org/
ldapservers.apacheds.v156/src/main/java/org/apache/
ldapservers.apacheds.v156/src/main/j...
Author: pamarcelot
Date: Tue Jul 20 09:28:26 2010
New Revision: 965771
URL: http://svn.apache.org/viewvc?rev=965771&view=rev
Log:
Moved implementation of the Apache DS 1.5.6 Server Adapter in its own plugin.
Added ProgressMonitor to the NewServer Wizard.
Added:
directory/studio/trunk/ldapservers.apacheds.v156/plugin.properties
directory/studio/trunk/ldapservers.apacheds.v156/plugin.xml
directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/
directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/
- copied from r964872, directory/studio/trunk/ldapservers.apacheds.v156/src/test/java/org/apache/directory/studio/ldapserver/apacheds/v156/
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156Plugin.java
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/Messages.java
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages.properties
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_de.properties
directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_fr.properties
Removed:
directory/studio/trunk/ldapservers.apacheds.v156/src/test/java/org/apache/directory/studio/ldapserver/apacheds/v156/
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.java
Modified:
directory/studio/trunk/ldapservers.apacheds.v156/pom.xml
directory/studio/trunk/ldapservers/plugin.xml
directory/studio/trunk/ldapservers/pom.xml
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java
Added: directory/studio/trunk/ldapservers.apacheds.v156/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/plugin.properties?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/plugin.properties (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/plugin.properties Tue Jul 20 09:28:26 2010
@@ -0,0 +1,18 @@
+# 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.
+
+Plugin_id=org.apache.directory.studio.ldapservers
\ No newline at end of file
Added: directory/studio/trunk/ldapservers.apacheds.v156/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/plugin.xml?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/plugin.xml (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/plugin.xml Tue Jul 20 09:28:26 2010
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.apache.directory.studio.ldapservers.ldapServerAdapters">
+ <ldapServerAdapter
+ class="org.apache.directory.studio.ldapserver.apacheds.v156.ApacheDS156LdapServerAdapter"
+ id="org.apache.directory.server.1.5.6"
+ name="Apache DS"
+ vendor="Apache Software Foundation"
+ version="1.5.6">
+ </ldapServerAdapter>
+ </extension>
+</plugin>
Modified: directory/studio/trunk/ldapservers.apacheds.v156/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/pom.xml?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/pom.xml (original)
+++ directory/studio/trunk/ldapservers.apacheds.v156/pom.xml Tue Jul 20 09:28:26 2010
@@ -113,7 +113,7 @@
<Bundle-SymbolicName>${groupId}.${artifactId};singleton:=true</Bundle-SymbolicName>
<Bundle-Localization>plugin</Bundle-Localization>
<Eclipse-LazyStart>true</Eclipse-LazyStart>
- <Bundle-Activator>org.apache.directory.studio.ldapservers.LdapServersPlugin</Bundle-Activator>
+ <Bundle-Activator>org.apache.directory.studio.ldapserver.apacheds.v156.ApacheDS156Plugin</Bundle-Activator>
<Require-Bundle>org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.jface.text,
Added: directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml Tue Jul 20 09:28:26 2010
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+
+<spring:beans xmlns="http://apacheds.org/config/1.5.6"
+ xmlns:spring="http://xbean.apache.org/schemas/spring/1.0"
+ xmlns:s="http://www.springframework.org/schema/beans">
+
+ <defaultDirectoryService id="directoryService" instanceId="default"
+ replicaId="1"
+ workingDirectory="example.com"
+ allowAnonymousAccess="true"
+ accessControlEnabled="false"
+ denormalizeOpAttrsEnabled="false"
+ syncPeriodMillis="15000"
+ maxPDUSize="2000000">
+ <systemPartition>
+ <!-- use the following partitionConfiguration to override defaults for -->
+ <!-- the system partition -->
+ <jdbmPartition id="system" cacheSize="100" suffix="ou=system" optimizerEnabled="true" syncOnWrite="true">
+ <indexedAttributes>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.1" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.2" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.3" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.4" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.5" cacheSize="10"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.6" cacheSize="10"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.7" cacheSize="10"/>
+ <jdbmIndex attributeId="ou" cacheSize="100"/>
+ <jdbmIndex attributeId="uid" cacheSize="100"/>
+ <jdbmIndex attributeId="objectClass" cacheSize="100"/>
+ </indexedAttributes>
+ </jdbmPartition>
+ </systemPartition>
+
+ <partitions>
+ <!-- NOTE: when specifying new partitions you need not include those -->
+ <!-- attributes below with OID's which are the system indices, if left -->
+ <!-- out they will be automatically configured for you with defaults. -->
+ <jdbmPartition id="example" cacheSize="100" suffix="dc=example,dc=com" optimizerEnabled="true"
+ syncOnWrite="true">
+ <indexedAttributes>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.1" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.2" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.3" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.4" cacheSize="100"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.5" cacheSize="10"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.6" cacheSize="10"/>
+ <jdbmIndex attributeId="1.3.6.1.4.1.18060.0.4.1.2.7" cacheSize="10"/>
+ <jdbmIndex attributeId="dc" cacheSize="100"/>
+ <jdbmIndex attributeId="ou" cacheSize="100"/>
+ <jdbmIndex attributeId="krb5PrincipalName" cacheSize="100"/>
+ <jdbmIndex attributeId="uid" cacheSize="100"/>
+ <jdbmIndex attributeId="objectClass" cacheSize="100"/>
+ </indexedAttributes>
+ </jdbmPartition>
+ </partitions>
+
+ <interceptors>
+ <normalizationInterceptor/>
+ <authenticationInterceptor/>
+ <referralInterceptor/>
+ <aciAuthorizationInterceptor/>
+ <defaultAuthorizationInterceptor/>
+ <exceptionInterceptor/>
+ <operationalAttributeInterceptor/>
+
+ <!-- Uncomment to enable the password policy interceptor
+ <passwordPolicyInterceptor/>
+ <keyDerivationInterceptor/>
+ -->
+
+ <schemaInterceptor/>
+ <subentryInterceptor/>
+ <collectiveAttributeInterceptor/>
+ <eventInterceptor/>
+ <triggerInterceptor/>
+
+ <!-- Uncomment to enable replication interceptor
+ <replicationInterceptor>
+ <configuration>
+ <replicationConfiguration serverPort="10390" peerReplicas="instance_b@localhost:10392">
+ <replicaId>
+ <replicaId id="instance_a"/>
+ </replicaId>
+ </replicationConfiguration>
+ </configuration>
+ </replicationInterceptor>
+ -->
+ </interceptors>
+
+ <!-- Uncomment to enable replication configuration -->
+ <!--replicationConfiguration>
+ <providers>
+ <provider id="1 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
+ <url>
+ ldap://ldap1.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
+ </url>
+ <connection bindMethod="simple">
+ <principal>
+ uid=admin,ou=system
+ </principal>
+ <credentials>secret</credentials>
+ </bind>
+ </provider>
+ <provider id="2 type="refreshAndPersist" timeLimit="1000" sizeLimit="1000">
+ <url>
+ ldaps://ldap2.acme.com:10389/ou=data,dc=acme,dc=com?*, +?sub?(objectClass=*)
+ </url>
+ <connection bindMethod="simple">
+ <principal>
+ uid=admin,ou=system
+ </principal>
+ <credentials>secret</credentials>
+ </bind>
+ </provider>
+ </providers>
+ </replicationConfiguration-->
+
+ </defaultDirectoryService>
+
+
+ <!--
+ +============================================================+
+ | ChangePassword server configuration |
+ +============================================================+
+ -->
+ <!-- missing atou=users,dc=example,dc=com
+ <changePasswordServer id="changePasswordServer">
+ <transports>
+ <tcpTransport port="60464" nbThreads="2" backLog="50"/>
+ <udpTransport port="60464" nbThreads="2" backLog="50"/>
+ </transports>
+ <directoryService>#directoryService</directoryService>
+ </changePasswordServer>
+-->
+
+ <!--
+ +============================================================+
+ | Kerberos server configuration |
+ +============================================================+
+ -->
+ <!-- missing atou=users,dc=example,dc=com
+ <kdcServer id="kdcServer">
+ <transports>
+ <tcpTransport port="60088" nbThreads="4" backLog="50"/>
+ <udpTransport port="60088" nbThreads="4" backLog="50"/>
+ </transports>
+ <directoryService>#directoryService</directoryService>
+ </kdcServer>
+-->
+
+ <!--
+ +============================================================+
+ | NtpServer configuration |
+ +============================================================+
+ -->
+ <!--ntpServer>
+ <transports>
+ <tcpTransport port="60123"/>
+ <udpTransport port="60123" nbThreads="1"/>
+ </transports>
+ </ntpServer-->
+
+ <!--
+ +============================================================+
+ | DnsServer configuration |
+ +============================================================+
+ -->
+ <!-- missing atou=users,dc=example,dc=com
+ <dnsServer>
+ <transports>
+ <tcpTransport port="8053"/>
+ <udpTransport port="8053"/>
+ </transports>
+ <directoryService>#directoryService</directoryService>
+ </dnsServer>
+-->
+
+ <!--
+ +============================================================+
+ | LDAP Service configuration |
+ +============================================================+
+ -->
+
+ <ldapServer id="ldapServer"
+ allowAnonymousAccess="false"
+ saslHost="ldap.example.com"
+ saslPrincipal="ldap/ldap.example.com@EXAMPLE.COM"
+ searchBaseDn="ou=users,ou=system"
+ maxTimeLimit="15000"
+ maxSizeLimit="1000">
+ <transports>
+ <tcpTransport address="0.0.0.0" port="10389" nbThreads="8" backLog="50" enableSSL="false"/>
+ <tcpTransport address="localhost" port="10636" enableSSL="true"/>
+ </transports>
+
+ <directoryService>#directoryService</directoryService>
+
+ <!-- The list of supported authentication mechanisms. -->
+ <saslMechanismHandlers>
+ <simpleMechanismHandler mech-name="SIMPLE"/>
+ <cramMd5MechanismHandler mech-name="CRAM-MD5" />
+ <digestMd5MechanismHandler mech-name="DIGEST-MD5" />
+ <gssapiMechanismHandler mech-name="GSSAPI" />
+ <ntlmMechanismHandler mech-name="NTLM" ntlmProviderFqcn="com.foo.Bar"/>
+ <ntlmMechanismHandler mech-name="GSS-SPNEGO" ntlmProviderFqcn="com.foo.Bar"/>
+ </saslMechanismHandlers>
+
+ <!-- The realms serviced by this SASL host, used by DIGEST-MD5 and GSSAPI. -->
+ <saslRealms>
+ <s:value>example.com</s:value>
+ <s:value>apache.org</s:value>
+ </saslRealms>
+
+ <!-- the collection of extended operation handlers to install -->
+ <extendedOperationHandlers>
+ <startTlsHandler/>
+ <gracefulShutdownHandler/>
+ <launchDiagnosticUiHandler/>
+ <!-- The Stored Procedure Extended Operation is not stable yet and it may cause security risks.-->
+ <!--storedProcedureExtendedOperationHandler/-->
+ </extendedOperationHandlers>
+ </ldapServer>
+
+ <apacheDS id="apacheDS">
+ <ldapServer>#ldapServer</ldapServer>
+ </apacheDS>
+
+ <!-- uncomment the below line to start the jetty(v6.1.14) http server
+ This can be used to provide access to the data present in DIT via http
+ using a web application
+ -->
+ <!--
+ <httpServer id="httpServer" port="7009" >
+ <webApps>
+ <webApp warFile="/path/to/war/file" contextPath="/myApp"/>
+ </webApps>
+ </httpServer>
+ -->
+</spring:beans>
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java Tue Jul 20 09:28:26 2010
@@ -0,0 +1,262 @@
+/*
+ * 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.ldapserver.apacheds.v156;
+
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import org.apache.directory.studio.common.CommonUiUtils;
+import org.apache.directory.studio.ldapservers.LdapServersManager;
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+import org.apache.directory.studio.ldapservers.model.LdapServerStatus;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+
+/**
+ * This class implements an LDAP Server Adapter for ApacheDS version 1.5.6.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ApacheDS156LdapServerAdapter implements LdapServerAdapter
+{
+ public void add( LdapServer server, IProgressMonitor monitor ) throws Exception
+ {
+ //
+ monitor.subTask( "verifying ApacheDS 1.5.6 libraries" );
+ verifyLibrariesFolder();
+
+ monitor.subTask( "copying ApacheDS 1.5.6 libraries" );
+
+ monitor.subTask( "creating server folder struture" );
+ File serverFolder = LdapServersManager.getServerFolder( server ).toFile();
+ File confFolder = new File( serverFolder, "conf" );
+ confFolder.mkdir();
+ // File serverSocketFolder = new File( serverFolder, "serverSocket" );
+ // serverSocketFolder.mkdir();
+ File ldifFolder = new File( serverFolder, "ldif" );
+ ldifFolder.mkdir();
+ File logFolder = new File( serverFolder, "log" );
+ logFolder.mkdir();
+ File partitionFolder = new File( serverFolder, "partitions" );
+ partitionFolder.mkdir();
+
+ // Checking if the Apache DS servers folder exists
+
+ // Creating the server folder
+ // IPath serverFolderPath = getApacheDsServersFolder().append( id );
+ // File serverFolder = new File( serverFolderPath.toOSString() );
+ // serverFolder.mkdir();
+ //
+ // // Creating the server sub folders ('conf', 'ldif', 'log' and 'partitions')
+ //
+ // // Copying default configuration files
+ // try
+ // {
+ // // Creating log4j.properties file
+ // File log4jPropertiesFile = new File( confFolder, "log4j.properties" );
+ // createServersLog4jPropertiesFile( new FileOutputStream( log4jPropertiesFile ), 1024, getServerLogsLevel(), // Setting 1024 as default port
+ // getServerLogsPattern() );
+ //
+ // // Copying server.xml file
+ // File serverXmlFile = new File( confFolder, "server.xml" );
+ // copyConfigurationFile( "server-1.5.6.xml", serverXmlFile );
+ //
+ // // Creating log4j.properties file to the serverSocket folder
+ // File log4jPropertiesServerSocketFile = new File( serverSocketFolder, "log4j.properties" );
+ // createServerSocketLog4jPropertiesFile( new FileOutputStream( log4jPropertiesServerSocketFile ), id );
+ // }
+ // catch ( IOException e )
+ // {
+ // ApacheDsPluginUtils
+ // .reportError( "An error occurred when copying the default configuration files to the server's folder '"
+ // + serverFolder.getAbsolutePath() + "'.\n\n" + e.getMessage() );
+ // }
+ }
+
+
+ public void delete( LdapServer server ) throws Exception
+ {
+ System.out.println( "delete " + server.getName() );
+ }
+
+
+ public void start( LdapServer server, IProgressMonitor monitor ) throws Exception
+ {
+ System.out.println( "start " + server.getName() );
+
+ Thread.sleep( 3000 );
+
+ server.setStatus( LdapServerStatus.STARTED );
+ }
+
+
+ public void stop( LdapServer server, IProgressMonitor monitor ) throws Exception
+ {
+ System.out.println( "stop " + server.getName() );
+
+ Thread.sleep( 3000 );
+
+ server.setStatus( LdapServerStatus.STOPPED );
+ }
+
+
+ /**
+ * TODO getLibraries.
+ *
+ * @return
+ */
+ private static String[] getLibraries()
+ {
+ return new String[]
+ { "antlr-2.7.7.jar", "apacheds-avl-partition-1.5.6.jar", "apacheds-core-1.5.6.jar",
+ "apacheds-core-annotations-1.5.6.jar", "apacheds-core-api-1.5.6.jar", "apacheds-core-avl-1.5.6.jar",
+ "apacheds-core-constants-1.5.6.jar", "apacheds-core-entry-1.5.6.jar", "apacheds-core-jndi-1.5.6.jar",
+ "apacheds-core-mock-1.5.6.jar", "apacheds-http-integration-1.5.6.jar", "apacheds-i18n-1.5.6.jar",
+ "apacheds-interceptor-kerberos-1.5.6.jar", "apacheds-jdbm-1.5.6.jar",
+ "apacheds-jdbm-partition-1.5.6.jar", "apacheds-jdbm-store-1.5.6.jar",
+ "apacheds-kerberos-shared-1.5.6.jar", "apacheds-launcher-1.5.0.jar",
+ "apacheds-ldif-partition-1.5.6.jar", "apacheds-protocol-changepw-1.5.6.jar",
+ "apacheds-protocol-dns-1.5.6.jar", "apacheds-protocol-kerberos-1.5.6.jar",
+ "apacheds-protocol-ldap-1.5.6.jar", "apacheds-protocol-ntp-1.5.6.jar",
+ "apacheds-protocol-shared-1.5.6.jar", "apacheds-server-jndi-1.5.6.jar",
+ "apacheds-server-xml-1.5.6.jar", "apacheds-utils-1.5.6.jar", "apacheds-xbean-spring-1.5.6.jar",
+ "apacheds-xdbm-base-1.5.6.jar", "apacheds-xdbm-search-1.5.6.jar", "apacheds-xdbm-tools-1.5.6.jar",
+ "bcprov-jdk15-140.jar", "commons-cli-1.2.jar", "commons-collections-3.2.1.jar",
+ "commons-daemon-1.0.1.jar", "commons-io-1.4.jar", "commons-lang-2.5.jar",
+ "daemon-bootstrappers-1.1.7.jar", "dom4j-1.6.1.jar", "jcl-over-slf4j-1.5.10.jar", "jetty-6.1.14.jar",
+ "jetty-util-6.1.14.jar", "junit-4.7.jar", "log4j-1.2.14.jar", "mina-core-2.0.0-RC1.jar",
+ "servlet-api-2.5-6.1.14.jar", "shared-asn1-0.9.18.jar", "shared-asn1-codec-0.9.18.jar",
+ "shared-cursor-0.9.18.jar", "shared-dsml-parser-0.9.18.jar", "shared-i18n-0.9.18.jar",
+ "shared-ldap-0.9.18.jar", "shared-ldap-constants-0.9.18.jar", "shared-ldap-converter-0.9.18.jar",
+ "shared-ldap-jndi-0.9.18.jar", "shared-ldap-schema-0.9.18.jar", "shared-ldap-schema-dao-0.9.18.jar",
+ "shared-ldap-schema-loader-0.9.18.jar", "shared-ldap-schema-manager-0.9.18.jar",
+ "shared-ldif-0.9.18.jar", "slf4j-api-1.5.10.jar", "slf4j-log4j12-1.5.10.jar",
+ "spring-beans-2.5.6.SEC01.jar", "spring-context-2.5.6.SEC01.jar", "spring-core-2.5.6.SEC01.jar",
+ "xbean-spring-3.5.jar", "xercesImpl-2.9.1.jar", "xpp3-1.1.4c.jar" };
+ }
+
+ private static final String RESOURCES = "resources";
+ private static final String LIBS = "libs";
+
+ /** The name of the libraries folder */
+ private static final String LIBRARIES_FOLDER_NAME = "libs";
+
+
+ /**
+ * Verifies that the libraries folder exists and contains the jar files
+ * needed to launch the server.
+ *
+ * @param server
+ * the server
+ */
+ public static void verifyLibrariesFolder()
+ {
+ // Libraries folder
+ IPath librariesFolderPath = ApacheDS156Plugin.getDefault().getStateLocation().append( LIBRARIES_FOLDER_NAME );
+ File librariesFolder = new File( librariesFolderPath.toOSString() );
+ if ( !librariesFolder.exists() )
+ {
+ librariesFolder.mkdir();
+ }
+
+ // Creating the path for the libs folder
+ IPath libsFolderPath = new Path( RESOURCES ).append( LIBS );
+
+ // Jar libraries
+ for ( String libraryFilename : getLibraries() )
+ {
+ IPath apachedsLibraryPath = librariesFolderPath.append( libraryFilename );
+ File apachedsLibrary = new File( apachedsLibraryPath.toOSString() );
+ if ( !apachedsLibrary.exists() )
+ {
+ try
+ {
+ copyResource( libsFolderPath.append( libraryFilename ), apachedsLibrary );
+ }
+ catch ( IOException e )
+ {
+ CommonUiUtils.reportError( "An error occurred when copying the library '" + libraryFilename
+ + "' to the location '" + apachedsLibrary.getAbsolutePath() + "'.\n\n" + e.getMessage() );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Copy the given resource.
+ *
+ * @param resource
+ * the path of the resource
+ * @param destination
+ * the destination
+ * @param server
+ * the server
+ * @throws IOException
+ * if an error occurs when copying the jar file
+ */
+ private static void copyResource( IPath resource, File destination ) throws IOException
+ {
+ // Getting he URL of the resource within the bundle
+ URL resourceUrl = FileLocator.find( ApacheDS156Plugin.getDefault().getBundle(), resource, null );
+
+ // Creating the input and output streams
+ InputStream resourceInputStream = resourceUrl.openStream();
+ FileOutputStream resourceOutputStream = new FileOutputStream( destination );
+
+ // Copying the resource
+ copyFile( resourceInputStream, resourceOutputStream );
+
+ // Closing the streams
+ resourceInputStream.close();
+ resourceOutputStream.close();
+ }
+
+
+ /**
+ * Copies a file from the given streams.
+ *
+ * @param inputStream
+ * the input stream
+ * @param outputStream
+ * the output stream
+ * @throws IOException
+ * if an error occurs when copying the file
+ */
+ private static void copyFile( InputStream inputStream, OutputStream outputStream ) throws IOException
+ {
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ( ( i = inputStream.read( buf ) ) != -1 )
+ {
+ outputStream.write( buf, 0, i );
+ }
+ }
+}
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156Plugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156Plugin.java?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156Plugin.java (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156Plugin.java Tue Jul 20 09:28:26 2010
@@ -0,0 +1,168 @@
+/*
+ * 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.ldapserver.apacheds.v156;
+
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.PropertyResourceBundle;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ApacheDS156Plugin extends AbstractUIPlugin
+{
+ /** The shared plugin instance. */
+ private static ApacheDS156Plugin plugin;
+
+ /** The plugin properties */
+ private PropertyResourceBundle properties;
+
+
+ /**
+ * The constructor
+ */
+ public ApacheDS156Plugin()
+ {
+ plugin = this;
+ }
+
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+ }
+
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ plugin = null;
+ super.stop( context );
+ }
+
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ApacheDS156Plugin getDefault()
+ {
+ return plugin;
+ }
+
+
+ /**
+ * Use this method to get SWT images. Use the IMG_ constants from
+ * BrowserWidgetsConstants for the key.
+ *
+ * @param key
+ * The key (relative path to the image in filesystem)
+ * @return The image descriptor or null
+ */
+ public ImageDescriptor getImageDescriptor( String key )
+ {
+ if ( key != null )
+ {
+ URL url = FileLocator.find( getBundle(), new Path( key ), null );
+ if ( url != null )
+ return ImageDescriptor.createFromURL( url );
+ else
+ return null;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * Use this method to get SWT images. Use the IMG_ constants from
+ * BrowserWidgetsConstants for the key. A ImageRegistry is used to manage the
+ * the key->Image mapping.
+ * <p>
+ * Note: Don't dispose the returned SWT Image. It is disposed
+ * automatically when the plugin is stopped.
+ *
+ * @param key
+ * The key (relative path to the image in filesystem)
+ * @return The SWT Image or null
+ */
+ public Image getImage( String key )
+ {
+ Image image = getImageRegistry().get( key );
+ if ( image == null )
+ {
+ ImageDescriptor id = getImageDescriptor( key );
+ if ( id != null )
+ {
+ image = id.createImage();
+ getImageRegistry().put( key, image );
+ }
+ }
+ return image;
+ }
+
+
+ /**
+ * Gets the plugin properties.
+ *
+ * @return
+ * the plugin properties
+ */
+ public PropertyResourceBundle getPluginProperties()
+ {
+ if ( properties == null )
+ {
+ try
+ {
+ properties = new PropertyResourceBundle( FileLocator.openStream( this.getBundle(), new Path(
+ "plugin.properties" ), false ) ); //$NON-NLS-1$
+ }
+ catch ( IOException e )
+ {
+ // We can't use the PLUGIN_ID constant since loading the plugin.properties file has failed,
+ // So we're using a default plugin id.
+ getLog().log(
+ new Status( Status.ERROR, "org.apache.directory.studio.ldapservers.apacheds.v156", Status.OK, //$NON-NLS-1$
+ Messages.getString( "ApacheDS156Plugin.UnableGetPluginProperties" ), e ) ); //$NON-NLS-1$
+ }
+ }
+
+ return properties;
+ }
+}
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/Messages.java?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/Messages.java (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/Messages.java Tue Jul 20 09:28:26 2010
@@ -0,0 +1,50 @@
+/*
+ * 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.ldapserver.apacheds.v156;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.connection.ui.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages.properties?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages.properties (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages.properties Tue Jul 20 09:28:26 2010
@@ -0,0 +1,18 @@
+# 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.
+
+ApacheDS156Plugin.UnableGetPluginProperties=Unable to get the plugin properties.
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_de.properties?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_de.properties (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_de.properties Tue Jul 20 09:28:26 2010
@@ -0,0 +1,18 @@
+# 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.
+
+ApacheDS156Plugin.UnableGetPluginProperties=Die Plugin Eigenschaften k\u00F6nnen nicht geladen werden.
Added: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_fr.properties?rev=965771&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_fr.properties (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/messages_fr.properties Tue Jul 20 09:28:26 2010
@@ -0,0 +1,18 @@
+# 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.
+
+ApacheDS156Plugin.UnableGetPluginProperties=Impossible de r\u00E9cup\u00E9rer les propri\u00E9t\u00E9s de ce plugin
Modified: directory/studio/trunk/ldapservers/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/plugin.xml?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/plugin.xml (original)
+++ directory/studio/trunk/ldapservers/plugin.xml Tue Jul 20 09:28:26 2010
@@ -11,13 +11,6 @@
vendor="Apache Software Foundation"
version="1.5.7">
</ldapServerAdapter>
- <ldapServerAdapter
- class="org.apache.directory.studio.ldapservers.apacheds.ApacheDS156LdapServerAdapter"
- id="org.apache.directory.server.1.5.6"
- name="Apache DS"
- vendor="Apache Software Foundation"
- version="1.5.6">
- </ldapServerAdapter>
</extension>
<extension
Modified: directory/studio/trunk/ldapservers/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/pom.xml?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/pom.xml (original)
+++ directory/studio/trunk/ldapservers/pom.xml Tue Jul 20 09:28:26 2010
@@ -119,7 +119,8 @@
org.eclipse.jface.text,
org.eclipse.ui.ide,
org.apache.directory.studio.jars,
- org.apache.directory.studio.common.ui
+ org.apache.directory.studio.common.ui,
+ org.apache.directory.studio.ldapbrowser.ui
</Require-Bundle>
<Export-Package>org.apache.directory.studio.*</Export-Package>
<Import-Package>!</Import-Package>
@@ -159,6 +160,11 @@
<artifactId>common.ui</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>ldapbrowser.ui</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!-- Eclipse plugins dependencies -->
<dependency>
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java Tue Jul 20 09:28:26 2010
@@ -431,7 +431,6 @@ public class LdapServersManager
{
if ( server != null )
{
-
return getServersFolder().append( server.getId() );
}
@@ -449,9 +448,19 @@ public class LdapServersManager
{
if ( server != null )
{
- // Creating the server folder
+ // Creating if needed the 'servers' folder
+ File serversFolder = getServersFolder().toFile();
+ if ( !serversFolder.exists() )
+ {
+ serversFolder.mkdir();
+ }
+
+ // Creating the specific server folder
File serverFolder = getServerFolder( server ).toFile();
- serverFolder.mkdir();
+ if ( !serverFolder.exists() )
+ {
+ serverFolder.mkdir();
+ }
}
}
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java Tue Jul 20 09:28:26 2010
@@ -35,7 +35,7 @@ import org.eclipse.core.runtime.IProgres
*/
public class ApacheDS157LdapServerAdapter implements LdapServerAdapter
{
- public void add( LdapServer server ) throws Exception
+ public void add( LdapServer server, IProgressMonitor monitor ) throws Exception
{
System.out.println( "add " + server.getName() );
}
@@ -50,7 +50,7 @@ public class ApacheDS157LdapServerAdapte
public void start( LdapServer server, IProgressMonitor monitor ) throws Exception
{
System.out.println( "start " + server.getName() );
-
+
Thread.sleep( 3000 );
server.setStatus( LdapServerStatus.STARTED );
@@ -60,7 +60,7 @@ public class ApacheDS157LdapServerAdapte
public void stop( LdapServer server, IProgressMonitor monitor ) throws Exception
{
System.out.println( "stop " + server.getName() );
-
+
Thread.sleep( 3000 );
server.setStatus( LdapServerStatus.STOPPED );
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java Tue Jul 20 09:28:26 2010
@@ -39,7 +39,7 @@ public interface LdapServerAdapter
* the server
* @throws Exception
*/
- public void add( LdapServer server ) throws Exception;
+ public void add( LdapServer server, IProgressMonitor monitor ) throws Exception;
/**
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersView.java Tue Jul 20 09:28:26 2010
@@ -44,6 +44,7 @@ import org.eclipse.swt.events.SelectionE
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.IMemento;
@@ -100,19 +101,19 @@ public class ServersView extends ViewPar
{
public void serverAdded( LdapServer server )
{
- tableViewer.refresh();
+ asyncRefresh();
}
public void serverRemoved( LdapServer server )
{
- tableViewer.refresh();
+ asyncRefresh();
}
public void serverUpdated( LdapServer server )
{
- tableViewer.refresh();
+ asyncRefresh();
}
};
@@ -514,4 +515,19 @@ public class ServersView extends ViewPar
super.dispose();
}
+
+
+ /**
+ * Refreshes the Servers View asynchronously.
+ */
+ private void asyncRefresh()
+ {
+ Display.getDefault().asyncExec( new Runnable()
+ {
+ public void run()
+ {
+ tableViewer.refresh();
+ }
+ } );
+ }
}
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java?rev=965771&r1=965770&r2=965771&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/wizards/NewServerWizard.java Tue Jul 20 09:28:26 2010
@@ -23,6 +23,8 @@ package org.apache.directory.studio.ldap
import org.apache.directory.studio.ldapservers.LdapServersManager;
import org.apache.directory.studio.ldapservers.model.LdapServer;
import org.apache.directory.studio.ldapservers.model.LdapServerAdapterExtension;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
@@ -55,24 +57,46 @@ public class NewServerWizard extends Wiz
*/
public boolean performFinish()
{
- // Creating the new server
- LdapServer server = new LdapServer();
- server.setName( page.getServerName() );
+ // Getting server name and adapter extension
+ final String serverName = page.getServerName();
+ final LdapServerAdapterExtension adapterExtension = page.getLdapServerAdapterExtension();
- // Getting the LDAP Server Adapter Extension associated with the server
- LdapServerAdapterExtension ldapServerAdapterExtension = page.getLdapServerAdapterExtension();
- server.setLdapServerAdapterExtension( ldapServerAdapterExtension );
-
- // Adding the new server to the servers handler
- LdapServersManager.getDefault().addServer( server );
-
- // Creating the folder for the new server
- LdapServersManager.createNewServerFolder( server );
-
- // Letting the LDAP Server Adapter finish the creation of the server
try
{
- ldapServerAdapterExtension.getInstance().add( server );
+ getContainer().run( true, false, new IRunnableWithProgress()
+ {
+ public void run( IProgressMonitor monitor )
+ {
+ // Setting the title
+ monitor.beginTask( "Creating LDAP Server: ", IProgressMonitor.UNKNOWN );
+ monitor.subTask( "creating server folder" );
+
+ // Creating the new server
+ LdapServer server = new LdapServer();
+ server.setName( serverName );
+ server.setLdapServerAdapterExtension( adapterExtension );
+
+ // Adding the new server to the servers handler
+ LdapServersManager.getDefault().addServer( server );
+
+ // Creating the folder for the new server
+ LdapServersManager.createNewServerFolder( server );
+
+ // Letting the LDAP Server Adapter finish the creation of the server
+ try
+ {
+ adapterExtension.getInstance().add( server, monitor );
+ }
+ catch ( Exception e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ // Reporting to the monitor that we're done
+ monitor.done();
+ }
+ } );
}
catch ( Exception e )
{
@@ -89,6 +113,6 @@ public class NewServerWizard extends Wiz
*/
public void init( IWorkbench workbench, IStructuredSelection selection )
{
- setNeedsProgressMonitor( false );
+ setNeedsProgressMonitor( true );
}
}