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 2008/08/26 15:14:09 UTC

svn commit: r689065 - in /directory/studio/trunk/connection-core: ./ META-INF/ src/main/java/org/apache/directory/studio/connection/core/ src/main/resources/

Author: pamarcelot
Date: Tue Aug 26 06:14:08 2008
New Revision: 689065

URL: http://svn.apache.org/viewvc?rev=689065&view=rev
Log:
Part of a fix for DIRSTUDIO-375 (Move each plugin IDs in a plugin.properties file).

Added:
    directory/studio/trunk/connection-core/plugin.properties
Modified:
    directory/studio/trunk/connection-core/META-INF/MANIFEST.MF
    directory/studio/trunk/connection-core/plugin.xml
    directory/studio/trunk/connection-core/pom.xml
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java
    directory/studio/trunk/connection-core/src/main/resources/connectionListener.exsd

Modified: directory/studio/trunk/connection-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/META-INF/MANIFEST.MF?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/META-INF/MANIFEST.MF (original)
+++ directory/studio/trunk/connection-core/META-INF/MANIFEST.MF Tue Aug 26 06:14:08 2008
@@ -1,10 +1,10 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: Apache Directory Studio Connection Core
+Bundle-Name: %plugin_name
 Bundle-SymbolicName: org.apache.directory.studio.connection.core;singleton:=true
 Bundle-Version: 1.3.0.SNAPSHOT
 Bundle-Activator: org.apache.directory.studio.connection.core.ConnectionCorePlugin
-Bundle-Vendor: Apache Software Foundation
+Bundle-Vendor: %plugin_vendor
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.core.runtime,
  org.apache.directory.studio.jars,

Added: directory/studio/trunk/connection-core/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/plugin.properties?rev=689065&view=auto
==============================================================================
--- directory/studio/trunk/connection-core/plugin.properties (added)
+++ directory/studio/trunk/connection-core/plugin.properties Tue Aug 26 06:14:08 2008
@@ -0,0 +1,36 @@
+# 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_name=Apache Directory Studio Connection Core
+plugin_vendor=Apache Software Foundation
+
+ExtensionPoint_JndiLogger_id=org.apache.directory.studio.jndilogger
+ExtensionPoint_JndiLogger_name=JNDI Logger
+
+ExtensionPoint_ConnectionListener_id=org.apache.directory.studio.connectionlistener
+ExtensionPoint_ConnectionListener_name=Connection Listener
+
+ExtensionPoint_ConnectionInitialiazer_id=org.apache.directory.studio.connectionInitializer
+ExtensionPoint_ConnectionInitialiazer_name=Connection Initializer
+
+JndiLogger_LdifModificationLogger_id=org.apache.directory.studio.connection.core.io.jndi.LdifModificationLogger
+JndiLogger_LdifModificationLogger_name=LDIF Modification Logger
+JndiLogger_LdifModificationLogger_description=Logs modifications in LDIF format to a file.
+
+JndiLogger_LdifSearchLogger_id=org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger
+JndiLogger_LdifSearchLogger_name=LDIF Search Logger
+JndiLogger_LdifSearchLogger_description=Logs searches in LDIF format to a file.
\ No newline at end of file

Modified: directory/studio/trunk/connection-core/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/plugin.xml?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/plugin.xml (original)
+++ directory/studio/trunk/connection-core/plugin.xml Tue Aug 26 06:14:08 2008
@@ -19,22 +19,22 @@
   under the License.
 -->
 <plugin>
-   <extension-point id="org.apache.directory.studio.jndilogger" name="JNDI Logger" schema="src/main/resources/jndiLogger.exsd"/>
-   <extension-point id="org.apache.directory.studio.connectionlistener" name="Connection Listener" schema="src/main/resources/connectionListener.exsd"/>
-   <extension-point id="org.apache.directory.studio.connectionInitializer" name="Connection Initializer" schema="src/main/resources/connectionInitializer.exsd"/>
+   <extension-point id="org.apache.directory.studio.jndilogger" name="%ExtensionPoint_JndiLogger_name" schema="src/main/resources/jndiLogger.exsd"/>
+   <extension-point id="org.apache.directory.studio.connectionlistener" name="%ExtensionPoint_ConnectionListener_name" schema="src/main/resources/connectionListener.exsd"/>
+   <extension-point id="org.apache.directory.studio.connectionInitializer" name="%ExtensionPoint_ConnectionInitialiazer_name" schema="src/main/resources/connectionInitializer.exsd"/>
    <extension
          point="org.apache.directory.studio.jndilogger">
       <jndiLogger
             class="org.apache.directory.studio.connection.core.io.jndi.LdifModificationLogger"
-            description="Logs modifications in LDIF format to a file."
-            id="org.apache.directory.studio.connection.core.io.jndi.LdifModificationLogger"
-            name="LDIF Modification Logger">
+            description="%JndiLogger_LdifModificationLogger_description"
+            id="%JndiLogger_LdifModificationLogger_id"
+            name="%JndiLogger_LdifModificationLogger_name">
       </jndiLogger>
       <jndiLogger
             class="org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger"
-            description="Logs searches in LDIF format to a file."
-            id="org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger"
-            name="LDIF Search Logger">
+            description="%JndiLogger_LdifSearchLogger_description"
+            id="%JndiLogger_LdifSearchLogger_id"
+            name="%JndiLogger_LdifSearchLogger_name">
       </jndiLogger>
    </extension>
    <extension

Modified: directory/studio/trunk/connection-core/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/pom.xml?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/pom.xml (original)
+++ directory/studio/trunk/connection-core/pom.xml Tue Aug 26 06:14:08 2008
@@ -39,6 +39,7 @@
       <resource>
         <directory>.</directory>
         <includes>
+          <include>plugin.properties</include>
           <include>plugin.xml</include>
         </includes>
       </resource>

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePlugin.java Tue Aug 26 06:14:08 2008
@@ -20,17 +20,21 @@
 package org.apache.directory.studio.connection.core;
 
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.PropertyResourceBundle;
 
 import org.apache.directory.studio.connection.core.event.CoreEventRunner;
 import org.apache.directory.studio.connection.core.event.EventRunner;
 import org.apache.directory.studio.connection.core.io.jndi.LdifModificationLogger;
 import org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger;
+import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionPoint;
 import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
@@ -42,7 +46,6 @@
  */
 public class ConnectionCorePlugin extends Plugin
 {
-
     /** The plug-in ID */
     public static final String PLUGIN_ID = "org.apache.directory.studio.connection.core";
 
@@ -66,10 +69,14 @@
 
     /** The JNDI loggers. */
     private List<IJndiLogger> jndiLoggers;
-    
+
     /** The connection listeners. */
     private List<IConnectionListener> connectionListeners;
 
+    /** The plugin properties */
+    private PropertyResourceBundle properties;
+
+
     /**
      * The constructor
      */
@@ -236,7 +243,7 @@
         List<IJndiLogger> jndiLoggers = getJndiLoggers();
         for ( IJndiLogger jndiLogger : jndiLoggers )
         {
-            if(jndiLogger instanceof LdifModificationLogger)
+            if ( jndiLogger instanceof LdifModificationLogger )
             {
                 return ( LdifModificationLogger ) jndiLogger;
             }
@@ -255,15 +262,15 @@
         List<IJndiLogger> jndiLoggers = getJndiLoggers();
         for ( IJndiLogger jndiLogger : jndiLoggers )
         {
-            if(jndiLogger instanceof LdifSearchLogger)
+            if ( jndiLogger instanceof LdifSearchLogger )
             {
                 return ( LdifSearchLogger ) jndiLogger;
             }
         }
         return null;
     }
-    
-    
+
+
     /**
      * Gets the jndi loggers.
      * 
@@ -271,13 +278,13 @@
      */
     public List<IJndiLogger> getJndiLoggers()
     {
-        if(jndiLoggers == null)
+        if ( jndiLoggers == null )
         {
             jndiLoggers = new ArrayList<IJndiLogger>();
-            
+
             IExtensionRegistry registry = Platform.getExtensionRegistry();
-            IExtensionPoint extensionPoint = registry
-                .getExtensionPoint( "org.apache.directory.studio.jndilogger" );
+            IExtensionPoint extensionPoint = registry.getExtensionPoint( getPluginProperties().getString(
+                "ExtensionPoint_JndiLogger_id" ) );
             IConfigurationElement[] members = extensionPoint.getConfigurationElements();
             for ( IConfigurationElement member : members )
             {
@@ -291,17 +298,17 @@
                 }
                 catch ( Exception e )
                 {
-                   getLog().log(
-                        new Status( IStatus.ERROR, ConnectionCorePlugin.PLUGIN_ID, 1,
-                            "Unable to create JNDI logger " + member.getAttribute( "class" ), e ) );
+                    getLog().log(
+                        new Status( IStatus.ERROR, ConnectionCorePlugin.PLUGIN_ID, 1, "Unable to create JNDI logger "
+                            + member.getAttribute( "class" ), e ) );
                 }
             }
         }
-        
+
         return jndiLoggers;
     }
-    
-    
+
+
     /**
      * Gets the connection listeners.
      * 
@@ -309,22 +316,22 @@
      */
     public List<IConnectionListener> getConnectionListeners()
     {
-        if(connectionListeners == null)
+        if ( connectionListeners == null )
         {
             connectionListeners = new ArrayList<IConnectionListener>();
-            
+
             IExtensionRegistry registry = Platform.getExtensionRegistry();
-            IExtensionPoint extensionPoint = registry
-                .getExtensionPoint( "org.apache.directory.studio.connectionlistener" );
+            IExtensionPoint extensionPoint = registry.getExtensionPoint( getPluginProperties().getString(
+                "ExtensionPoint_ConnectionListener_id" ) );
             IConfigurationElement[] members = extensionPoint.getConfigurationElements();
             for ( IConfigurationElement member : members )
             {
                 try
                 {
                     IConnectionListener listener = ( IConnectionListener ) member.createExecutableExtension( "class" );
-//                    listener.setId( member.getAttribute( "id" ) );
-//                    listener.setName( member.getAttribute( "name" ) );
-//                    listener.setDescription( member.getAttribute( "description" ) );
+                    //                    listener.setId( member.getAttribute( "id" ) );
+                    //                    listener.setName( member.getAttribute( "name" ) );
+                    //                    listener.setDescription( member.getAttribute( "description" ) );
                     connectionListeners.add( listener );
                 }
                 catch ( Exception e )
@@ -335,8 +342,34 @@
                 }
             }
         }
-        
+
         return connectionListeners;
     }
 
+
+    /**
+     * 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 ) );
+            }
+            catch ( IOException e )
+            {
+                getLog().log(
+                    new Status( Status.ERROR, ConnectionCorePlugin.PLUGIN_ID, Status.OK,
+                        "Unable to get the plugin properties.", e ) );
+            }
+        }
+
+        return properties;
+    }
 }

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionManager.java Tue Aug 26 06:14:08 2008
@@ -81,7 +81,8 @@
         }
 
         IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
-            "org.apache.directory.studio.connectionInitializer" );
+            ConnectionCorePlugin.getDefault().getPluginProperties().getString(
+                "ExtensionPoint_ConnectionInitialiazer_id" ) );
 
         IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
         for ( IConfigurationElement configurationElement : configurationElements )

Modified: directory/studio/trunk/connection-core/src/main/resources/connectionListener.exsd
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/resources/connectionListener.exsd?rev=689065&r1=689064&r2=689065&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/resources/connectionListener.exsd (original)
+++ directory/studio/trunk/connection-core/src/main/resources/connectionListener.exsd Tue Aug 26 06:14:08 2008
@@ -3,7 +3,7 @@
 <schema targetNamespace="org.apache.directory.studio.connection.core">
 <annotation>
       <appInfo>
-         <meta.schema plugin="org.apache.directory.studio.connection.core" id="connectionListener" name="Connection Listener"/>
+         <meta.schema plugin="org.apache.directory.studio.connection.core" id="connectionlistener" name="Connection Listener"/>
       </appInfo>
       <documentation>
          A Connection Listener is informed about opening and closing connections.
@@ -103,7 +103,7 @@
          &lt;p&gt;
 &lt;pre&gt;
    &lt;extension
-       point=&quot;org.apache.directory.studio.connectionListener&quot;&gt;
+       point=&quot;org.apache.directory.studio.connectionlistener&quot;&gt;
 
     &lt;valueEditor
           name=&quot;Browser Listener&quot;