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/12 17:04:30 UTC
svn commit: r963311 [1/2] - in /directory/studio/trunk/ldapservers: ./
resources/ resources/icons/
resources/org/apache/directory/studio/ldapservers/
src/main/java/org/apache/directory/studio/ldapservers/
src/main/java/org/apache/directory/studio/ldaps...
Author: pamarcelot
Date: Mon Jul 12 15:04:29 2010
New Revision: 963311
URL: http://svn.apache.org/viewvc?rev=963311&view=rev
Log:
Redefined and imported classes and resources from the Apache DS plugin, in order to reproduces basic functionalities like the Servers View.
Various modifications made to the original files.
Added:
directory/studio/trunk/ldapservers/resources/icons/
directory/studio/trunk/ldapservers/resources/icons/server.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_started.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_starting1.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_starting2.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_starting3.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_stopped.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_stopping1.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_stopping2.gif (with props)
directory/studio/trunk/ldapservers/resources/icons/server_stopping3.gif (with props)
directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java
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/LdapServersManagerIO.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIOException.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerListener.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.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/
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/AbstractLdapServerInstance.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.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/model/LdapServerAdapterExtension.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEvent.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEventType.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerListener.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerStatus.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/Messages.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServerAdaptersView.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersTableViewer.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/views/ServersViewContentProvider.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersViewLabelProvider.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServersViewerComparator.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/messages.properties
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/messages_de.properties
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/messages_fr.properties
directory/studio/trunk/ldapservers/src/main/resources/ldapservers/
- copied from r961793, directory/studio/trunk/ldapservers/resources/org/apache/directory/studio/ldapservers/
Removed:
directory/studio/trunk/ldapservers/resources/org/apache/directory/studio/ldapservers/
Modified:
directory/studio/trunk/ldapservers/plugin.xml
directory/studio/trunk/ldapservers/pom.xml
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java
directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java
Modified: directory/studio/trunk/ldapservers/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/plugin.xml?rev=963311&r1=963310&r2=963311&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/plugin.xml (original)
+++ directory/studio/trunk/ldapservers/plugin.xml Mon Jul 12 15:04:29 2010
@@ -1,4 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="ldapServerAdapters" name="LDAP Server Adapters" schema="resources/ldapServerAdapters.exsd"/>
+ <extension
+ point="org.apache.directory.studio.ldapservers.ldapServerAdapters">
+ <ldapServerAdapter
+ class="org.apache.directory.studio.ldapservers.apacheds.ApacheDS157LdapServerAdapter"
+ id="org.apache.directory.server.1.5.7"
+ name="Apache DS"
+ vendorName="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"
+ vendorName="Apache Software Foundation"
+ version="1.5.6">
+ </ldapServerAdapter>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.apache.directory.studio.ldapservers.view.category"
+ name="LDAP Servers" />
+ <view
+ category="org.apache.directory.studio.ldapservers.view.category"
+ class="org.apache.directory.studio.ldapservers.views.ServerAdaptersView"
+ id="org.apache.directory.studio.ldapservers.views.ServerAdaptersView"
+ name="LDAP Server Adapters" />
+ <view
+ category="org.apache.directory.studio.ldapservers.view.category"
+ class="org.apache.directory.studio.ldapservers.views.ServersView"
+ id="org.apache.directory.studio.ldapservers.views.ServersView"
+ name="LDAP Servers" />
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective">
+ <view
+ closeable="true"
+ id="org.apache.directory.studio.ldapservers.views.ServersView"
+ minimized="false"
+ moveable="true"
+ relationship="stack"
+ relative="org.apache.directory.studio.ldapbrowser.ui.views.connection.ConnectionView"
+ showTitle="true"
+ visible="true">
+ </view>
+ </perspectiveExtension>
+ </extension>
</plugin>
Modified: directory/studio/trunk/ldapservers/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/pom.xml?rev=963311&r1=963310&r2=963311&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/pom.xml (original)
+++ directory/studio/trunk/ldapservers/pom.xml Mon Jul 12 15:04:29 2010
@@ -117,7 +117,8 @@
<Require-Bundle>org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.jface.text,
- org.apache.directory.studio.jars
+ org.apache.directory.studio.jars,
+ org.apache.directory.studio.common.ui
</Require-Bundle>
<Export-Package>org.apache.directory.studio.*</Export-Package>
<Import-Package>!</Import-Package>
@@ -152,6 +153,11 @@
<artifactId>jars</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>common.ui</artifactId>
+ <scope>provided</scope>
+ </dependency>
<!-- Eclipse plugins dependencies -->
<dependency>
Added: directory/studio/trunk/ldapservers/resources/icons/server.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_started.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_started.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_started.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_starting1.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_starting1.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_starting1.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_starting2.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_starting2.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_starting2.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_starting3.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_starting3.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_starting3.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_stopped.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_stopped.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_stopped.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_stopping1.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_stopping1.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_stopping1.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_stopping2.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_stopping2.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_stopping2.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/icons/server_stopping3.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/icons/server_stopping3.gif?rev=963311&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/ldapservers/resources/icons/server_stopping3.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd (added)
+++ directory/studio/trunk/ldapservers/resources/ldapServerAdapters.exsd Mon Jul 12 15:04:29 2010
@@ -0,0 +1,147 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.directory.studio.ldapservers" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.apache.directory.studio.ldapservers" id="ldapServerAdapters" name="LDAP Server Adapters"/>
+ </appinfo>
+ <documentation>
+ This extension point defines a way to add LDAP Server Adapters to the LDAP Servers plugin of Apache Directory Studio.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="ldapServerAdapter" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ldapServerAdapter">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The id of the LDAP Server Adapter
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="vendorName" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+ The icon of the LDAP Server Adapter
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the LDAP Server Adapter
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.apache.directory.studio.ldapservers.LdapServerAdapter"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 2.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServerAdapterExtensionsManager.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,158 @@
+/*
+ * 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.ldapservers;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapterExtension;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LDAP Server Extensions Manager.
+ * <p>
+ * It is used to store all the LDAP Server Extensions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServerAdapterExtensionsManager
+{
+ /** The default instance */
+ private static LdapServerAdapterExtensionsManager instance;
+
+ /** The list and map for LDAP Server Adapter Extensions */
+ private List<LdapServerAdapterExtension> ldapServerAdapterExtensionsList;
+
+ /** The map and map for LDAP Server Adapter Extensions */
+ private Map<String, LdapServerAdapterExtension> ldapServerAdapterExtensionsByIdMap;
+
+
+ /**
+ * Creates a new instance of LdapServerAdapterExtensionsManager.
+ */
+ private LdapServerAdapterExtensionsManager()
+ {
+ }
+
+
+ /**
+ * Loads the LDAP Server Adapter Extensions.
+ */
+ public void loadLdapServerAdapterExtensions()
+ {
+ // Initializing the list and map for LDAP Server Adapter Extensions
+ ldapServerAdapterExtensionsList = new ArrayList<LdapServerAdapterExtension>();
+ ldapServerAdapterExtensionsByIdMap = new HashMap<String, LdapServerAdapterExtension>();
+
+ // Getting members of LDAP Server Adapters Extension Point
+ IConfigurationElement[] members = Platform.getExtensionRegistry()
+ .getExtensionPoint( LdapServersPluginConstants.LDAP_SERVER_ADAPTERS_EXTENSION_POINT )
+ .getConfigurationElements();
+
+ // Creating an object associated with each member
+ for ( IConfigurationElement member : members )
+ {
+ // Creating the LdapServerAdapterExtension object container
+ LdapServerAdapterExtension ldapServerAdapterExtension = new LdapServerAdapterExtension();
+
+ // Getting the ID of the extending plugin
+ String extendingPluginId = member.getDeclaringExtension().getNamespaceIdentifier();
+
+ // Setting
+ ldapServerAdapterExtension.setId( member.getAttribute( "id" ) );
+ ldapServerAdapterExtension.setName( member.getAttribute( "name" ) );
+ ldapServerAdapterExtension.setVersion( member.getAttribute( "version" ) );
+ ldapServerAdapterExtension.setVendorName( member.getAttribute( "vendorName" ) );
+ ldapServerAdapterExtension.setClassName( member.getAttribute( "class" ) );
+ ldapServerAdapterExtension.setDescription( member.getAttribute( "description" ) );
+ String iconPath = member.getAttribute( "icon" );
+ if ( iconPath != null )
+ {
+ ImageDescriptor icon = AbstractUIPlugin.imageDescriptorFromPlugin( extendingPluginId, iconPath );
+ if ( icon == null )
+ {
+ icon = ImageDescriptor.getMissingImageDescriptor();
+ }
+ ldapServerAdapterExtension.setIcon( icon );
+ }
+
+ // TODO uncomment this...
+ // try
+ // {
+ // bean.setEditorInstance( ( IEntryEditor ) member.createExecutableExtension( CLASS_ATTR ) );
+ // }
+ // catch ( CoreException e )
+ // {
+ // // Will never happen
+ // }
+
+ ldapServerAdapterExtensionsList.add( ldapServerAdapterExtension );
+ ldapServerAdapterExtensionsByIdMap.put( ldapServerAdapterExtension.getId(), ldapServerAdapterExtension );
+ }
+ }
+
+
+ /**
+ * Gets the default {@link LdapServerAdapterExtensionsManager} (singleton pattern).
+ *
+ * @return
+ * the default {@link LdapServerAdapterExtensionsManager}
+ */
+ public static LdapServerAdapterExtensionsManager getDefault()
+ {
+ if ( instance == null )
+ {
+ instance = new LdapServerAdapterExtensionsManager();
+ }
+
+ return instance;
+ }
+
+
+ /**
+ * Gets the LDAP Server Adapter Extensions list.
+ *
+ * @return
+ * the LDAP Server Adapter Extensions list.
+ */
+ public List<LdapServerAdapterExtension> getLdapServerAdapterExtensions()
+ {
+ return ldapServerAdapterExtensionsList;
+ }
+
+
+ /**
+ * Gets the LDAP Server Adapter Extension associated with the given id.
+ *
+ * @return
+ * the LDAP Server Adapter Extension associated with the given id.
+ */
+ public LdapServerAdapterExtension getLdapServerAdapterExtensionById( String id )
+ {
+ return ldapServerAdapterExtensionsByIdMap.get( id );
+ }
+}
Added: 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=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManager.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,421 @@
+/*
+ * 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.ldapservers;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.studio.common.CommonUiUtils;
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.eclipse.core.runtime.IPath;
+
+
+/**
+ * This class implements the LDAP Servers Manager.
+ * <p>
+ * It is used to store all the LDAP Servers used and defined in the plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServersManager
+{
+ /** The default instance */
+ private static LdapServersManager instance;
+
+ /** The list of servers */
+ private List<LdapServer> serversList;
+
+ /** The map of servers identified by ID */
+ private Map<String, LdapServer> serversIdMap;
+
+ /** The listeners */
+ private List<LdapServersManagerListener> listeners;
+
+
+ /**
+ * Creates a new instance of ServersHandler.
+ */
+ private LdapServersManager()
+ {
+ }
+
+
+ /**
+ * Gets the default servers handler (singleton pattern).
+ *
+ * @return
+ * the default servers handler
+ */
+ public static LdapServersManager getDefault()
+ {
+ if ( instance == null )
+ {
+ instance = new LdapServersManager();
+ }
+
+ return instance;
+ }
+
+
+ /**
+ * Adds a server.
+ *
+ * @param server
+ * the server to be added
+ */
+ public void addServer( LdapServer server )
+ {
+ addServer( server, true );
+
+ saveServersToStore();
+ }
+
+
+ /**
+ * Adds a server.
+ *
+ * @param server
+ * the server to be added
+ * @param notifyListeners
+ * <code>true</code> if the listeners need to be notified,
+ * <code>false</code> if not.
+ */
+ private void addServer( LdapServer server, boolean notifyListeners )
+ {
+ if ( !serversList.contains( server ) )
+ {
+ // Adding the server
+ serversList.add( server );
+ serversIdMap.put( server.getId(), server );
+
+ // Notifying listeners
+ if ( notifyListeners )
+ {
+ for ( LdapServersManagerListener listener : listeners.toArray( new LdapServersManagerListener[0] ) )
+ {
+ listener.serverAdded( server );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Removes a server.
+ *
+ * @param server
+ * the server to be removed
+ */
+ public void removeServer( LdapServer server )
+ {
+ removeServer( server, true );
+
+ saveServersToStore();
+ }
+
+
+ /**
+ * Removes a server.
+ *
+ * @param server
+ * the server to be removed
+ * @param notifyListeners
+ * <code>true</code> if the listeners need to be notified,
+ * <code>false</code> if not.
+ */
+ private void removeServer( LdapServer server, boolean notifyListeners )
+ {
+ if ( serversList.contains( server ) )
+ {
+ // Removing the server
+ serversList.remove( server );
+ serversIdMap.remove( server.getId() );
+
+ // Notifying listeners
+ if ( notifyListeners )
+ {
+ for ( LdapServersManagerListener listener : listeners.toArray( new LdapServersManagerListener[0] ) )
+ {
+ listener.serverRemoved( server );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Indicates if the server handler contains the given server.
+ *
+ * @param server
+ * the server
+ * @return
+ * <code>true</code> if the server hander contains the given server,
+ * <code>false</code> if not
+ */
+ public boolean containsServer( LdapServer server )
+ {
+ return serversList.contains( server );
+ }
+
+
+ /**
+ * Adds a listener to the servers handler.
+ *
+ * @param listener
+ * the listener to add
+ */
+ public void addListener( LdapServersManagerListener listener )
+ {
+ if ( !listeners.contains( listener ) )
+ {
+ listeners.add( listener );
+ }
+ }
+
+
+ /**
+ * Removes a listener to the servers handler.
+ *
+ * @param listener
+ * the listener to remove
+ */
+ public void removeListener( LdapServersManagerListener listener )
+ {
+ if ( listeners.contains( listener ) )
+ {
+ listeners.remove( listener );
+ }
+ }
+
+
+ /**
+ * Loads the server from the file store.
+ */
+ public void loadServersFromStore()
+ {
+ // Initializing lists and maps
+ serversList = new ArrayList<LdapServer>();
+ serversIdMap = new HashMap<String, LdapServer>();
+ listeners = new ArrayList<LdapServersManagerListener>();
+
+ File store = getServersStorePath().toFile();
+ File tempStore = getServersStoreTempPath().toFile();
+ boolean loadFailed = false;
+ String exceptionMessage = ""; //$NON-NLS-1$
+
+ // We try to load the servers file
+ if ( store.exists() )
+ {
+ try
+ {
+ InputStream inputStream = new FileInputStream( store );
+ List<LdapServer> servers = LdapServersManagerIO.read( inputStream );
+ for ( LdapServer server : servers )
+ {
+ addServer( server, false );
+ }
+ return;
+ }
+ catch ( FileNotFoundException e )
+ {
+ loadFailed = true;
+ exceptionMessage = e.getMessage();
+ }
+ catch ( LdapServersManagerIOException e )
+ {
+ loadFailed = true;
+ exceptionMessage = e.getMessage();
+ }
+
+ if ( loadFailed )
+ {
+ if ( tempStore.exists() )
+ {
+ // If something went wrong, we try to load the temp servers file
+ try
+ {
+ InputStream inputStream = new FileInputStream( tempStore );
+ List<LdapServer> servers = LdapServersManagerIO.read( inputStream );
+ for ( LdapServer server : servers )
+ {
+ addServer( server, false );
+ }
+ return;
+ }
+ catch ( FileNotFoundException e )
+ {
+ // TODO Add error messages
+ CommonUiUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer" ) //$NON-NLS-1$
+ + e.getMessage() );
+ }
+ catch ( LdapServersManagerIOException e )
+ {
+ // TODO Add error messages
+ CommonUiUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer" ) //$NON-NLS-1$
+ + e.getMessage() );
+ }
+ }
+ else
+ {
+ // TODO Add error messages
+ CommonUiUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer" ) //$NON-NLS-1$
+ + exceptionMessage );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Saves the server to the file store.
+ */
+ public void saveServersToStore()
+ {
+ File store = getServersStorePath().toFile();
+ File tempStore = getServersStoreTempPath().toFile();
+ boolean saveFailed = false;
+
+ try
+ {
+ // Saving the servers to the temp servers file
+ OutputStream outputStream = new FileOutputStream( tempStore );
+ LdapServersManagerIO.write( serversList, outputStream );
+
+ // Copying the temp servers file to the final location
+ String content = FileUtils.readFileToString( tempStore, "UTF-8" ); //$NON-NLS-1$
+ FileUtils.writeStringToFile( store, content, "UTF-8" ); //$NON-NLS-1$
+ }
+ catch ( FileNotFoundException e )
+ {
+ saveFailed = true;
+ }
+ catch ( IOException e )
+ {
+ saveFailed = true;
+ }
+
+ if ( saveFailed )
+ {
+ // If an error occurs when saving to the temp servers file or
+ // when copying the temp servers file to the final location,
+ // we try to save the servers directly to the final location.
+ try
+ {
+ // Saving the servers to the temp servers file
+ OutputStream outputStream = new FileOutputStream( store );
+ LdapServersManagerIO.write( serversList, outputStream );
+ outputStream.close();
+ }
+ catch ( FileNotFoundException e )
+ {
+ // TODO Add error messages
+ CommonUiUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer" ) + e.getMessage() ); //$NON-NLS-1$
+ }
+ catch ( IOException e )
+ {
+ // TODO Add error messages
+ CommonUiUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer" ) + e.getMessage() ); //$NON-NLS-1$
+ }
+ }
+ }
+
+
+ /**
+ * Gets the path to the server file.
+ *
+ * @return
+ * the path to the server file.
+ */
+ private IPath getServersStorePath()
+ {
+ return LdapServersPlugin.getDefault().getStateLocation().append( "ldapServers.xml" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Gets the path to the server temp file.
+ *
+ * @return
+ * the path to the server temp file.
+ */
+ private IPath getServersStoreTempPath()
+ {
+ return LdapServersPlugin.getDefault().getStateLocation().append( "ldapServers-temp.xml" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * Indicates if the given is available (i.e. not already taken by another
+ * server).
+ *
+ * @param name
+ * the name
+ * @return
+ * <code>true</code> if the name is available, <code>false</code> if
+ * not
+ */
+ public boolean isNameAvailable( String name )
+ {
+ for ( LdapServer serverInstance : serversList )
+ {
+ if ( serverInstance.getName().equalsIgnoreCase( name ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Gets the servers list.
+ *
+ * @return
+ * the servers list.
+ */
+ public List<LdapServer> getServersList()
+ {
+ return serversList;
+ }
+
+
+ /**
+ * Gets the server associated with the given id.
+ *
+ * @return
+ * the server associated witht the given id.
+ */
+ public LdapServer getServerById( String id )
+ {
+ return serversIdMap.get( id );
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIO.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,186 @@
+/*
+ * 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.ldapservers;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+
+
+/**
+ * This class is used to read/write the 'servers.xml' file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServersManagerIO
+{
+ // XML tags and attributes
+ private static final String LDAP_SERVERS_TAG = "ldapServers"; //$NON-NLS-1$
+ private static final String LDAP_SERVER_TAG = "ldapServer"; //$NON-NLS-1$
+ private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+ private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+ private static final String ADAPTER_ID_ATTRIBUTE = "adapterId"; //$NON-NLS-1$
+
+
+ /**
+ * Reads the given input stream.
+ *
+ * @param stream
+ * the input stream
+ * @return
+ * the list of LDAP Servers found in the input stream
+ * @throws LdapServersManagerIOException
+ */
+ public static List<LdapServer> read( InputStream stream ) throws LdapServersManagerIOException
+ {
+ List<LdapServer> servers = new ArrayList<LdapServer>();
+
+ SAXReader saxReader = new SAXReader();
+ Document document = null;
+
+ try
+ {
+ document = saxReader.read( stream );
+ }
+ catch ( DocumentException e )
+ {
+ throw new LdapServersManagerIOException( e.getMessage() );
+ }
+
+ Element rootElement = document.getRootElement();
+ if ( !rootElement.getName().equals( LDAP_SERVERS_TAG ) )
+ {
+ throw new LdapServersManagerIOException( Messages.getString( "ServersHandlerIO.ErrorNotValidServersFile" ) ); //$NON-NLS-1$
+ }
+
+ for ( Iterator<?> i = rootElement.elementIterator( LDAP_SERVER_TAG ); i.hasNext(); )
+ {
+ servers.add( readLdapServer( ( Element ) i.next() ) );
+ }
+
+ return servers;
+ }
+
+
+ /**
+ * Reads an LDAP Server element.
+ *
+ * @param element
+ * the element
+ * @return
+ * the corresponding {@link LdapServer}
+ */
+ private static LdapServer readLdapServer( Element element )
+ {
+ LdapServer server = new LdapServer();
+
+ // ID
+ Attribute idAttribute = element.attribute( ID_ATTRIBUTE );
+ if ( idAttribute != null )
+ {
+ server.setId( idAttribute.getValue() );
+ }
+
+ // Name
+ Attribute nameAttribute = element.attribute( NAME_ATTRIBUTE );
+ if ( nameAttribute != null )
+ {
+ server.setName( nameAttribute.getValue() );
+ }
+
+ // Adapter
+ // TODO
+
+ return server;
+ }
+
+
+ /**
+ * Writes the list of servers to the given stream.
+ *
+ * @param servers
+ * the servers
+ * @param outputStream
+ * the output stream
+ * @throws IOException
+ * if an error occurs when writing to the stream
+ */
+ public static void write( List<LdapServer> servers, OutputStream outputStream ) throws IOException
+ {
+ // Creating the Document
+ Document document = DocumentHelper.createDocument();
+
+ // Creating the root element
+ Element root = document.addElement( LDAP_SERVERS_TAG );
+
+ if ( servers != null )
+ {
+ for ( LdapServer server : servers )
+ {
+ addLdapServer( server, root );
+ }
+ }
+
+ // Writing the file to the stream
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
+ outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
+ XMLWriter writer = new XMLWriter( outputStream, outformat );
+ writer.write( document );
+ writer.flush();
+ }
+
+
+ /**
+ * Adds the XML representation of the LDAP Server to the given parent.
+ *
+ * @param server
+ * the server
+ * @param parent
+ * the parent element
+ */
+ private static void addLdapServer( LdapServer server, Element parent )
+ {
+ // Server element
+ Element serverElement = parent.addElement( LDAP_SERVER_TAG );
+
+ // ID
+ serverElement.addAttribute( ID_ATTRIBUTE, server.getId() );
+
+ // Name
+ serverElement.addAttribute( NAME_ATTRIBUTE, server.getName() );
+
+ // Adapter
+ // TODO
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIOException.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIOException.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIOException.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerIOException.java Mon Jul 12 15:04:29 2010
@@ -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.ldapservers;
+
+
+/**
+ * This exception can be raised when an error occurs when loading or saving
+ * the servers to the store.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServersManagerIOException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Creates a new instance of ServersHandlerIOException.
+ *
+ * @param message
+ * the detail message
+ */
+ public LdapServersManagerIOException( String message )
+ {
+ super( message );
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerListener.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerListener.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersManagerListener.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,58 @@
+/*
+ * 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.ldapservers;
+
+
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+
+
+/**
+ * This interface represents a listener for the LDAP Servers Manager.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface LdapServersManagerListener
+{
+ /**
+ * This method is called when a server is added.
+ *
+ * @param server
+ * the added server
+ */
+ void serverAdded( LdapServer server );
+
+
+ /**
+ * This method is called when a server is removed.
+ *
+ * @param server
+ * the removed server
+ */
+ void serverRemoved( LdapServer server );
+
+
+ /**
+ * This method is called when a server is updated.
+ *
+ * @param server
+ * the updated server
+ */
+ void serverUpdated( LdapServer server );
+}
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java?rev=963311&r1=963310&r2=963311&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPlugin.java Mon Jul 12 15:04:29 2010
@@ -45,6 +45,13 @@ public class LdapServersPlugin extends A
/** The plugin properties */
private PropertyResourceBundle properties;
+ /** The LDAP Server Adapter Extensions Manager */
+ private LdapServerAdapterExtensionsManager ldapServerAdapterExtensionsManager = LdapServerAdapterExtensionsManager
+ .getDefault();
+
+ /** The LDAP Servers Manager */
+ private LdapServersManager ldapServersManager = LdapServersManager.getDefault();
+
/**
* The constructor
@@ -61,6 +68,12 @@ public class LdapServersPlugin extends A
public void start( BundleContext context ) throws Exception
{
super.start( context );
+
+ // Loading the LDAP Server Adapters extensions
+ ldapServerAdapterExtensionsManager.loadLdapServerAdapterExtensions();
+
+ // Loading the servers to the LDAP Servers Manager
+ ldapServersManager.loadServersFromStore();
}
@@ -69,6 +82,9 @@ public class LdapServersPlugin extends A
*/
public void stop( BundleContext context ) throws Exception
{
+ // Loading the servers to the LDAP Servers Manager
+ ldapServersManager.saveServersToStore();
+
plugin = null;
super.stop( context );
}
Modified: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java?rev=963311&r1=963310&r2=963311&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java (original)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersPluginConstants.java Mon Jul 12 15:04:29 2010
@@ -31,4 +31,21 @@ public interface LdapServersPluginConsta
/** The plug-in ID */
public static final String PLUGIN_ID = LdapServersPlugin.getDefault().getPluginProperties().getString( "Plugin_id" ); //$NON-NLS-1$
+ /** The LDAP Adapters Extension Point ID */
+ public static final String LDAP_SERVER_ADAPTERS_EXTENSION_POINT = PLUGIN_ID + ".ldapServerAdapters"; //$NON-NLS-1$
+
+
+ // ------
+ // IMAGES
+ // ------
+ public static final String IMG_SERVER = "resources/icons/server.gif";
+ public static final String IMG_SERVER_STARTED = "resources/icons/server_started.gif";
+ public static final String IMG_SERVER_STARTING1 = "resources/icons/server_starting1.gif";
+ public static final String IMG_SERVER_STARTING2 = "resources/icons/server_starting2.gif";
+ public static final String IMG_SERVER_STARTING3 = "resources/icons/server_starting3.gif";
+ public static final String IMG_SERVER_STOPPED = "resources/icons/server_stopped.gif";
+ public static final String IMG_SERVER_STOPPING1 = "resources/icons/server_stopping1.gif";
+ public static final String IMG_SERVER_STOPPING2 = "resources/icons/server_stopping2.gif";
+ public static final String IMG_SERVER_STOPPING3 = "resources/icons/server_stopping3.gif";
+
}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS156LdapServerAdapter.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.ldapservers.apacheds;
+
+
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+
+
+/**
+ * The {@link ApacheDS156LdapServerAdapter} interface defines the required method
+ * to implement an LDAP Server Adapter.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ApacheDS156LdapServerAdapter implements LdapServerAdapter
+{
+ /**
+ * Starts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void start() throws Exception
+ {
+ System.out.println( "Start" );
+ }
+
+
+ /**
+ * Stops the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void stop() throws Exception
+ {
+ System.out.println( "Stop" );
+ }
+
+
+ /**
+ * Restarts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void restart() throws Exception
+ {
+ System.out.println( "Restart" );
+ }
+}
Added: 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=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/apacheds/ApacheDS157LdapServerAdapter.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.ldapservers.apacheds;
+
+
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
+
+
+/**
+ * The {@link ApacheDS157LdapServerAdapter} interface defines the required method
+ * to implement an LDAP Server Adapter.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ApacheDS157LdapServerAdapter implements LdapServerAdapter
+{
+ /**
+ * Starts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void start() throws Exception
+ {
+ System.out.println( "Start" );
+ }
+
+
+ /**
+ * Stops the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void stop() throws Exception
+ {
+ System.out.println( "Stop" );
+ }
+
+
+ /**
+ * Restarts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void restart() throws Exception
+ {
+ System.out.println( "Restart" );
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/AbstractLdapServerInstance.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/AbstractLdapServerInstance.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/AbstractLdapServerInstance.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/AbstractLdapServerInstance.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,110 @@
+/*
+ * 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.ldapservers.model;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * The {@link AbstractLdapServerInstance} interface defines the required methods
+ * to implement an LDAP Server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractLdapServerInstance extends LdapServer
+{
+ /** The associated LDAP Server Adapter */
+ private LdapServerAdapter serverAdapter;
+
+ /** The status of the server instance */
+ private LdapServerStatus status = LdapServerStatus.STOPPED;
+
+ private List<LdapServerListener> listeners = new ArrayList<LdapServerListener>();
+
+
+ public void start() throws Exception
+ {
+ // Changing the status of the server to 'starting' and notifying listeners
+ setStatus( LdapServerStatus.STARTING );
+ notifyListenersServerStarting();
+
+ // Changing the status of the server to 'started' and notifying listeners
+ setStatus( LdapServerStatus.STARTED );
+ notifyListenersServerStarted();
+ }
+
+
+ /**
+ * TODO notifyListenersServerStarting.
+ *
+ */
+ private void notifyListenersServerStarting()
+ {
+// for ( LdapServerListener listener : listeners.toArray( new LdapServerListener[0] ) )
+// {
+// listener.ldapServerInstanceStarting( this );
+// }
+ }
+
+
+ /**
+ * TODO notifyListenersServerStarting.
+ *
+ */
+ private void notifyListenersServerStarted()
+ {
+// for ( LdapServerListener listener : listeners.toArray( new LdapServerListener[0] ) )
+// {
+// listener.ldapServerInstanceStarted( this );
+// }
+ }
+
+
+ public void stop() throws Exception
+ {
+
+ }
+
+
+ public void restart() throws Exception
+ {
+
+ }
+
+
+ public LdapServerStatus getStatus()
+ {
+ return status;
+ }
+
+
+ /**
+ * TODO setStatus.
+ *
+ * @param status
+ */
+ protected void setStatus( LdapServerStatus status )
+ {
+ this.status = status;
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServer.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,157 @@
+/*
+ * 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.ldapservers.model;
+
+
+/**
+ * The {@link LdapServer} interface defines the required methods
+ * to implement an LDAP Server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServer
+{
+ private String id;
+
+ private String name;
+
+ private LdapServerStatus status = LdapServerStatus.STOPPED;
+
+
+ /**
+ * Gets the name of the server.
+ *
+ * @return
+ * the name of the server
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Gets the id of the server.
+ *
+ * @return
+ * the id of the server
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+
+ /**
+ * Gets the associated {@link LdapServerAdapter}.
+ *
+ * @return
+ * the associated {@link LdapServerAdapter}
+ */
+ public LdapServerAdapter getLdapServerAdapter()
+ {
+ return null;
+ }
+
+
+ /**
+ * Adds the {@link LdapServerListener} to the server.
+ *
+ * @param listener
+ * the listener to be added
+ */
+ public void addListener( LdapServerListener listener )
+ {
+
+ }
+
+
+ /**
+ * Removes the {@link LdapServerListener} from the server.
+ *
+ * @param listener
+ * the listener to be removed
+ */
+ public void removeListener( LdapServerListener listener )
+ {
+
+ }
+
+
+ /**
+ * Starts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void start() throws Exception
+ {
+
+ }
+
+
+ /**
+ * Stops the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void stop() throws Exception
+ {
+
+ }
+
+
+ /**
+ * Restarts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void restart() throws Exception
+ {
+
+ }
+
+
+ /**
+ * Gets the status of the server.
+ *
+ * @return
+ * the status of the server
+ */
+ public LdapServerStatus getStatus()
+ {
+ return status;
+ }
+}
Added: 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=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapter.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.ldapservers.model;
+
+
+/**
+ * The {@link LdapServerAdapter} interface defines the required methods
+ * to implement an LDAP Server adapter.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface LdapServerAdapter
+{
+ /**
+ * Starts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void start() throws Exception;
+
+
+ /**
+ * Stops the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void stop() throws Exception;
+
+
+ /**
+ * Restarts the server.
+ *
+ * @throws Exception
+ * if an error occurs when restarting the server
+ */
+ public void restart() throws Exception;
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerAdapterExtension.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,196 @@
+/*
+ * 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.ldapservers.model;
+
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * The {@link LdapServerAdapterExtension} class represents an extension to the
+ * LDAP Server Adapters extension point.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServerAdapterExtension
+{
+ private String id;
+ private String name;
+ private String version;
+ private String vendorName;
+ private String className;
+ private String description;
+ private ImageDescriptor icon;
+
+
+ /**
+ * TODO getClassName.
+ *
+ * @return
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+
+ /**
+ * TODO getDescription.
+ *
+ * @return
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+
+ /**
+ * TODO getIcon.
+ *
+ * @return
+ */
+ public ImageDescriptor getIcon()
+ {
+ return icon;
+ }
+
+
+ /**
+ * TODO getId.
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+
+ /**
+ * TODO getName.
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * TODO getVendorName.
+ *
+ * @return
+ */
+ public String getVendorName()
+ {
+ return vendorName;
+ }
+
+
+ /**
+ * TODO getVersion.
+ *
+ * @return
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+
+ /**
+ * TODO setClassName.
+ *
+ * @param className
+ */
+ public void setClassName( String className )
+ {
+ this.className = className;
+ }
+
+
+ /**
+ * TODO setDescription.
+ *
+ * @param description
+ */
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+
+ /**
+ * TODO setIcon.
+ *
+ * @param icon
+ */
+ public void setIcon( ImageDescriptor icon )
+ {
+ this.icon = icon;
+ }
+
+
+ /**
+ * TODO setId.
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+
+ /**
+ * TODO setName.
+ *
+ * @param name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * TODO setVendorName.
+ *
+ * @param vendorName
+ */
+ public void setVendorName( String vendorName )
+ {
+ this.vendorName = vendorName;
+ }
+
+
+ /**
+ * TODO setVersion.
+ *
+ * @param version
+ */
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEvent.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEvent.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEvent.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.ldapservers.model;
+
+
+/**
+ * This class defines a server event.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapServerEvent
+{
+ /** The server */
+ private LdapServer server;
+
+ /** The kind of event */
+ private LdapServerEventType kind;
+
+
+ public LdapServerEvent( LdapServer server, LdapServerEventType kind )
+ {
+ super();
+ this.server = server;
+ this.kind = kind;
+ }
+
+
+ public LdapServer getServer()
+ {
+ return server;
+ }
+
+
+ public void setServer( LdapServer server )
+ {
+ this.server = server;
+ }
+
+
+ public LdapServerEventType getKind()
+ {
+ return kind;
+ }
+
+
+ public void setKind( LdapServerEventType kind )
+ {
+ this.kind = kind;
+ }
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEventType.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEventType.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEventType.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerEventType.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.ldapservers.model;
+
+
+/**
+ * This enums defines the different server events notifications.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum LdapServerEventType
+{
+ RENAMED, STATUS_CHANGED
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerListener.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerListener.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerListener.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.ldapservers.model;
+
+
+
+/**
+ * This interface defines a listener on an LDAP Server instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface LdapServerListener
+{
+
+ /**
+ * This method is called when the server is changed.
+ *
+ * @param event
+ * the server event
+ */
+ public void serverChanged( LdapServerEvent event );
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerStatus.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerStatus.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerStatus.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/model/LdapServerStatus.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.ldapservers.model;
+
+
+/**
+ * This enum defines the various statuses of an LDAP Server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public enum LdapServerStatus
+{
+ STARTED, STARTING, RESTARTED, RESTARTING, STOPPED, STOPPING, UNKNOWN
+}
Added: directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/Messages.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/Messages.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/Messages.java Mon Jul 12 15:04:29 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.ldapservers.views;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.ldapservers.views.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/src/main/java/org/apache/directory/studio/ldapservers/views/ServerAdaptersView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServerAdaptersView.java?rev=963311&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServerAdaptersView.java (added)
+++ directory/studio/trunk/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/views/ServerAdaptersView.java Mon Jul 12 15:04:29 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.ldapservers.views;
+
+
+import org.apache.directory.studio.ldapservers.LdapServerAdapterExtensionsManager;
+import org.apache.directory.studio.ldapservers.model.LdapServerAdapterExtension;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This class implements the Servers view.
+ * <p>
+ * It displays the list of Apache Directory Servers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ServerAdaptersView extends ViewPart
+{
+ private TableViewer tableViewer;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl( Composite parent )
+ {
+ tableViewer = new TableViewer( parent );
+ tableViewer.setContentProvider( new ArrayContentProvider() );
+ tableViewer.setLabelProvider( new LabelProvider()
+ {
+ @Override
+ public String getText( Object element )
+ {
+ if ( element instanceof LdapServerAdapterExtension )
+ {
+ LdapServerAdapterExtension extension = ( LdapServerAdapterExtension ) element;
+
+ return extension.getName() + " " + extension.getVersion();
+ }
+
+ // TODO Auto-generated method stub
+ return super.getText( element );
+ }
+ } );
+ tableViewer.setInput( LdapServerAdapterExtensionsManager.getDefault().getLdapServerAdapterExtensions()
+ .toArray() );
+ tableViewer.getTable().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+ }
+
+
+ @Override
+ public void setFocus()
+ {
+ tableViewer.getTable().setFocus();
+ }
+}