directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r551909 [1/2] - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: ./ controller/ controller/actions/ model/ view/views/ view/wizards/
Date Fri, 29 Jun 2007 14:37:36 GMT
Author: pamarcelot
Date: Fri Jun 29 07:37:30 2007
New Revision: 551909

URL: http://svn.apache.org/viewvc?view=rev&rev=551909
Log:
Moved the Listeners outside of the model but in the controller part of the code.
They are now handled by the SchemaHandler.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeAdapter.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeListener.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassAdapter.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassListener.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaAdapter.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaListener.java
      - copied, changed from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaListener.java
Removed:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Main.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassListener.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaAdapter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaHandler.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaListener.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewAttributeTypeContentWizardPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassContentWizardPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/NewObjectClassMandatoryAttributesPage.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java Fri Jun 29 07:37:30 2007
@@ -20,6 +20,7 @@
 package org.apache.directory.studio.apacheds.schemaeditor;
 
 
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -38,6 +39,9 @@
     /** The shared instance */
     private static Activator plugin;
 
+    /** The SchemaHandler */
+    private SchemaHandler schemaHandler;
+
 
     /**
      * Creates a new instance of Activator.
@@ -45,6 +49,7 @@
     public Activator()
     {
         plugin = this;
+        schemaHandler = SchemaHandler.getInstance();
     }
 
 
@@ -55,6 +60,8 @@
     public void start( BundleContext context ) throws Exception
     {
         super.start( context );
+        
+        FakeLoader.loadSchemas();
     }
 
 
@@ -77,5 +84,17 @@
     public static Activator getDefault()
     {
         return plugin;
+    }
+
+
+    /**
+     * Gets the SchemaHandler
+     *
+     * @return
+     *      the SchemaHandler
+     */
+    public SchemaHandler getSchemaHandler()
+    {
+        return schemaHandler;
     }
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java?view=auto&rev=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/FakeLoader.java Fri Jun 29 07:37:30 2007
@@ -0,0 +1,61 @@
+/*
+ *  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.apacheds.schemaeditor;
+
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerAdapter;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaImpl;
+
+public class FakeLoader
+{
+    public static void loadSchemas()
+    {
+        SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
+        
+        Schema schema1 = new SchemaImpl("schema1");
+        AttributeTypeImpl at1 = new AttributeTypeImpl("1.2.3.4.1");
+        at1.setNames( new String[] { "at1" } );
+        at1.setSchema( schema1.getName() );
+        schema1.addAttributeType( at1 );
+        
+        AttributeTypeImpl at2 = new AttributeTypeImpl("1.2.3.4.2");
+        at2.setNames( new String[] { "at2", "attributeType2" } );
+        at2.setSchema( schema1.getName() );
+        schema1.addAttributeType( at2 );
+        
+        ObjectClassImpl oc1 = new ObjectClassImpl("1.2.3.4.3");
+        oc1.setNames(new String[] { "oc1", "objectClass1" } );
+        oc1.setSchema( schema1.getName() );
+        schema1.addObjectClass( oc1 );
+        
+        schemaHandler.addSchema( schema1 );
+        schemaHandler.addListener( new SchemaHandlerAdapter(){
+
+            public void schemaAdded( Schema schema )
+            {
+                System.out.println("schemaAdded");
+            }
+            
+        });
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/SchemaImporter.java Fri Jun 29 07:37:30 2007
@@ -33,11 +33,7 @@
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
-import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
@@ -159,22 +155,22 @@
             switch ( getNodeType( searchResult ) )
             {
                 case ATTRIBUTE_TYPE:
-                    AttributeType at = createAttributeType( searchResult );
+                    AttributeTypeImpl at = createAttributeType( searchResult );
                     at.setSchema( name );
                     schema.addAttributeType( at );
                     break;
                 case OBJECT_CLASS:
-                    ObjectClass oc = createObjectClass( searchResult );
+                    ObjectClassImpl oc = createObjectClass( searchResult );
                     oc.setSchema( name );
                     schema.addObjectClass( oc );
                     break;
                 case MATCHING_RULE:
-                    MatchingRule mr = createMatchingRule( searchResult );
+                    MatchingRuleImpl mr = createMatchingRule( searchResult );
                     mr.setSchema( name );
                     schema.addMatchingRule( mr );
                     break;
                 case SYNTAX:
-                    Syntax syntax = createSyntax( searchResult );
+                    SyntaxImpl syntax = createSyntax( searchResult );
                     syntax.setSchema( name );
                     schema.addSyntax( syntax );
                     break;
@@ -230,16 +226,16 @@
 
 
     /**
-     * Create the AttributeType associated with the given SearchResult.
+     * Create the AttributeTypeImpl associated with the given SearchResult.
      * 
      * @param sr
      * 		the SearchResult
      * @return
-     * 		the AttributeType associated with the SearchResult, or null if no 
-     * AttributeType could be created
+     * 		the AttributeTypeImpl associated with the SearchResult, or null if no 
+     * AttributeTypeImpl could be created
      * @throws NamingException 
      */
-    private AttributeType createAttributeType( SearchResult sr ) throws NamingException
+    private AttributeTypeImpl createAttributeType( SearchResult sr ) throws NamingException
     {
         AttributeTypeImpl at = new AttributeTypeImpl( getOid( sr ) );
         at.setNames( getNames( sr ) );
@@ -260,16 +256,16 @@
 
 
     /**
-     * Create the ObjectClass associated with the given SearchResult.
+     * Create the ObjectClassImpl associated with the given SearchResult.
      * 
      * @param sr
      *      the SearchResult
      * @return
-     *      the ObjectClass associated with the SearchResult, or null if no 
-     * ObjectClass could be created
+     *      the ObjectClassImpl associated with the SearchResult, or null if no 
+     * ObjectClassImpl could be created
      * @throws NamingException 
      */
-    private ObjectClass createObjectClass( SearchResult sr ) throws NamingException
+    private ObjectClassImpl createObjectClass( SearchResult sr ) throws NamingException
     {
         ObjectClassImpl oc = new ObjectClassImpl( getOid( sr ) );
         oc.setNames( getNames( sr ) );
@@ -293,7 +289,7 @@
      * ObjectClass could be created
      * @throws NamingException 
      */
-    private MatchingRule createMatchingRule( SearchResult sr ) throws NamingException
+    private MatchingRuleImpl createMatchingRule( SearchResult sr ) throws NamingException
     {
         MatchingRuleImpl mr = new MatchingRuleImpl( getOid( sr ) );
         mr.setNames( getNames( sr ) );
@@ -314,7 +310,7 @@
      * ObjectClass could be created
      * @throws NamingException 
      */
-    private Syntax createSyntax( SearchResult sr ) throws NamingException
+    private SyntaxImpl createSyntax( SearchResult sr ) throws NamingException
     {
         SyntaxImpl syntax = new SyntaxImpl( getOid( sr ) );
         syntax.setNames( getNames( sr ) );

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeAdapter.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeAdapter.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeAdapter.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeAdapter.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeAdapter.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeAdapter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeAdapter.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,8 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
 
 
 /**

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeListener.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeListener.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeListener.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeListener.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeListener.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeListener.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/AttributeTypeListener.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
 
 
 /**

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassAdapter.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassAdapter.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassAdapter.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassAdapter.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassAdapter.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassAdapter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassAdapter.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
 
 
 /**

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassListener.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassListener.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassListener.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassListener.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassListener.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassListener.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ObjectClassListener.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
 
 
 /**

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaAdapter.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaAdapter.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaAdapter.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaAdapter.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaAdapter.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaAdapter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaAdapter.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,12 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
 
 
 /**

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java?view=auto&rev=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java Fri Jun 29 07:37:30 2007
@@ -0,0 +1,882 @@
+/*
+ *  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.apacheds.schemaeditor.controller;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
+
+
+/**
+ * This class represents the SchemaHandler.
+ * <p>
+ * It used to handle the whole Schema (including schemas, attribute types, 
+ * object classes, matching rules and syntaxes).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaHandler
+{
+    /** The SchemaHandler instance */
+    private static SchemaHandler instance;
+
+    //
+    // The Lists
+    //
+    /** The schemas List */
+    private List<Schema> schemasList;
+    /** The attribute types List */
+    private List<AttributeTypeImpl> attributeTypesList;
+    /** The matching rules List */
+    private List<MatchingRuleImpl> matchingRulesList;
+    /** The object classes List */
+    private List<ObjectClassImpl> objectClassesList;
+    /** The syntaxes List */
+    private List<SyntaxImpl> syntaxesList;
+
+    //
+    // The Maps (for fast searching)
+    //
+    /** The schemas Map */
+    private Map<String, Schema> schemasMap;
+    /** The attribute types Map */
+    private Map<String, AttributeTypeImpl> attributeTypesMap;
+    /** The matching rules Map */
+    private Map<String, MatchingRuleImpl> matchingRulesMap;
+    /** The object classes Map */
+    private Map<String, ObjectClassImpl> objectClassesMap;
+    /** The syntaxes Map */
+    private Map<String, SyntaxImpl> syntaxesMap;
+
+    //
+    // The Listeners Lists
+    //
+    private List<SchemaHandlerListener> schemaHandlerListeners;
+    private MultiValueMap schemaListeners;
+    private MultiValueMap attributeTypeListeners;
+    private MultiValueMap objectClassListeners;
+
+
+    /**
+     * Creates a new instance of SchemaHandler.
+     */
+    private SchemaHandler()
+    {
+        // Lists
+        schemasList = new ArrayList<Schema>();
+        attributeTypesList = new ArrayList<AttributeTypeImpl>();
+        matchingRulesList = new ArrayList<MatchingRuleImpl>();;
+        objectClassesList = new ArrayList<ObjectClassImpl>();
+        syntaxesList = new ArrayList<SyntaxImpl>();
+
+        // Maps
+        schemasMap = new HashMap<String, Schema>();
+        attributeTypesMap = new HashMap<String, AttributeTypeImpl>();
+        matchingRulesMap = new HashMap<String, MatchingRuleImpl>();
+        objectClassesMap = new HashMap<String, ObjectClassImpl>();
+        syntaxesMap = new HashMap<String, SyntaxImpl>();
+
+        // Listeners
+        schemaHandlerListeners = new ArrayList<SchemaHandlerListener>();
+        schemaListeners = new MultiValueMap();
+        attributeTypeListeners = new MultiValueMap();
+        objectClassListeners = new MultiValueMap();
+    }
+
+
+    /**
+     * Gets the singleton instance of the SchemaHandler.
+     *
+     * @return
+     *      the singleton instance of the SchemaHandler
+     */
+    public static SchemaHandler getInstance()
+    {
+        if ( instance == null )
+        {
+            instance = new SchemaHandler();
+        }
+
+        return instance;
+    }
+
+
+    /**
+     * Gets the List of all the attribute types.
+     *
+     * @return
+     *      the List of all the attribute types
+     */
+    public List<AttributeTypeImpl> getAttributeTypes()
+    {
+        return attributeTypesList;
+    }
+
+
+    /**
+     * Gets the List of all the matching rules.
+     *
+     * @return
+     *      the List of all the matching rules
+     */
+    public List<MatchingRuleImpl> getMatchingRules()
+    {
+        return matchingRulesList;
+    }
+
+
+    /**
+     * Gets the List of all the object classes.
+     *
+     * @return
+     *      the List of all the object classes
+     */
+    public List<ObjectClassImpl> getObjectClasses()
+    {
+        return objectClassesList;
+    }
+
+
+    /**
+     * Gets the List of all the schemas.
+     *
+     * @return
+     *      the List of all the schemas
+     */
+    public List<Schema> getSchemas()
+    {
+        return schemasList;
+    }
+
+
+    /**
+     * Gets the List of all the matching rules.
+     *
+     * @return
+     *      the List of all the matching rules
+     */
+    public List<SyntaxImpl> getSyntaxes()
+    {
+        return syntaxesList;
+    }
+
+
+    /**
+     * Gets an attribute type identified by an OID, or an alias.
+     *
+     * @param id
+     *      an OID or an alias
+     * @return
+     *      the corresponding attribute type, or null if no one is found
+     */
+    public AttributeTypeImpl getAttributeType( String id )
+    {
+        return attributeTypesMap.get( id );
+    }
+
+
+    /**
+     * Gets a matching rule identified by an OID, or an alias.
+     *
+     * @param id
+     *      an OID or an alias
+     * @return
+     *      the corresponding matching rule, or null if no one is found
+     */
+    public MatchingRuleImpl getMatchingRule( String id )
+    {
+        return matchingRulesMap.get( id );
+    }
+
+
+    /**
+     * Gets an object class identified by an OID, or an alias.
+     *
+     * @param id
+     *      an OID or an alias
+     * @return
+     *      the corresponding object class, or null if no one is found
+     */
+    public ObjectClassImpl getObjectClass( String id )
+    {
+        return objectClassesMap.get( id );
+    }
+
+
+    /**
+     * Gets a schema identified by a name.
+     *
+     * @param name
+     *      a name
+     * @return
+     *      the corresponding schema, or null if no one is found
+     */
+    public Schema getSchema( String name )
+    {
+        return schemasMap.get( name );
+    }
+
+
+    /**
+     * Gets a syntax identified by an OID, or an alias.
+     *
+     * @param id
+     *      an OID or an alias
+     * @return
+     *      the corresponding syntax, or null if no one is found
+     */
+    public SyntaxImpl getSyntax( String id )
+    {
+        return syntaxesMap.get( id );
+    }
+
+
+    /**
+     * Adds a SchemaListener to the given schema.
+     *
+     * @param schema
+     *      the schema
+     * @param listener
+     *      the listener
+     */
+    public void addListener( SchemaHandlerListener listener )
+    {
+        if ( !schemaHandlerListeners.contains( listener ) )
+        {
+            schemaHandlerListeners.add( listener );
+        }
+    }
+
+
+    /**
+     * Adds a SchemaListener to the given schema.
+     *
+     * @param schema
+     *      the schema
+     * @param listener
+     *      the listener
+     */
+    public void addListener( Schema schema, SchemaListener listener )
+    {
+        if ( !schemaListeners.containsValue( schema, listener ) )
+        {
+            schemaListeners.put( schema, listener );
+        }
+    }
+
+
+    /**
+     * Adds a AttributeTypeListener to the given attribute type.
+     *
+     * @param at
+     *      the attribute type
+     * @param listener
+     *      the listener
+     */
+    public void addListener( AttributeTypeImpl at, AttributeTypeListener listener )
+    {
+        if ( !attributeTypeListeners.containsValue( at, listener ) )
+        {
+            attributeTypeListeners.put( at, listener );
+        }
+    }
+
+
+    /**
+     * Adds a AttributeTypeListener to the given object class.
+     *
+     * @param oc
+     *      the object class
+     * @param listener
+     *      the listener
+     */
+    public void addListener( ObjectClassImpl oc, ObjectClassListener listener )
+    {
+        if ( !objectClassListeners.containsValue( oc, listener ) )
+        {
+            objectClassListeners.put( oc, listener );
+        }
+    }
+
+
+    /**
+     * Adds a schema
+     *
+     * @param schema
+     *      the schema
+     */
+    public void addSchema( Schema schema )
+    {
+        // Adding the schema
+        schemasList.add( schema );
+        schemasMap.put( schema.getName(), schema );
+
+        // Adding its attribute types
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+        {
+            addSchemaObject( at );
+
+        }
+
+        // Adding its matching rules
+        for ( MatchingRuleImpl mr : schema.getMatchingRules() )
+        {
+            addSchemaObject( mr );
+        }
+
+        // Adding its object classes
+        for ( ObjectClassImpl oc : schema.getObjectClasses() )
+        {
+            addSchemaObject( oc );
+        }
+
+        // Adding its syntaxes
+        for ( SyntaxImpl syntax : schema.getSyntaxes() )
+        {
+            addSchemaObject( syntax );
+        }
+
+        notifySchemaAdded( schema );
+    }
+
+
+    /**
+     * Adds the given SchemaObject to the corresponding List and Map
+     *
+     * @param object
+     *      the SchemaObject
+     */
+    private void addSchemaObject( SchemaObject object )
+    {
+        if ( object instanceof AttributeTypeImpl )
+        {
+            AttributeTypeImpl at = ( AttributeTypeImpl ) object;
+            attributeTypesList.add( at );
+            for ( String name : at.getNames() )
+            {
+                attributeTypesMap.put( name, at );
+            }
+            attributeTypesMap.put( at.getOid(), at );
+        }
+        else if ( object instanceof MatchingRuleImpl )
+        {
+            MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
+            matchingRulesList.add( mr );
+            for ( String name : mr.getNames() )
+            {
+                matchingRulesMap.put( name, mr );
+            }
+            matchingRulesMap.put( mr.getOid(), mr );
+        }
+        else if ( object instanceof ObjectClassImpl )
+        {
+            ObjectClassImpl oc = ( ObjectClassImpl ) object;
+            objectClassesList.add( oc );
+            for ( String name : oc.getNames() )
+            {
+                objectClassesMap.put( name, oc );
+            }
+            objectClassesMap.put( oc.getOid(), oc );
+        }
+        else if ( object instanceof SyntaxImpl )
+        {
+            SyntaxImpl syntax = ( SyntaxImpl ) object;
+            syntaxesList.add( syntax );
+            for ( String name : syntax.getNames() )
+            {
+                syntaxesMap.put( name, syntax );
+            }
+            syntaxesMap.put( syntax.getOid(), syntax );
+        }
+    }
+
+
+    /**
+     * Removes the given schema. 
+     *
+     * @param schema
+     *      the schema
+     */
+    public void removeSchema( Schema schema )
+    {
+        // Removing the schema
+        schemasList.remove( schema );
+        schemasMap.remove( schema.getName() );
+
+        // Removing its attribute types
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+        {
+            removeSchemaObject( at );
+        }
+
+        // Removing its matching rules
+        for ( MatchingRuleImpl mr : schema.getMatchingRules() )
+        {
+            removeSchemaObject( mr );
+        }
+
+        // Removing its object classes
+        for ( ObjectClassImpl oc : schema.getObjectClasses() )
+        {
+            removeSchemaObject( oc );
+        }
+
+        // Removing its syntaxes
+        for ( SyntaxImpl syntax : schema.getSyntaxes() )
+        {
+            removeSchemaObject( syntax );
+        }
+
+        notifySchemaRemoved( schema );
+    }
+
+
+    /**
+     * Removes the given SchemaObject to the corresponding List and Map
+     *
+     * @param object
+     *      the SchemaObject
+     */
+    private void removeSchemaObject( SchemaObject object )
+    {
+        if ( object instanceof AttributeTypeImpl )
+        {
+            AttributeTypeImpl at = ( AttributeTypeImpl ) object;
+            attributeTypesList.remove( at );
+            for ( String name : at.getNames() )
+            {
+                attributeTypesMap.remove( name );
+            }
+            attributeTypesMap.remove( at.getOid() );
+        }
+        else if ( object instanceof MatchingRuleImpl )
+        {
+            MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
+            matchingRulesList.remove( mr );
+            for ( String name : mr.getNames() )
+            {
+                matchingRulesMap.remove( name );
+            }
+            matchingRulesMap.remove( mr.getOid() );
+        }
+        else if ( object instanceof ObjectClassImpl )
+        {
+            ObjectClassImpl oc = ( ObjectClassImpl ) object;
+            objectClassesList.remove( oc );
+            for ( String name : oc.getNames() )
+            {
+                objectClassesMap.remove( name );
+            }
+            objectClassesMap.remove( oc.getOid() );
+        }
+        else if ( object instanceof SyntaxImpl )
+        {
+            SyntaxImpl syntax = ( SyntaxImpl ) object;
+            syntaxesList.remove( syntax );
+            for ( String name : syntax.getNames() )
+            {
+                syntaxesMap.remove( name );
+            }
+            syntaxesMap.remove( syntax.getOid() );
+        }
+    }
+
+
+    /**
+     * Adds the given attribute type.
+     *
+     * @param at
+     *      the attribute type
+     */
+    public void addAttributeType( AttributeTypeImpl at )
+    {
+        Schema schema = getSchema( at.getSchema() );
+
+        if ( schema == null )
+        {
+            // TODO Throw an exception
+        }
+
+        schema.addAttributeType( at );
+        addSchemaObject( at );
+
+        // Notifying the listeners
+        notifyAttributeTypeAdded( at );
+    }
+
+
+    /**
+     * Update the source attribute type with the values of the 
+     * destination attribute type.
+     *
+     * @param at1
+     *      the source attribute type
+     * @param at2
+     *      the destination attribute type
+     */
+    public void modifyAttributeType( AttributeTypeImpl at1, AttributeTypeImpl at2 )
+    {
+        // Removing the references (in case of the names or oid have changed)
+        removeSchemaObject( at1 );
+
+        // Updating the attribute type
+        at1.setNames( at2.getNames() );
+        at1.setOid( at2.getOid() );
+        at1.setDescription( at2.getDescription() );
+        at1.setSuperiorName( at2.getSuperiorName() );
+        at1.setUsage( at2.getUsage() );
+        at1.setSyntaxOid( at2.getSyntaxOid() );
+        at1.setLength( at2.getLength() );
+        at1.setObsolete( at2.isObsolete() );
+        at1.setSingleValue( at2.isSingleValue() );
+        at1.setCollective( at2.isCollective() );
+        at1.setCanUserModify( at2.isCanUserModify() );
+        at1.setEqualityName( at1.getEqualityName() );
+        at1.setOrderingName( at2.getOrderingName() );
+        at1.setSubstrName( at2.getSubstrName() );
+
+        // Adding the references (in case of the names or oid have changed)
+        addSchemaObject( at1 );
+
+        // Notifying the listeners
+        notifyAttributeTypeModified( at1 );
+    }
+
+
+    /**
+     * Removes the given attribute type.
+     *
+     * @param at
+     *      the attribute type
+     */
+    public void removeAttributeType( AttributeTypeImpl at )
+    {
+        Schema schema = getSchema( at.getSchema() );
+
+        if ( schema == null )
+        {
+            // TODO Throw an exception
+        }
+
+        schema.removeAttributeType( at );
+        removeSchemaObject( at );
+
+        // Notifying the listeners
+        notifyAttributeTypeRemoved( at );
+    }
+
+
+    /**
+     * Adds the given object class.
+     *
+     * @param oc
+     *      the object class
+     */
+    public void addObjectClass( ObjectClassImpl oc )
+    {
+        Schema schema = getSchema( oc.getSchema() );
+
+        if ( schema == null )
+        {
+            // TODO Throw an exception
+        }
+
+        schema.addObjectClass( oc );
+        addSchemaObject( oc );
+
+        // Notifying the listeners
+        notifyObjectClassAdded( oc );
+    }
+
+
+    /**
+     * Update the source object class with the values of the 
+     * destination object class.
+     *
+     * @param oc1
+     *      the source object class
+     * @param oc2
+     *      the destination object class  
+     */
+    public void modifyObjectClass( ObjectClassImpl oc1, ObjectClassImpl oc2 )
+    {
+        // Removing the references (in case of the names or oid have changed)
+        removeSchemaObject( oc1 );
+
+        // Updating the object class
+        oc1.setNames( oc2.getNames() );
+        oc1.setOid( oc2.getOid() );
+        oc1.setDescription( oc2.getDescription() );
+        oc1.setSuperClassesNames( oc2.getSuperClassesNames() );
+        oc1.setType( oc2.getType() );
+        oc1.setObsolete( oc2.isObsolete() );
+        oc1.setMustNamesList( oc2.getMustNamesList() );
+        oc1.setMayNamesList( oc2.getMayNamesList() );
+
+        // Adding the references (in case of the names or oid have changed)
+        addSchemaObject( oc1 );
+
+        // Notifying the listeners
+        notifyObjectClassModified( oc1 );
+    }
+
+
+    /**
+     * Removes the given object class.
+     *
+     * @param oc
+     *      the object class
+     */
+    public void removeObjectClass( ObjectClassImpl oc )
+    {
+        Schema schema = getSchema( oc.getSchema() );
+
+        if ( schema == null )
+        {
+            // TODO Throw an exception
+        }
+
+        schema.removeObjectClass( oc );
+        removeSchemaObject( oc );
+
+        notifyObjectClassRemoved( oc );
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a schema has been added.
+     *
+     * @param schema
+     *      the added schema
+     */
+    private void notifySchemaAdded( Schema schema )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.schemaAdded( schema );
+        }
+    }
+
+
+    /**
+     * Notifies the given listeners that a schema has been removed.
+     *
+     * @param schema
+     *      the added schema
+     */
+    private void notifySchemaRemoved( Schema schema )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.schemaRemoved( schema );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an attribute type has been added.
+     *
+     * @param at
+     *      the added attribute type
+     */
+    private void notifyAttributeTypeAdded( AttributeTypeImpl at )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.attributeTypeAdded( at );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an attribute type has been modified.
+     *
+     * @param at
+     *      the modified attribute type
+     */
+    private void notifyAttributeTypeModified( AttributeTypeImpl at )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.attributeTypeModified( at );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an attribute type has been removed.
+     *
+     * @param at
+     *      the removed attribute type
+     */
+    private void notifyAttributeTypeRemoved( AttributeTypeImpl at )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.attributeTypeRemoved( at );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an object class has been added.
+     *
+     * @param oc
+     *      the added object class
+     */
+    private void notifyObjectClassAdded( ObjectClassImpl oc )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.objectClassAdded( oc );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an object class has been modified.
+     *
+     * @param oc
+     *      the modified object class
+     */
+    private void notifyObjectClassModified( ObjectClassImpl oc )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.objectClassModified( oc );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that an object class has been removed.
+     *
+     * @param oc
+     *      the removed object class
+     */
+    private void notifyObjectClassRemoved( ObjectClassImpl oc )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.objectClassRemoved( oc );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a matching rule has been added.
+     *
+     * @param mr
+     *      the added matching rule
+     */
+    private void notifyMatchingRuleAdded( MatchingRuleImpl mr )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.matchingRuleAdded( mr );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a matching rule has been modified.
+     *
+     * @param mr
+     *      the modified matching rule
+     */
+    private void notifyMatchingRuleModified( MatchingRuleImpl mr )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.matchingRuleModified( mr );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a matching rule has been removed.
+     *
+     * @param mr
+     *      the removed matching rule
+     */
+    private void notifyMatchingRuleRemoved( MatchingRuleImpl mr )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.matchingRuleRemoved( mr );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a syntax has been added.
+     *
+     * @param syntax
+     *      the added syntax
+     */
+    private void notifySyntaxRuleAdded( SyntaxImpl syntax )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.syntaxAdded( syntax );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a syntax has been modified.
+     *
+     * @param syntax
+     *      the modified syntax
+     */
+    private void notifySyntaxRuleModified( SyntaxImpl syntax )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.syntaxModified( syntax );
+        }
+    }
+
+
+    /**
+     * Notifies the SchemaHandler listeners that a syntax has been removed.
+     *
+     * @param syntax
+     *      the removed syntax
+     */
+    private void notifySyntaxRemoved( SyntaxImpl syntax )
+    {
+        for ( SchemaHandlerListener listener : schemaHandlerListeners )
+        {
+            listener.syntaxRemoved( syntax );
+        }
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerAdapter.java?view=auto&rev=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerAdapter.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerAdapter.java Fri Jun 29 07:37:30 2007
@@ -0,0 +1,132 @@
+
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
+
+/**
+ * This adapter class provides default implementations for the methods 
+ * described by the SchemaHandlerListener interface.
+ * <p>
+ * Classes that wish to deal with schema handling events can extend this class 
+ * and override only the methods which they are interested in. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class SchemaHandlerAdapter implements SchemaHandlerListener
+{
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#attributeTypeAdded(org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl)
+     */
+    public void attributeTypeAdded( AttributeTypeImpl at )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#attributeTypeModified(org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl)
+     */
+    public void attributeTypeModified( AttributeTypeImpl at )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#attributeTypeRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl)
+     */
+    public void attributeTypeRemoved( AttributeTypeImpl at )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#matchingRuleAdded(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
+     */
+    public void matchingRuleAdded( MatchingRuleImpl mr )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#matchingRuleModified(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
+     */
+    public void matchingRuleModified( MatchingRuleImpl mr )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#matchingRuleRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
+     */
+    public void matchingRuleRemoved( MatchingRuleImpl mr )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#objectClassAdded(org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl)
+     */
+    public void objectClassAdded( ObjectClassImpl oc )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#objectClassModified(org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl)
+     */
+    public void objectClassModified( ObjectClassImpl oc )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#objectClassRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl)
+     */
+    public void objectClassRemoved( ObjectClassImpl oc )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#schemaAdded(org.apache.directory.studio.apacheds.schemaeditor.model.Schema)
+     */
+    public void schemaAdded( Schema schema )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#schemaRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.Schema)
+     */
+    public void schemaRemoved( Schema schema )
+    {   
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#syntaxAdded(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
+     */
+    public void syntaxAdded( SyntaxImpl syntax )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#syntaxModified(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
+     */
+    public void syntaxModified( SyntaxImpl syntax )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerListener#syntaxRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
+     */
+    public void syntaxRemoved( SyntaxImpl syntax )
+    {
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerListener.java?view=auto&rev=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerListener.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandlerListener.java Fri Jun 29 07:37:30 2007
@@ -0,0 +1,163 @@
+/*
+ *  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.apacheds.schemaeditor.controller;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
+
+
+/**
+ * Classes which implement this interface provide methods that deal with the 
+ * events that are generated when an event occurs on a schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SchemaHandlerListener
+{
+    /**
+     * Sent when the attribute type is added.
+     *
+     * @param at
+     *      the added attribute type
+     */
+    public void attributeTypeAdded( AttributeTypeImpl at );
+
+
+    /**
+     * Sent when the attribute type is modified.
+     *
+     * @param at
+     *      the modified attribute type
+     */
+    public void attributeTypeModified( AttributeTypeImpl at );
+
+
+    /**
+     * Sent when an attribute type is removed.
+     *
+     * @param at
+     *      the removed attribute type
+     */
+    public void attributeTypeRemoved( AttributeTypeImpl at );
+
+
+    /**
+     * Sent when a matching rule is added.
+     *
+     * @param mr
+     *      the added matching rule
+     */
+    public void matchingRuleAdded( MatchingRuleImpl mr );
+
+
+    /**
+     * Sent when a matching rule is modified.
+     *
+     * @param mr
+     *      the modified matching rule
+     */
+    public void matchingRuleModified( MatchingRuleImpl mr );
+
+
+    /**
+     * Sent when a matching rule is removed.
+     *
+     * @param mr
+     *      the removed matching rule
+     */
+    public void matchingRuleRemoved( MatchingRuleImpl mr );
+
+
+    /**
+     * Sent when an object class is added.
+     *
+     * @param oc
+     *      the added object class
+     */
+    public void objectClassAdded( ObjectClassImpl oc );
+
+
+    /**
+     * Sent when an object class is modified.
+     *
+     * @param oc
+     *      the modified object class
+     */
+    public void objectClassModified( ObjectClassImpl oc );
+
+
+    /**
+     * Sent when an object class is removed.
+     *
+     * @param oc
+     *      the removed attribute type
+     */
+    public void objectClassRemoved( ObjectClassImpl oc );
+
+
+    /**
+     * Sent when a schema is added.
+     *
+     * @param schema
+     *      the added syntax
+     */
+    public void schemaAdded( Schema schema );
+
+
+    /**
+     * Sent when a schema is removed.
+     *
+     * @param schema
+     *      the removed syntax
+     */
+    public void schemaRemoved( Schema schema );
+
+
+    /**
+     * Sent when a syntax is added.
+     *
+     * @param syntax
+     *      the added syntax
+     */
+    public void syntaxAdded( SyntaxImpl syntax );
+
+
+    /**
+     * Sent when a syntax is modified.
+     *
+     * @param syntax
+     *      the modified syntax
+     */
+    public void syntaxModified( SyntaxImpl syntax );
+
+
+    /**
+     * Sent when a syntax is removed.
+     *
+     * @param syntax
+     *      the removed syntax
+     */
+    public void syntaxRemoved( SyntaxImpl syntax );
+}
\ No newline at end of file

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaListener.java (from r551821, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaListener.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaListener.java?view=diff&rev=551909&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaListener.java&r1=551821&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaListener.java&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaListener.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaListener.java Fri Jun 29 07:37:30 2007
@@ -17,7 +17,12 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.studio.apacheds.schemaeditor.model;
+package org.apache.directory.studio.apacheds.schemaeditor.controller;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
 
 
 /**
@@ -113,7 +118,7 @@
     /**
      * Sent when a syntax is added.
      *
-     * @param mr
+     * @param syntax
      *      the added syntax
      */
     public void syntaxAdded( SyntaxImpl syntax );
@@ -122,7 +127,7 @@
     /**
      * Sent when a syntax is modified.
      *
-     * @param mr
+     * @param syntax
      *      the modified syntax
      */
     public void syntaxModified( SyntaxImpl syntax );
@@ -131,7 +136,7 @@
     /**
      * Sent when a syntax is removed.
      *
-     * @param mr
+     * @param syntax
      *      the removed syntax
      */
     public void syntaxRemoved( SyntaxImpl syntax );

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java Fri Jun 29 07:37:30 2007
@@ -34,7 +34,6 @@
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ConnectAction.java Fri Jun 29 07:37:30 2007
@@ -27,8 +27,8 @@
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
 import org.apache.directory.studio.apacheds.schemaeditor.SchemaImporter;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
-import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaHandler;
 import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/AttributeTypeImpl.java Fri Jun 29 07:37:30 2007
@@ -20,9 +20,6 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
@@ -43,6 +40,9 @@
 {
     private static final long serialVersionUID = 1L;
 
+    /** The object OID */
+    private String objectOid;
+    
     /** The name of the superior */
     private String superiorName;
 
@@ -58,9 +58,6 @@
     /** The name of the substr matching rule */
     private String substrName;
 
-    /** The listeners */
-    private List<AttributeTypeListener> listeners;
-
 
     /**
      * Creates a new instance of AttributeTypeImpl.
@@ -81,6 +78,26 @@
     {
         super.setNames( names );
     }
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#getOid()
+     */
+    public String getOid()
+    {
+        return objectOid;
+    }
+
+
+    /**
+     * Set the OID.
+     *
+     * @param oid
+     *      the OID value
+     */
+    public void setOid( String oid )
+    {
+        objectOid = oid;
+    }
 
 
     /* (non-Javadoc)
@@ -308,37 +325,5 @@
     public MatchingRule getSubstr() throws NamingException
     {
         return null;
-    }
-
-
-    /**
-     * Adds an AttributeTypeListener.
-     *
-     * @param listener
-     *      the AttributeTypeListener
-     */
-    public void addListener( AttributeTypeListener listener )
-    {
-        if ( listeners == null )
-        {
-            listeners = new ArrayList<AttributeTypeListener>();
-        }
-
-        listeners.add( listener );
-    }
-
-
-    /**
-     * Removes an AttributeTypeListener
-     *
-     * @param listener
-     *      the AttributeTypeListener
-     */
-    public void removeListener( AttributeTypeListener listener )
-    {
-        if ( listeners != null )
-        {
-            listeners.remove( listener );
-        }
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/ObjectClassImpl.java Fri Jun 29 07:37:30 2007
@@ -20,9 +20,6 @@
 package org.apache.directory.studio.apacheds.schemaeditor.model;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
@@ -42,6 +39,9 @@
 {
     private static final long serialVersionUID = 1L;
 
+    /** The object OID */
+    private String objectOid;
+
     /** The object class type */
     private ObjectClassTypeEnum type;
 
@@ -54,9 +54,6 @@
     /** The super class names list */
     private String[] superClassesNames;
 
-    /** The listeners */
-    private List<ObjectClassListener> listeners;
-
 
     /**
      * Creates a new instance of ObjectClassImpl.
@@ -67,6 +64,7 @@
     public ObjectClassImpl( String oid )
     {
         super( oid );
+        objectOid = oid;
     }
 
 
@@ -80,6 +78,27 @@
 
 
     /* (non-Javadoc)
+     * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#getOid()
+     */
+    public String getOid()
+    {
+        return objectOid;
+    }
+
+
+    /**
+     * Set the OID.
+     *
+     * @param oid
+     *      the OID value
+     */
+    public void setOid( String oid )
+    {
+        objectOid = oid;
+    }
+
+
+    /* (non-Javadoc)
      * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setDescription(java.lang.String)
      */
     public void setDescription( String description )
@@ -214,37 +233,5 @@
     public AttributeType[] getMayList() throws NamingException
     {
         return null;
-    }
-
-
-    /**
-     * Adds an ObjectClassListener.
-     *
-     * @param listener
-     *      the ObjectClassListener
-     */
-    public void addListener( ObjectClassListener listener )
-    {
-        if ( listeners == null )
-        {
-            listeners = new ArrayList<ObjectClassListener>();
-        }
-
-        listeners.add( listener );
-    }
-
-
-    /**
-     * Removes an ObjectClassListener
-     *
-     * @param listener
-     *      the ObjectClassListener
-     */
-    public void removeListener( ObjectClassListener listener )
-    {
-        if ( listeners != null )
-        {
-            listeners.remove( listener );
-        }
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/Schema.java Fri Jun 29 07:37:30 2007
@@ -22,11 +22,6 @@
 
 import java.util.List;
 
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.Syntax;
-
 
 /**
  * This interface represents a Schema.
@@ -55,157 +50,157 @@
 
 
     /**
-     * Gets all the ObjectClass objects contained in the Schema.
+     * Gets all the ObjectClassImpl objects contained in the Schema.
      * 
      * @return
-     * 		all the ObjectClass objects contained in the Schema
+     * 		all the ObjectClassImpl objects contained in the Schema
      */
-    public List<ObjectClass> getObjectClasses();
+    public List<ObjectClassImpl> getObjectClasses();
 
 
     /**
-     * Gets all the AttributeType objects contained in the Schema.
+     * Gets all the AttributeTypeImpl objects contained in the Schema.
      * 
      * @return
-     * 		all the AttributeType objects contained in the Schema
+     * 		all the AttributeTypeImpl objects contained in the Schema
      */
-    public List<AttributeType> getAttributeTypes();
+    public List<AttributeTypeImpl> getAttributeTypes();
 
 
     /**
-     * Gets all the MatchingRule objects contained in the Schema.
+     * Gets all the MatchingRuleImpl objects contained in the Schema.
      * 
      * @return
-     *      all the MatchingRule objects contained in the Schema
+     *      all the MatchingRuleImpl objects contained in the Schema
      */
-    public List<MatchingRule> getMatchingRules();
+    public List<MatchingRuleImpl> getMatchingRules();
 
 
     /**
-     * Gets all the Syntax objects contained in the Schema.
+     * Gets all the SyntaxImpl objects contained in the Schema.
      * 
      * @return
-     *      all the Syntax objects contained in the Schema
+     *      all the SyntaxImpl objects contained in the Schema
      */
-    public List<Syntax> getSyntaxes();
+    public List<SyntaxImpl> getSyntaxes();
 
 
     /**
-     * Gets the ObjectClass identified by the given id.
+     * Gets the ObjectClassImpl identified by the given id.
      * 
      * @param id
-     * 		the name or the oid of the ObjectClass
+     * 		the name or the oid of the ObjectClassImpl
      * @return
-     * 		the ObjectClass identified by the given id, or null if the 
-     * ObjectClass has not been found
+     * 		the ObjectClassImpl identified by the given id, or null if the 
+     * ObjectClassImpl has not been found
      */
-    public ObjectClass getObjectClass( String id );
+    public ObjectClassImpl getObjectClass( String id );
 
 
     /**
-     * Gets the AttributeType identified by the given id.
+     * Gets the AttributeTypeImpl identified by the given id.
      * 
      * @param id
-     * 		the name or the oid of the AttributeType
+     * 		the name or the oid of the AttributeTypeImpl
      * @return
-     * 		the AttributeType identified by the given id, or null if the 
-     * AttributeType has not been found
+     * 		the AttributeTypeImpl identified by the given id, or null if the 
+     * AttributeTypeImpl has not been found
      */
-    public AttributeType getAttributeType( String id );
+    public AttributeTypeImpl getAttributeType( String id );
 
 
     /**
-     * Gets the MatchingRule identified by the given id.
+     * Gets the MatchingRuleImpl identified by the given id.
      * 
      * @param id
-     *      the name or the oid of the AttributeType
+     *      the name or the oid of the MatchingRuleImpl
      * @return
-     *      the MatchingRule identified by the given id, or null if the 
-     * MatchingRule has not been found
+     *      the MatchingRuleImpl identified by the given id, or null if the 
+     * MatchingRuleImpl has not been found
      */
-    public MatchingRule getMatchingRule( String id );
+    public MatchingRuleImpl getMatchingRule( String id );
 
 
     /**
-     * Gets the Syntax identified by the given id.
+     * Gets the SyntaxImpl identified by the given id.
      * 
      * @param id
-     *      the name or the oid of the AttributeType
+     *      the name or the oid of the SyntaxImpl
      * @return
-     *      the Syntax identified by the given id, or null if the 
-     * Syntax has not been found
+     *      the SyntaxImpl identified by the given id, or null if the 
+     * SyntaxImpl has not been found
      */
-    public MatchingRule getSyntax( String id );
+    public SyntaxImpl getSyntax( String id );
 
 
     /**
-     * Adds an ObjectClass to the Schema.
+     * Adds an ObjectClassImpl to the Schema.
      * 
      * @param oc
-     *      the ObjectClass
+     *      the ObjectClassImpl
      */
-    public boolean addObjectClass( ObjectClass oc );
+    public boolean addObjectClass( ObjectClassImpl oc );
 
 
     /**
-     * Adds an AttributeType to the Schema.
+     * Adds an AttributeTypeImpl to the Schema.
      * 
      * @param at
-     *      the AttributeType
+     *      the AttributeTypeImpl
      */
-    public boolean addAttributeType( AttributeType at );
+    public boolean addAttributeType( AttributeTypeImpl at );
 
 
     /**
-     * Adds a MatchingRule from the Schema.
+     * Adds a MatchingRuleImpl from the Schema.
      * 
      * @param mr
-     *      the MatchingRule
+     *      the MatchingRuleImpl
      */
-    public boolean addMatchingRule( MatchingRule mr );
+    public boolean addMatchingRule( MatchingRuleImpl mr );
 
 
     /**
-     * Adds a Syntax from the Schema.
+     * Adds a SyntaxImpl from the Schema.
      * 
      * @param syntax
-     *      the Syntax
+     *      the SyntaxImpl
      */
-    public boolean addSyntax( Syntax syntax );
+    public boolean addSyntax( SyntaxImpl syntax );
 
 
     /**
-     * Removes an ObjectClass from the Schema.
+     * Removes an ObjectClassImpl from the Schema.
      *
      * @param oc
-     *      the ObjectClass
+     *      the ObjectClassImpl
      */
-    public boolean removeObjectClass( ObjectClass oc );
+    public boolean removeObjectClass( ObjectClassImpl oc );
 
 
     /**
-     * Removes an AttributeType from the Schema.
+     * Removes an AttributeTypeImpl from the Schema.
      * 
      * @param at
-     *      the AttributeType
+     *      the AttributeTypeImpl
      */
-    public boolean removeAttributeType( AttributeType at );
+    public boolean removeAttributeType( AttributeTypeImpl at );
 
 
     /**
-     * Removes a MatchingRule from the Schema.
+     * Removes a MatchingRuleImpl from the Schema.
      * 
      * @param mr
-     *      the MatchingRule
+     *      the MatchingRuleImpl
      */
-    public boolean removeMatchingRule( MatchingRule mr );
+    public boolean removeMatchingRule( MatchingRuleImpl mr );
 
 
     /**
-     * Removes a Syntax from the Schema.
+     * Removes a SyntaxImpl from the Schema.
      * 
      * @param syntax
-     *      the Syntax
+     *      the SyntaxImpl
      */
-    public boolean removeSyntax( Syntax syntax );
+    public boolean removeSyntax( SyntaxImpl syntax );
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/SchemaImpl.java Fri Jun 29 07:37:30 2007
@@ -23,11 +23,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.Syntax;
-
 
 /**
  * This class represents a schema.
@@ -41,19 +36,16 @@
     private String name;
 
     /** The AttributeType List */
-    private List<AttributeType> attributeTypes = new ArrayList<AttributeType>();
+    private List<AttributeTypeImpl> attributeTypes = new ArrayList<AttributeTypeImpl>();
 
     /** The ObjectClass List */
-    private List<ObjectClass> objectClasses = new ArrayList<ObjectClass>();
+    private List<ObjectClassImpl> objectClasses = new ArrayList<ObjectClassImpl>();
 
     /** The MatchingRule List */
-    private List<MatchingRule> matchingRules = new ArrayList<MatchingRule>();
+    private List<MatchingRuleImpl> matchingRules = new ArrayList<MatchingRuleImpl>();
 
     /** The Syntax List */
-    private List<Syntax> syntaxes = new ArrayList<Syntax>();
-
-    /** The listeners */
-    private List<SchemaListener> listeners;
+    private List<SyntaxImpl> syntaxes = new ArrayList<SyntaxImpl>();
 
 
     /**
@@ -71,7 +63,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
      */
-    public boolean addAttributeType( AttributeType at )
+    public boolean addAttributeType( AttributeTypeImpl at )
     {
         return attributeTypes.add( at );
     }
@@ -80,7 +72,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
      */
-    public boolean addMatchingRule( MatchingRule mr )
+    public boolean addMatchingRule( MatchingRuleImpl mr )
     {
         return matchingRules.add( mr );
     }
@@ -89,7 +81,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
      */
-    public boolean addObjectClass( ObjectClass oc )
+    public boolean addObjectClass( ObjectClassImpl oc )
     {
         return objectClasses.add( oc );
     }
@@ -98,7 +90,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#addSyntax(org.apache.directory.shared.ldap.schema.Syntax)
      */
-    public boolean addSyntax( Syntax syntax )
+    public boolean addSyntax( SyntaxImpl syntax )
     {
         return syntaxes.add( syntax );
     }
@@ -107,7 +99,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getAttributeType(java.lang.String)
      */
-    public AttributeType getAttributeType( String id )
+    public AttributeTypeImpl getAttributeType( String id )
     {
         // TODO Auto-generated method stub
         return null;
@@ -117,7 +109,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getAttributeTypes()
      */
-    public List<AttributeType> getAttributeTypes()
+    public List<AttributeTypeImpl> getAttributeTypes()
     {
         return attributeTypes;
     }
@@ -126,7 +118,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getMatchingRule(java.lang.String)
      */
-    public MatchingRule getMatchingRule( String id )
+    public MatchingRuleImpl getMatchingRule( String id )
     {
         // TODO Auto-generated method stub
         return null;
@@ -136,7 +128,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getMatchingRules()
      */
-    public List<MatchingRule> getMatchingRules()
+    public List<MatchingRuleImpl> getMatchingRules()
     {
         return matchingRules;
     }
@@ -154,7 +146,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getObjectClass(java.lang.String)
      */
-    public ObjectClass getObjectClass( String id )
+    public ObjectClassImpl getObjectClass( String id )
     {
         // TODO Auto-generated method stub
         return null;
@@ -164,7 +156,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getObjectClasses()
      */
-    public List<ObjectClass> getObjectClasses()
+    public List<ObjectClassImpl> getObjectClasses()
     {
         return objectClasses;
     }
@@ -173,7 +165,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getSyntax(java.lang.String)
      */
-    public MatchingRule getSyntax( String id )
+    public SyntaxImpl getSyntax( String id )
     {
         // TODO Auto-generated method stub
         return null;
@@ -183,7 +175,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#getSyntaxes()
      */
-    public List<Syntax> getSyntaxes()
+    public List<SyntaxImpl> getSyntaxes()
     {
         return syntaxes;
     }
@@ -192,7 +184,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
      */
-    public boolean removeAttributeType( AttributeType at )
+    public boolean removeAttributeType( AttributeTypeImpl at )
     {
         return attributeTypes.remove( at );
     }
@@ -201,7 +193,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
      */
-    public boolean removeMatchingRule( MatchingRule mr )
+    public boolean removeMatchingRule( MatchingRuleImpl mr )
     {
         return matchingRules.remove( mr );
     }
@@ -210,7 +202,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
      */
-    public boolean removeObjectClass( ObjectClass oc )
+    public boolean removeObjectClass( ObjectClassImpl oc )
     {
         return objectClasses.remove( oc );
     }
@@ -219,7 +211,7 @@
     /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.schemaeditor.model.Schema#removeSyntax(org.apache.directory.shared.ldap.schema.Syntax)
      */
-    public boolean removeSyntax( Syntax syntax )
+    public boolean removeSyntax( SyntaxImpl syntax )
     {
         return syntaxes.remove( syntax );
     }
@@ -231,37 +223,5 @@
     public void setName( String name )
     {
         this.name = name;
-    }
-
-
-    /**
-     * Adds an SchemaListener.
-     *
-     * @param listener
-     *      the SchemaListener
-     */
-    public void addListener( SchemaListener listener )
-    {
-        if ( listeners == null )
-        {
-            listeners = new ArrayList<SchemaListener>();
-        }
-
-        listeners.add( listener );
-    }
-
-
-    /**
-     * Removes an SchemaListener
-     *
-     * @param listener
-     *      the SchemaListener
-     */
-    public void removeListener( SchemaListener listener )
-    {
-        if ( listeners != null )
-        {
-            listeners.remove( listener );
-        }
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java?view=diff&rev=551909&r1=551908&r2=551909
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java Fri Jun 29 07:37:30 2007
@@ -22,10 +22,10 @@
 
 import java.util.List;
 
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
 import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
-import org.apache.directory.studio.apacheds.schemaeditor.model.SchemaHandler;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
@@ -123,14 +123,14 @@
                 Folder ocFolder = new Folder( FolderType.OBJECT_CLASS, schemaWrapper );
                 schemaWrapper.addChild( ocFolder );
 
-                List<AttributeType> attributeTypes = schemaWrapper.getSchema().getAttributeTypes();
-                for ( AttributeType attributeType : attributeTypes )
+                List<AttributeTypeImpl> attributeTypes = schemaWrapper.getSchema().getAttributeTypes();
+                for ( AttributeTypeImpl attributeType : attributeTypes )
                 {
                     atFolder.addChild( new AttributeTypeWrapper( attributeType, atFolder ) );
                 }
 
-                List<ObjectClass> objectClasses = schemaWrapper.getSchema().getObjectClasses();
-                for ( ObjectClass objectClass : objectClasses )
+                List<ObjectClassImpl> objectClasses = schemaWrapper.getSchema().getObjectClasses();
+                for ( ObjectClassImpl objectClass : objectClasses )
                 {
                     ocFolder.addChild( new ObjectClassWrapper( objectClass, ocFolder ) );
                 }



Mime
View raw message