Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 54906 invoked from network); 20 Jul 2010 09:30:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Jul 2010 09:30:02 -0000 Received: (qmail 51305 invoked by uid 500); 20 Jul 2010 09:30:01 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 51262 invoked by uid 500); 20 Jul 2010 09:30:00 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 51255 invoked by uid 99); 20 Jul 2010 09:29:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jul 2010 09:29:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jul 2010 09:29:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DE15C23889DA; Tue, 20 Jul 2010 09:28:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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... Date: Tue, 20 Jul 2010 09:28:27 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100720092827.DE15C23889DA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ + + + + + + + + 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 @@ ${groupId}.${artifactId};singleton:=true plugin true - org.apache.directory.studio.ldapservers.LdapServersPlugin + org.apache.directory.studio.ldapserver.apacheds.v156.ApacheDS156Plugin 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #directoryService + + + + + + + + + + + + + + example.com + apache.org + + + + + + + + + + + + + + #ldapServer + + + + + 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 Apache Directory Project + */ +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. + *

+ * 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"> - - org.apache.directory.studio.* ! @@ -159,6 +160,11 @@ common.ui provided + + org.apache.directory.studio + ldapbrowser.ui + provided + 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 ); } }