directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1066096 - in /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/ model/schemachecker/ model/schemamanager/ view/views/ view/wrappers/
Date Tue, 01 Feb 2011 16:57:59 GMT
Author: pamarcelot
Date: Tue Feb  1 16:57:59 2011
New Revision: 1066096

URL: http://svn.apache.org/viewvc?rev=1066096&view=rev
Log:
Basic replacement of studio's custom code for checking schema integrity. Using Shared SchemaManager class instead.

Removed:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaError.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaWarning.java
Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoader.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/ProblemsViewController.java Tue Feb  1 16:57:59 2011
@@ -113,7 +113,7 @@ public class ProblemsViewController
                 // Selecting the right editor and input
                 if ( objectSelection instanceof SchemaErrorWrapper )
                 {
-                    SchemaObject object = ( ( SchemaErrorWrapper ) objectSelection ).getSchemaError().getSource();
+                    SchemaObject object = ( ( SchemaErrorWrapper ) objectSelection ).getLdapSchemaException().getSource();
 
                     if ( object instanceof AttributeType )
                     {
@@ -128,18 +128,19 @@ public class ProblemsViewController
                 }
                 else if ( objectSelection instanceof SchemaWarningWrapper )
                 {
-                    SchemaObject object = ( ( SchemaWarningWrapper ) objectSelection ).getSchemaWarning().getSource();
-
-                    if ( object instanceof AttributeType )
-                    {
-                        input = new AttributeTypeEditorInput( ( AttributeType ) object );
-                        editorId = AttributeTypeEditor.ID;
-                    }
-                    else if ( object instanceof ObjectClass )
-                    {
-                        input = new ObjectClassEditorInput( ( ObjectClass ) object );
-                        editorId = ObjectClassEditor.ID;
-                    }
+                    // TODO
+//                    SchemaObject object = ( ( SchemaWarningWrapper ) objectSelection ).getSchemaWarning().getSource();
+//
+//                    if ( object instanceof AttributeType )
+//                    {
+//                        input = new AttributeTypeEditorInput( ( AttributeType ) object );
+//                        editorId = AttributeTypeEditor.ID;
+//                    }
+//                    else if ( object instanceof ObjectClass )
+//                    {
+//                        input = new ObjectClassEditorInput( ( ObjectClass ) object );
+//                        editorId = ObjectClassEditor.ID;
+//                    }
                 }
                 else if ( ( objectSelection instanceof Folder ) )
                 {

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/SchemaChecker.java Tue Feb  1 16:57:59 2011
@@ -25,21 +25,19 @@ import java.util.List;
 
 import org.apache.commons.collections.MultiMap;
 import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.shared.ldap.model.exception.LdapSchemaException;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.LdapSyntax;
-import org.apache.directory.shared.ldap.model.schema.MatchingRule;
 import org.apache.directory.shared.ldap.model.schema.ObjectClass;
-import org.apache.directory.shared.ldap.model.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.SchemaObject;
-import org.apache.directory.shared.ldap.model.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.controller.ProjectsHandlerAdapter;
-import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
 import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
 import org.apache.directory.studio.schemaeditor.model.Project;
 import org.apache.directory.studio.schemaeditor.model.Schema;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMatchingRuleError.NonExistingMatchingRuleErrorEnum;
+import org.apache.directory.studio.schemaeditor.model.schemamanager.SchemaEditorSchemaLoader;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -58,24 +56,15 @@ public class SchemaChecker
     /** The SchemaChecker instance */
     private static SchemaChecker instance;
 
+    /** The schema manager */
+    private SchemaManager schemaManager;
+
     /** The errors List */
-    private List<SchemaError> errorsList;
+    private List<Throwable> errorsList;
 
     /** The errors MultiMap */
     private MultiMap errorsMap;
 
-    /** The warnings List */
-    private List<SchemaWarning> warningsList;
-
-    /** The warnings MultiMap */
-    private MultiMap warningsMap;
-
-    /** The Dependencies MultiMap */
-    private MultiMap dependenciesMap;
-
-    /** The Depends On MultiMap */
-    private MultiMap dependsOnMap;
-
     /** The 'listening to modifications' flag*/
     private boolean listeningToModifications = false;
 
@@ -89,11 +78,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<?> deps = getAndDeleteDependencies( at );
-
-                checkAttributeType( at );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -104,16 +88,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<Object> deps = new ArrayList<Object>();
-                List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
-                if ( atDeps != null )
-                {
-                    deps.addAll( atDeps );
-                }
-
-                checkAttributeType( at );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -124,16 +98,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<Object> deps = new ArrayList<Object>();
-                List<?> atDeps = ( List<?> ) dependenciesMap.get( at );
-                if ( atDeps != null )
-                {
-                    deps.addAll( atDeps );
-                }
-
-                removeSchemaObject( at );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -144,11 +108,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<?> deps = getAndDeleteDependencies( oc );
-
-                checkObjectClass( oc );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -159,16 +118,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<Object> deps = new ArrayList<Object>();
-                List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
-                if ( ocDeps != null )
-                {
-                    deps.addAll( ocDeps );
-                }
-
-                checkObjectClass( oc );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -179,16 +128,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<Object> deps = new ArrayList<Object>();
-                List<?> ocDeps = ( List<?> ) dependenciesMap.get( oc );
-                if ( ocDeps != null )
-                {
-                    deps.addAll( ocDeps );
-                }
-
-                removeSchemaObject( oc );
-
-                checkDependencies( deps );
 
                 notifyListeners();
             }
@@ -199,17 +138,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<AttributeType> ats = schema.getAttributeTypes();
-                for ( AttributeType at : ats )
-                {
-                    checkAttributeType( at );
-                }
-
-                List<ObjectClass> ocs = schema.getObjectClasses();
-                for ( ObjectClass oc : ocs )
-                {
-                    checkObjectClass( oc );
-                }
 
                 notifyListeners();
             }
@@ -220,17 +148,6 @@ public class SchemaChecker
         {
             synchronized ( this )
             {
-                List<AttributeType> ats = schema.getAttributeTypes();
-                for ( AttributeType at : ats )
-                {
-                    removeSchemaObject( at );
-                }
-
-                List<ObjectClass> ocs = schema.getObjectClasses();
-                for ( ObjectClass oc : ocs )
-                {
-                    removeSchemaObject( oc );
-                }
 
                 notifyListeners();
             }
@@ -243,13 +160,10 @@ public class SchemaChecker
      */
     private SchemaChecker()
     {
-        errorsList = new ArrayList<SchemaError>();
-        errorsMap = new MultiValueMap();
-        warningsList = new ArrayList<SchemaWarning>();
-        warningsMap = new MultiValueMap();
-        dependenciesMap = new MultiValueMap();
-        dependsOnMap = new MultiValueMap();
         listeners = new ArrayList<SchemaCheckerListener>();
+        
+        schemaManager = new DefaultSchemaManager( new SchemaEditorSchemaLoader() );
+        errorsMap = new MultiValueMap();
 
         Activator.getDefault().getProjectsHandler().addListener( new ProjectsHandlerAdapter()
         {
@@ -315,7 +229,6 @@ public class SchemaChecker
             {
                 Activator.getDefault().getSchemaHandler().removeListener( schemaHandlerListener );
                 listeningToModifications = false;
-                clearErrorsAndWarnings();
             }
         }
     }
@@ -328,7 +241,9 @@ public class SchemaChecker
     {
         synchronized ( this )
         {
-            clearErrorsAndWarnings();
+            schemaManager = new DefaultSchemaManager( new SchemaEditorSchemaLoader() );
+            errorsMap = new MultiValueMap();
+            
             checkWholeSchema();
         }
     }
@@ -349,20 +264,6 @@ public class SchemaChecker
 
 
     /**
-     * Clears all the errors and warnings.
-     */
-    private void clearErrorsAndWarnings()
-    {
-        errorsList.clear();
-        errorsMap.clear();
-        warningsList.clear();
-        warningsMap.clear();
-        dependenciesMap.clear();
-        dependsOnMap.clear();
-    }
-
-
-    /**
      * Checks the whole schema.
      */
     private synchronized void checkWholeSchema()
@@ -371,30 +272,27 @@ public class SchemaChecker
         {
             protected IStatus run( IProgressMonitor monitor )
             {
-                SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
-                if ( schemaHandler != null )
+                try
                 {
-                    List<Schema> schemas = schemaHandler.getSchemas();
-
-                    monitor.beginTask( "Checking schemas: ", schemas.size() );
+                    schemaManager.loadAllEnabled();
+                }
+                catch ( Exception e )
+                {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
 
-                    for ( Schema schema : schemas )
+                errorsList = schemaManager.getErrors();
+                for ( Throwable error : errorsList )
+                {
+                    if ( error instanceof LdapSchemaException )
                     {
-                        monitor.subTask( schema.getSchemaName() );
-
-                        List<AttributeType> ats = schema.getAttributeTypes();
-                        for ( AttributeType at : ats )
+                        LdapSchemaException ldapSchemaException = (LdapSchemaException) error;
+                        SchemaObject source = ldapSchemaException.getSource();
+                        if ( source != null )
                         {
-                            checkAttributeType( at );
+                            errorsMap.put( source, ldapSchemaException );
                         }
-
-                        List<ObjectClass> ocs = schema.getObjectClasses();
-                        for ( ObjectClass oc : ocs )
-                        {
-                            checkObjectClass( oc );
-                        }
-
-                        monitor.worked( 1 );
                     }
                 }
 
@@ -404,424 +302,17 @@ public class SchemaChecker
                 return Status.OK_STATUS;
             }
         };
-
-        job.setUser( true );
         job.schedule();
     }
 
 
     /**
-     * Checks the given attribute type.
-     *
-     * @param at
-     *      an attribute type
-     */
-    private void checkAttributeType( AttributeType at )
-    {
-        removeSchemaObject( at );
-
-        // Checking OID
-        String oid = at.getOid();
-        if ( ( oid != null ) && ( !"".equals( oid ) ) )
-        {
-            List<?> list = getSchemaElementList( oid );
-            if ( ( list != null ) && ( list.size() >= 2 ) )
-            {
-                int counter = 0;
-                Object o = list.get( counter );
-                while ( ( at.equals( o ) ) && ( counter < ( list.size() - 1 ) ) )
-                {
-                    counter++;
-                    o = list.get( counter );
-                }
-                SchemaError error = new DuplicateOidError( at, oid, ( SchemaObject ) o );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-            }
-        }
-
-        // Checking aliases
-        List<String> aliases = at.getNames();
-        if ( ( aliases == null ) || ( aliases.size() == 0 ) )
-        {
-            SchemaWarning warning = new NoAliasWarning( at );
-            warningsList.add( warning );
-            warningsMap.put( at, warning );
-        }
-        else if ( ( aliases != null ) && ( aliases.size() >= 1 ) )
-        {
-            for ( String alias : aliases )
-            {
-                List<?> list = getSchemaElementList( alias );
-                if ( ( list != null ) && ( list.size() >= 2 ) )
-                {
-                    int counter = 0;
-                    Object o = list.get( counter );
-                    while ( ( at.equals( o ) ) && ( counter < ( list.size() - 1 ) ) )
-                    {
-                        counter++;
-                        o = list.get( counter );
-                    }
-                    SchemaError error = new DuplicateAliasError( at, alias, ( SchemaObject ) o );
-                    errorsList.add( error );
-                    errorsMap.put( at, error );
-                }
-            }
-        }
-
-        // Checking superior
-        String superior = at.getSuperiorOid();
-        if ( ( superior != null ) && ( !"".equals( superior ) ) )
-        {
-            AttributeType superiorAT = Activator.getDefault().getSchemaHandler().getAttributeType( superior );
-            if ( superiorAT == null )
-            {
-                SchemaError error = new NonExistingATSuperiorError( at, superior );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-                dependenciesMap.put( superior, at );
-                dependsOnMap.put( at, superior );
-            }
-            else
-            {
-                dependenciesMap.put( superiorAT, at );
-                dependsOnMap.put( at, superiorAT );
-
-                // Checking Usage with superior's
-                UsageEnum usage = at.getUsage();
-                UsageEnum superiorATUsage = superiorAT.getUsage();
-                if ( !usage.equals( superiorATUsage ) )
-                {
-                    SchemaError error = new DifferentUsageAsSuperiorError( at, superiorAT );
-                    errorsList.add( error );
-                    errorsMap.put( at, error );
-                }
-
-                // Checking Collective with superior's
-                boolean collective = at.isCollective();
-                boolean superiorATCollective = superiorAT.isCollective();
-                if ( superiorATCollective && !collective )
-                {
-                    SchemaError error = new DifferentCollectiveAsSuperiorError( at, superiorAT );
-                    errorsList.add( error );
-                    errorsMap.put( at, error );
-                }
-            }
-        }
-
-        // Checking syntax
-        String syntaxOid = at.getSyntaxOid();
-        if ( ( syntaxOid != null ) && ( !"".equals( syntaxOid ) ) )
-        {
-            LdapSyntax syntax = Activator.getDefault().getSchemaHandler().getSyntax( syntaxOid );
-            if ( syntax == null )
-            {
-                SchemaError error = new NonExistingSyntaxError( at, syntaxOid );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-                dependenciesMap.put( syntaxOid, at );
-                dependsOnMap.put( at, syntaxOid );
-            }
-            else
-            {
-                dependenciesMap.put( syntax, at );
-                dependsOnMap.put( at, syntax );
-            }
-        }
-
-        // Equality matching rule
-        String equality = at.getEqualityOid();
-        if ( ( equality != null ) && ( !"".equals( equality ) ) )
-        {
-            MatchingRule equalityMR = Activator.getDefault().getSchemaHandler().getMatchingRule( equality );
-            if ( equalityMR == null )
-            {
-                SchemaError error = new NonExistingMatchingRuleError( at, equality,
-                    NonExistingMatchingRuleErrorEnum.EQUALITY );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-                dependenciesMap.put( equality, at );
-                dependsOnMap.put( at, equality );
-            }
-            else
-            {
-                dependenciesMap.put( equalityMR, at );
-                dependsOnMap.put( at, equalityMR );
-            }
-        }
-
-        // Ordering matching rule
-        String ordering = at.getOrderingOid();
-        if ( ( ordering != null ) && ( !"".equals( ordering ) ) )
-        {
-            MatchingRule orderingMR = Activator.getDefault().getSchemaHandler().getMatchingRule( ordering );
-            if ( orderingMR == null )
-            {
-                SchemaError error = new NonExistingMatchingRuleError( at, ordering,
-                    NonExistingMatchingRuleErrorEnum.ORDERING );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-                dependenciesMap.put( ordering, at );
-                dependsOnMap.put( at, ordering );
-            }
-            else
-            {
-                dependenciesMap.put( orderingMR, at );
-                dependsOnMap.put( at, orderingMR );
-            }
-        }
-
-        // Substring matching rule
-        String substring = at.getSubstringOid();
-        if ( ( substring != null ) && ( !"".equals( substring ) ) )
-        {
-            MatchingRule substringMR = Activator.getDefault().getSchemaHandler().getMatchingRule( substring );
-            if ( substringMR == null )
-            {
-                SchemaError error = new NonExistingMatchingRuleError( at, substring,
-                    NonExistingMatchingRuleErrorEnum.SUBSTRING );
-                errorsList.add( error );
-                errorsMap.put( at, error );
-                dependenciesMap.put( substring, at );
-                dependsOnMap.put( at, substring );
-            }
-            else
-            {
-                dependenciesMap.put( substringMR, at );
-                dependsOnMap.put( at, substringMR );
-            }
-        }
-    }
-
-
-    /**
-     * Checks the given object class.
-     *
-     * @param oc
-     *      an object class
-     */
-    private void checkObjectClass( ObjectClass oc )
-    {
-        removeSchemaObject( oc );
-
-        // Checking OID
-        String oid = oc.getOid();
-        if ( ( oid != null ) && ( !"".equals( oid ) ) )
-        {
-            List<?> list = getSchemaElementList( oid );
-            if ( ( list != null ) && ( list.size() >= 2 ) )
-            {
-                int counter = 0;
-                Object o = list.get( counter );
-                while ( ( oc.equals( o ) ) && ( counter < ( list.size() - 1 ) ) )
-                {
-                    counter++;
-                    o = list.get( counter );
-                }
-                SchemaError error = new DuplicateOidError( oc, oid, ( SchemaObject ) o );
-                errorsList.add( error );
-                errorsMap.put( oc, error );
-            }
-        }
-
-        // Checking aliases
-        List<String> aliases = oc.getNames();
-        if ( ( aliases == null ) || ( aliases.size() == 0 ) )
-        {
-            SchemaWarning warning = new NoAliasWarning( oc );
-            warningsList.add( warning );
-            warningsMap.put( oc, warning );
-        }
-        else if ( ( aliases != null ) && ( aliases.size() >= 1 ) )
-        {
-            for ( String alias : aliases )
-            {
-                List<?> list = getSchemaElementList( alias );
-                if ( ( list != null ) && ( list.size() >= 2 ) )
-                {
-                    int counter = 0;
-                    Object o = list.get( counter );
-                    while ( ( oc.equals( o ) ) && ( counter < ( list.size() - 1 ) ) )
-                    {
-                        counter++;
-                        o = list.get( counter );
-                    }
-                    SchemaError error = new DuplicateAliasError( oc, oid, ( SchemaObject ) o );
-                    errorsList.add( error );
-                    errorsMap.put( oc, error );
-                }
-            }
-        }
-
-        // Checking superiors
-        List<String> superiors = oc.getSuperiorOids();
-        if ( ( superiors != null ) && ( superiors.size() >= 1 ) )
-        {
-            ObjectClassTypeEnum type = oc.getType();
-
-            for ( String superior : superiors )
-            {
-                ObjectClass superiorOC = Activator.getDefault().getSchemaHandler().getObjectClass( superior );
-                if ( superiorOC == null )
-                {
-                    SchemaError error = new NonExistingOCSuperiorError( oc, superior );
-                    errorsList.add( error );
-                    errorsMap.put( oc, error );
-                    dependenciesMap.put( superior, oc );
-                    dependsOnMap.put( oc, superior );
-                }
-                else
-                {
-                    dependenciesMap.put( superiorOC, oc );
-                    dependsOnMap.put( oc, superiorOC );
-
-                    // Checking Type of Superior Hierarchy
-                    ObjectClassTypeEnum superiorOCType = superiorOC.getType();
-                    switch ( type )
-                    {
-                        case ABSTRACT:
-                            if ( ( !superiorOCType.equals( ObjectClassTypeEnum.ABSTRACT ) )
-                                && ( !superiorOC.getOid().equals( "2.5.6.0" ) ) )
-                            {
-                                SchemaError error = new ClassTypeHierarchyError( oc, superiorOC );
-                                errorsList.add( error );
-                                errorsMap.put( oc, error );
-                            }
-                            break;
-                        case AUXILIARY:
-                            if ( ( superiorOCType.equals( ObjectClassTypeEnum.STRUCTURAL ) )
-                                && ( !superiorOC.getOid().equals( "2.5.6.0" ) ) )
-                            {
-                                SchemaError error = new ClassTypeHierarchyError( oc, superiorOC );
-                                errorsList.add( error );
-                                errorsMap.put( oc, error );
-                            }
-                            break;
-
-                        default:
-                            break;
-                    }
-                }
-            }
-        }
-
-        // Checking mandatory and optional attributes
-        List<String> mandatoryATNames = oc.getMustAttributeTypeOids();
-        List<String> optionalATNames = oc.getMayAttributeTypeOids();
-        if ( ( mandatoryATNames != null ) && ( optionalATNames != null ) )
-        {
-            for ( String mandatoryATName : mandatoryATNames )
-            {
-                AttributeType mandatoryAT = Activator.getDefault().getSchemaHandler().getAttributeType(
-                    mandatoryATName );
-                if ( mandatoryAT == null )
-                {
-                    SchemaError error = new NonExistingMandatoryATError( oc, mandatoryATName );
-                    errorsList.add( error );
-                    errorsMap.put( oc, error );
-                    dependenciesMap.put( mandatoryATName, oc );
-                    dependsOnMap.put( oc, mandatoryATName );
-                }
-                else
-                {
-                    dependenciesMap.put( mandatoryAT, oc );
-                    dependsOnMap.put( oc, mandatoryAT );
-                }
-            }
-
-            for ( String optionalATName : optionalATNames )
-            {
-                AttributeType optionalAT = Activator.getDefault().getSchemaHandler().getAttributeType(
-                    optionalATName );
-                if ( optionalAT == null )
-                {
-                    SchemaError error = new NonExistingOptionalATError( oc, optionalATName );
-                    errorsList.add( error );
-                    errorsMap.put( oc, error );
-                    dependenciesMap.put( optionalATName, oc );
-                    dependsOnMap.put( oc, optionalATName );
-                }
-                else
-                {
-                    dependenciesMap.put( optionalAT, oc );
-                    dependsOnMap.put( oc, optionalAT );
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Remove the errors and warnings for the given schema element.
-     *
-     * @param element
-     *      a schema element
-     */
-    private void removeSchemaObject( SchemaObject element )
-    {
-        // Removing old errors and warnings
-        List<?> errors = ( List<?> ) errorsMap.get( element );
-        if ( ( errors != null ) && ( errors.size() >= 1 ) )
-        {
-            for ( Object error : errors )
-            {
-                errorsList.remove( error );
-            }
-            errorsMap.remove( element );
-        }
-        List<?> warnings = ( List<?> ) warningsMap.get( element );
-        if ( ( warnings != null ) && ( warnings.size() >= 1 ) )
-        {
-            for ( Object warning : warnings )
-            {
-                warningsList.remove( warning );
-            }
-            warningsMap.remove( element );
-        }
-
-        // Removing 'depends on' and dependencies
-        List<?> dependsOn = ( List<?> ) dependsOnMap.get( element );
-        if ( dependsOn != null )
-        {
-            for ( Object dep : dependsOn )
-            {
-                dependenciesMap.remove( dep, element );
-            }
-            dependsOnMap.remove( element );
-        }
-    }
-
-
-    @SuppressWarnings("unchecked")
-    private List<?> getSchemaElementList( String id )
-    {
-        List results = new ArrayList<Object>();
-
-        // Attribute types
-        List<?> atList = Activator.getDefault().getSchemaHandler().getAttributeTypeList( id );
-        if ( ( atList != null ) && ( atList.size() >= 1 ) )
-        {
-            results.addAll( atList );
-        }
-
-        // Object classes
-        List<?> ocList = Activator.getDefault().getSchemaHandler().getObjectClassList( id );
-        if ( ( ocList != null ) && ( ocList.size() >= 1 ) )
-        {
-            results.addAll( ocList );
-        }
-
-        return results;
-    }
-
-
-    /**
      * Gets the errors.
      *
      * @return
      *      the errors
      */
-    public List<SchemaError> getErrors()
+    public List<Throwable> getErrors()
     {
         return errorsList;
     }
@@ -833,9 +324,10 @@ public class SchemaChecker
      * @return
      *      the warnings
      */
-    public List<SchemaWarning> getWarnings()
+    public List<Object> getWarnings()
     {
-        return warningsList;
+        // TODO
+        return new ArrayList<Object>();
     }
 
 
@@ -923,9 +415,10 @@ public class SchemaChecker
      * @return
      *      the associated warnings
      */
-    public List<?> getWarnings( SchemaObject so )
+    public List<Object> getWarnings( SchemaObject so )
     {
-        return ( List<?> ) warningsMap.get( so );
+        return new ArrayList<Object>();
+     //   return ( List<?> ) warningsMap.get( so );
     }
 
 
@@ -950,83 +443,4 @@ public class SchemaChecker
             return warnings.size() > 0;
         }
     }
-
-
-    /**
-     * Checks the given list of dependencies.
-     * 
-     * @param deps
-     *      the list of dependencies
-     */
-    public void checkDependencies( List<?> deps )
-    {
-        if ( deps != null )
-        {
-            for ( Object object : deps )
-            {
-                if ( object instanceof AttributeType )
-                {
-                    checkAttributeType( ( AttributeType ) object );
-                }
-                else if ( object instanceof ObjectClass )
-                {
-                    checkObjectClass( ( ObjectClass ) object );
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Gets the dependencies for the given schema object
-     * and deletes them from the tables.
-     *
-     * @param sc
-     *      the schema object
-     * @return
-     *      the dependencies for the given schema object
-     * and deletes them from the tables.
-     */
-    @SuppressWarnings("unchecked")
-    private List<Object> getAndDeleteDependencies( SchemaObject sc )
-    {
-        List<Object> deps = new ArrayList<Object>();
-
-        // Checking OID
-        String oid = sc.getOid();
-        if ( ( oid != null ) && ( !"".equals( oid ) ) )
-        {
-            List<Object> oidDependencies = ( List<Object> ) dependenciesMap.get( oid );
-            if ( oidDependencies != null )
-            {
-                deps.addAll( oidDependencies );
-                dependenciesMap.remove( oid );
-                for ( Object oidDependency : oidDependencies )
-                {
-                    dependsOnMap.remove( oidDependency, oid );
-                }
-            }
-        }
-
-        // Checking aliases
-        List<String> aliases = sc.getNames();
-        if ( ( aliases != null ) && ( aliases.size() > 0 ) )
-        {
-            for ( String alias : aliases )
-            {
-                List<Object> aliasDependencies = ( List<Object> ) dependenciesMap.get( alias );
-                if ( aliasDependencies != null )
-                {
-                    deps.addAll( aliasDependencies );
-                    dependenciesMap.remove( alias );
-                    for ( Object aliasDependency : aliasDependencies )
-                    {
-                        dependsOnMap.remove( aliasDependency, alias );
-                    }
-                }
-            }
-        }
-
-        return deps;
-    }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoader.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoader.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemamanager/SchemaEditorSchemaLoader.java Tue Feb  1 16:57:59 2011
@@ -43,6 +43,7 @@ import org.apache.directory.studio.schem
  */
 public class SchemaEditorSchemaLoader extends AbstractSchemaLoader
 {
+    /** The currently open project */
     private Project project;
 
 
@@ -62,13 +63,15 @@ public class SchemaEditorSchemaLoader ex
      */
     private void initializeSchemas()
     {
-        project = Activator.getDefault().getProjectsHandler().getProjects().get( 0 );
-
-        List<org.apache.directory.studio.schemaeditor.model.Schema> schemaObjects = project.getSchemaHandler()
-            .getSchemas();
-        for ( org.apache.directory.studio.schemaeditor.model.Schema schemaObject : schemaObjects )
+        project = Activator.getDefault().getProjectsHandler().getOpenProject();
+        if ( project != null )
         {
-            schemaMap.put( schemaObject.getSchemaName(), schemaObject );
+            List<org.apache.directory.studio.schemaeditor.model.Schema> schemaObjects = project.getSchemaHandler()
+                .getSchemas();
+            for ( org.apache.directory.studio.schemaeditor.model.Schema schemaObject : schemaObjects )
+            {
+                schemaMap.put( schemaObject.getSchemaName(), schemaObject );
+            }
         }
     }
 
@@ -78,9 +81,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> comparatorList = new ArrayList<Entry>();
-
-        return comparatorList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -89,9 +90,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> syntaxCheckerList = new ArrayList<Entry>();
-
-        return syntaxCheckerList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -100,9 +99,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> normalizerList = new ArrayList<Entry>();
-
-        return normalizerList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -113,13 +110,16 @@ public class SchemaEditorSchemaLoader ex
     {
         List<Entry> matchingRuleList = new ArrayList<Entry>();
 
-        for ( Schema schema : schemas )
+        if ( project != null )
         {
-            List<MatchingRule> matchingRules = project.getSchemaHandler().getSchema( schema.getSchemaName() )
-                .getMatchingRules();
-            for ( MatchingRule matchingRule : matchingRules )
+            for ( Schema schema : schemas )
             {
-                matchingRuleList.add( SchemaEditorSchemaLoaderUtils.toEntry( matchingRule ) );
+                List<MatchingRule> matchingRules = project.getSchemaHandler().getSchema( schema.getSchemaName() )
+                    .getMatchingRules();
+                for ( MatchingRule matchingRule : matchingRules )
+                {
+                    matchingRuleList.add( SchemaEditorSchemaLoaderUtils.toEntry( matchingRule ) );
+                }
             }
         }
 
@@ -134,12 +134,16 @@ public class SchemaEditorSchemaLoader ex
     {
         List<Entry> syntaxList = new ArrayList<Entry>();
 
-        for ( Schema schema : schemas )
+        if ( project != null )
         {
-            List<LdapSyntax> syntaxes = project.getSchemaHandler().getSchema( schema.getSchemaName() ).getSyntaxes();
-            for ( LdapSyntax syntax : syntaxes )
+            for ( Schema schema : schemas )
             {
-                syntaxList.add( SchemaEditorSchemaLoaderUtils.toEntry( syntax ) );
+                List<LdapSyntax> syntaxes = project.getSchemaHandler().getSchema( schema.getSchemaName() )
+                    .getSyntaxes();
+                for ( LdapSyntax syntax : syntaxes )
+                {
+                    syntaxList.add( SchemaEditorSchemaLoaderUtils.toEntry( syntax ) );
+                }
             }
         }
 
@@ -154,13 +158,16 @@ public class SchemaEditorSchemaLoader ex
     {
         List<Entry> attributeTypeList = new ArrayList<Entry>();
 
-        for ( Schema schema : schemas )
+        if ( project != null )
         {
-            List<AttributeType> attributeTypes = project.getSchemaHandler().getSchema( schema.getSchemaName() )
-                .getAttributeTypes();
-            for ( AttributeType attributeType : attributeTypes )
+            for ( Schema schema : schemas )
             {
-                attributeTypeList.add( SchemaEditorSchemaLoaderUtils.toEntry( attributeType ) );
+                List<AttributeType> attributeTypes = project.getSchemaHandler().getSchema( schema.getSchemaName() )
+                    .getAttributeTypes();
+                for ( AttributeType attributeType : attributeTypes )
+                {
+                    attributeTypeList.add( SchemaEditorSchemaLoaderUtils.toEntry( attributeType ) );
+                }
             }
         }
 
@@ -173,9 +180,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> matchingRuleUseList = new ArrayList<Entry>();
-
-        return matchingRuleUseList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -184,9 +189,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> nameFormList = new ArrayList<Entry>();
-
-        return nameFormList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -195,9 +198,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditContentRuleList = new ArrayList<Entry>();
-
-        return ditContentRuleList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -206,9 +207,7 @@ public class SchemaEditorSchemaLoader ex
      */
     public List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditStructureRuleList = new ArrayList<Entry>();
-
-        return ditStructureRuleList;
+        return new ArrayList<Entry>();
     }
 
 
@@ -219,13 +218,16 @@ public class SchemaEditorSchemaLoader ex
     {
         List<Entry> objectClassList = new ArrayList<Entry>();
 
-        for ( Schema schema : schemas )
+        if ( project != null )
         {
-            List<ObjectClass> objectClasses = project.getSchemaHandler().getSchema( schema.getSchemaName() )
-                .getObjectClasses();
-            for ( ObjectClass objectClass : objectClasses )
+            for ( Schema schema : schemas )
             {
-                objectClassList.add( SchemaEditorSchemaLoaderUtils.toEntry( objectClass ) );
+                List<ObjectClass> objectClasses = project.getSchemaHandler().getSchema( schema.getSchemaName() )
+                    .getObjectClasses();
+                for ( ObjectClass objectClass : objectClasses )
+                {
+                    objectClassList.add( SchemaEditorSchemaLoaderUtils.toEntry( objectClass ) );
+                }
             }
         }
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewContentProvider.java Tue Feb  1 16:57:59 2011
@@ -23,10 +23,9 @@ package org.apache.directory.studio.sche
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.ldap.model.exception.LdapSchemaException;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaWarning;
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder.FolderType;
 import org.apache.directory.studio.schemaeditor.view.wrappers.ProblemsViewRoot;
@@ -98,27 +97,31 @@ public class ProblemsViewContentProvider
 
                 if ( schemaChecker != null )
                 {
-                    SchemaError[] errors = schemaChecker.getErrors().toArray( new SchemaError[0] );
-                    if ( !( errors.length == 0 ) )
+                    List<Throwable> errors = schemaChecker.getErrors();
+                    if ( !( errors.size() == 0 ) )
                     {
                         Folder errorsFolder = new Folder( FolderType.ERROR, root );
                         root.addChild( errorsFolder );
-                        for ( SchemaError error : errors )
+                        for ( Throwable error : errors )
                         {
-                            errorsFolder.addChild( new SchemaErrorWrapper( error, errorsFolder ) );
+                            if ( error instanceof LdapSchemaException )
+                            {
+                                errorsFolder.addChild( new SchemaErrorWrapper( ( LdapSchemaException ) error,
+                                    errorsFolder ) );
+                            }
                         }
                     }
 
-                    SchemaWarning[] warnings = schemaChecker.getWarnings().toArray( new SchemaWarning[0] );
-                    if ( !( warnings.length == 0 ) )
-                    {
-                        Folder warningsFolder = new Folder( FolderType.WARNING, root );
-                        root.addChild( warningsFolder );
-                        for ( SchemaWarning warning : warnings )
-                        {
-                            warningsFolder.addChild( new SchemaWarningWrapper( warning, warningsFolder ) );
-                        }
-                    }
+//                    SchemaWarning[] warnings = schemaChecker.getWarnings().toArray( new SchemaWarning[0] );
+//                    if ( !( warnings.length == 0 ) )
+//                    {
+//                        Folder warningsFolder = new Folder( FolderType.WARNING, root );
+//                        root.addChild( warningsFolder );
+//                        for ( SchemaWarning warning : warnings )
+//                        {
+//                            warningsFolder.addChild( new SchemaWarningWrapper( warning, warningsFolder ) );
+//                        }
+//                    }
                 }
             }
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/ProblemsViewLabelProvider.java Tue Feb  1 16:57:59 2011
@@ -20,31 +20,15 @@
 package org.apache.directory.studio.schemaeditor.view.views;
 
 
-import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.ObjectClass;
-import org.apache.directory.shared.ldap.model.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.model.exception.LdapSchemaException;
 import org.apache.directory.shared.ldap.model.schema.SchemaObject;
 import org.apache.directory.studio.schemaeditor.Activator;
 import org.apache.directory.studio.schemaeditor.PluginConstants;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.ClassTypeHierarchyError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.DifferentCollectiveAsSuperiorError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.DifferentUsageAsSuperiorError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.DuplicateAliasError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.DuplicateOidError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NoAliasWarning;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingATSuperiorError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMandatoryATError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingMatchingRuleError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingOCSuperiorError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingOptionalATError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.NonExistingSyntaxError;
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaCheckerElement;
 import org.apache.directory.studio.schemaeditor.view.wrappers.Folder;
 import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaErrorWrapper;
 import org.apache.directory.studio.schemaeditor.view.wrappers.SchemaWarningWrapper;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.graphics.Image;
 
 
@@ -92,11 +76,11 @@ public class ProblemsViewLabelProvider e
 
             if ( columnIndex == 0 )
             {
-                return getMessage( errorWrapper.getSchemaError() );
+                return getMessage( errorWrapper.getLdapSchemaException() );
             }
             else if ( columnIndex == 1 )
             {
-                return getDisplayName( errorWrapper.getSchemaError().getSource() );
+                return getDisplayName( errorWrapper.getLdapSchemaException().getSource() );
             }
         }
         else if ( element instanceof SchemaWarningWrapper )
@@ -105,20 +89,22 @@ public class ProblemsViewLabelProvider e
 
             if ( columnIndex == 0 )
             {
-                return getMessage( warningWrapper.getSchemaWarning() );
+                return ""; // TODO getMessage( warningWrapper.getSchemaWarning() );
             }
             else if ( columnIndex == 1 )
             {
-                String name = warningWrapper.getSchemaWarning().getSource().getName();
-
-                if ( ( name != null ) && ( !name.equals( "" ) ) ) //$NON-NLS-1$
-                {
-                    return name;
-                }
-                else
-                {
-                    return warningWrapper.getSchemaWarning().getSource().getOid();
-                }
+                return "";
+                // TODO
+                //                String name = warningWrapper.getSchemaWarning().getSource().getName();
+                //
+                //                if ( ( name != null ) && ( !name.equals( "" ) ) ) //$NON-NLS-1$
+                //                {
+                //                    return name;
+                //                }
+                //                else
+                //                {
+                //                    return warningWrapper.getSchemaWarning().getSource().getOid();
+                //                }
             }
         }
         else if ( element instanceof Folder )
@@ -139,161 +125,166 @@ public class ProblemsViewLabelProvider e
     }
 
 
-    private String getMessage( SchemaCheckerElement element )
-    {
-        if ( element instanceof DuplicateAliasError )
-        {
-            DuplicateAliasError duplicateAliasError = ( DuplicateAliasError ) element;
-
-            SchemaObject duplicate = duplicateAliasError.getDuplicate();
-            if ( duplicate instanceof AttributeType )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorAttributeType" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
-            }
-            else if ( duplicate instanceof ObjectClass )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorObjectClass" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
-            }
-        }
-        else if ( element instanceof DuplicateOidError )
-        {
-            DuplicateOidError duplicateOidError = ( DuplicateOidError ) element;
-            SchemaObject duplicate = duplicateOidError.getDuplicate();
-            if ( duplicate instanceof AttributeType )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorAttributeType" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
-            }
-            else if ( duplicate instanceof ObjectClass )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorObjectClass" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
-            }
-        }
-        else if ( element instanceof NonExistingATSuperiorError )
-        {
-            NonExistingATSuperiorError nonExistingATSuperiorError = ( NonExistingATSuperiorError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorAttribute" ), new String[] { nonExistingATSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NonExistingOCSuperiorError )
-        {
-            NonExistingOCSuperiorError nonExistingOCSuperiorError = ( NonExistingOCSuperiorError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorObject" ), new String[] { nonExistingOCSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NonExistingMandatoryATError )
-        {
-            NonExistingMandatoryATError nonExistingMandatoryATError = ( NonExistingMandatoryATError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingMandatoryAttribute" ), new String[] { nonExistingMandatoryATError.getAlias() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NonExistingOptionalATError )
-        {
-            NonExistingOptionalATError nonExistingOptionalATError = ( NonExistingOptionalATError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingOptionalAttribute" ), new String[] { nonExistingOptionalATError.getAlias() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NonExistingSyntaxError )
-        {
-            NonExistingSyntaxError nonExistingSyntaxError = ( NonExistingSyntaxError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSyntax" ), new String[] { nonExistingSyntaxError.getSyntaxOid() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NonExistingMatchingRuleError )
-        {
-            NonExistingMatchingRuleError nonExistingMatchingRuleError = ( NonExistingMatchingRuleError ) element;
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.NonExistingMatchingRule" ), new String[] { nonExistingMatchingRuleError.getMatchingRuleAlias() } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof NoAliasWarning )
-        {
-            NoAliasWarning noAliasWarning = ( NoAliasWarning ) element;
-            SchemaObject source = noAliasWarning.getSource();
-            if ( source instanceof AttributeType )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningAttributeType" ), new String[] { source.getOid() } ); //$NON-NLS-1$
-            }
-            else if ( source instanceof ObjectClass )
-            {
-                return NLS
-                    .bind(
-                        Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningObjectClass" ), new String[] { source.getOid() } ); //$NON-NLS-1$
-            }
-        }
-        else if ( element instanceof ClassTypeHierarchyError )
-        {
-            ClassTypeHierarchyError classTypeHierarchyError = ( ClassTypeHierarchyError ) element;
-            ObjectClass source = ( ObjectClass ) classTypeHierarchyError.getSource();
-            ObjectClass superior = ( ObjectClass ) classTypeHierarchyError.getSuperior();
-            if ( source.getType().equals( ObjectClassTypeEnum.ABSTRACT ) )
-            {
-                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
-                {
-                    return NLS
-                        .bind(
-                            Messages
-                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractStructuralObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
-                }
-                else if ( superior.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
-                {
-                    return NLS
-                        .bind(
-                            Messages
-                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractAuxiliaryObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
-                }
-            }
-            else if ( source.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
-            {
-                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
-                {
-                    return NLS
-                        .bind(
-                            Messages
-                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAuxiliaryStructuralObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
-                }
-                else
-                {
-                    return NLS
-                        .bind(
-                            Messages.getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAuxiliary" ), new String[] { getDisplayName( source ) } ); //$NON-NLS-1$
-                }
-            }
-        }
-        else if ( element instanceof DifferentUsageAsSuperiorError )
-        {
-            DifferentUsageAsSuperiorError differentUsageAsSuperiorError = ( DifferentUsageAsSuperiorError ) element;
-            AttributeType source = ( AttributeType ) differentUsageAsSuperiorError.getSource();
-            AttributeType superior = ( AttributeType ) differentUsageAsSuperiorError.getSuperior();
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.AttributeTypeUsage" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
-        }
-        else if ( element instanceof DifferentCollectiveAsSuperiorError )
-        {
-            DifferentCollectiveAsSuperiorError differentCollectiveAsSuperiorError = ( DifferentCollectiveAsSuperiorError ) element;
-            AttributeType source = ( AttributeType ) differentCollectiveAsSuperiorError.getSource();
-            AttributeType superior = ( AttributeType ) differentCollectiveAsSuperiorError.getSuperior();
-            return NLS
-                .bind(
-                    Messages.getString( "ProblemsViewLabelProvider.AttributeTypeCollective" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
-        }
+    //    private String getMessage( SchemaCheckerElement element )
+    //    {
+    //        if ( element instanceof DuplicateAliasError )
+    //        {
+    //            DuplicateAliasError duplicateAliasError = ( DuplicateAliasError ) element;
+    //
+    //            SchemaObject duplicate = duplicateAliasError.getDuplicate();
+    //            if ( duplicate instanceof AttributeType )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorAttributeType" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
+    //            }
+    //            else if ( duplicate instanceof ObjectClass )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorObjectClass" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
+    //            }
+    //        }
+    //        else if ( element instanceof DuplicateOidError )
+    //        {
+    //            DuplicateOidError duplicateOidError = ( DuplicateOidError ) element;
+    //            SchemaObject duplicate = duplicateOidError.getDuplicate();
+    //            if ( duplicate instanceof AttributeType )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorAttributeType" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
+    //            }
+    //            else if ( duplicate instanceof ObjectClass )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorObjectClass" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
+    //            }
+    //        }
+    //        else if ( element instanceof NonExistingATSuperiorError )
+    //        {
+    //            NonExistingATSuperiorError nonExistingATSuperiorError = ( NonExistingATSuperiorError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorAttribute" ), new String[] { nonExistingATSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NonExistingOCSuperiorError )
+    //        {
+    //            NonExistingOCSuperiorError nonExistingOCSuperiorError = ( NonExistingOCSuperiorError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorObject" ), new String[] { nonExistingOCSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NonExistingMandatoryATError )
+    //        {
+    //            NonExistingMandatoryATError nonExistingMandatoryATError = ( NonExistingMandatoryATError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingMandatoryAttribute" ), new String[] { nonExistingMandatoryATError.getAlias() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NonExistingOptionalATError )
+    //        {
+    //            NonExistingOptionalATError nonExistingOptionalATError = ( NonExistingOptionalATError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingOptionalAttribute" ), new String[] { nonExistingOptionalATError.getAlias() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NonExistingSyntaxError )
+    //        {
+    //            NonExistingSyntaxError nonExistingSyntaxError = ( NonExistingSyntaxError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingSyntax" ), new String[] { nonExistingSyntaxError.getSyntaxOid() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NonExistingMatchingRuleError )
+    //        {
+    //            NonExistingMatchingRuleError nonExistingMatchingRuleError = ( NonExistingMatchingRuleError ) element;
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.NonExistingMatchingRule" ), new String[] { nonExistingMatchingRuleError.getMatchingRuleAlias() } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof NoAliasWarning )
+    //        {
+    //            NoAliasWarning noAliasWarning = ( NoAliasWarning ) element;
+    //            SchemaObject source = noAliasWarning.getSource();
+    //            if ( source instanceof AttributeType )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningAttributeType" ), new String[] { source.getOid() } ); //$NON-NLS-1$
+    //            }
+    //            else if ( source instanceof ObjectClass )
+    //            {
+    //                return NLS
+    //                    .bind(
+    //                        Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningObjectClass" ), new String[] { source.getOid() } ); //$NON-NLS-1$
+    //            }
+    //        }
+    //        else if ( element instanceof ClassTypeHierarchyError )
+    //        {
+    //            ClassTypeHierarchyError classTypeHierarchyError = ( ClassTypeHierarchyError ) element;
+    //            ObjectClass source = ( ObjectClass ) classTypeHierarchyError.getSource();
+    //            ObjectClass superior = ( ObjectClass ) classTypeHierarchyError.getSuperior();
+    //            if ( source.getType().equals( ObjectClassTypeEnum.ABSTRACT ) )
+    //            {
+    //                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
+    //                {
+    //                    return NLS
+    //                        .bind(
+    //                            Messages
+    //                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractStructuralObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
+    //                }
+    //                else if ( superior.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
+    //                {
+    //                    return NLS
+    //                        .bind(
+    //                            Messages
+    //                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractAuxiliaryObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
+    //                }
+    //            }
+    //            else if ( source.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
+    //            {
+    //                if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
+    //                {
+    //                    return NLS
+    //                        .bind(
+    //                            Messages
+    //                                .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAuxiliaryStructuralObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
+    //                }
+    //                else
+    //                {
+    //                    return NLS
+    //                        .bind(
+    //                            Messages.getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAuxiliary" ), new String[] { getDisplayName( source ) } ); //$NON-NLS-1$
+    //                }
+    //            }
+    //        }
+    //        else if ( element instanceof DifferentUsageAsSuperiorError )
+    //        {
+    //            DifferentUsageAsSuperiorError differentUsageAsSuperiorError = ( DifferentUsageAsSuperiorError ) element;
+    //            AttributeType source = ( AttributeType ) differentUsageAsSuperiorError.getSource();
+    //            AttributeType superior = ( AttributeType ) differentUsageAsSuperiorError.getSuperior();
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.AttributeTypeUsage" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
+    //        }
+    //        else if ( element instanceof DifferentCollectiveAsSuperiorError )
+    //        {
+    //            DifferentCollectiveAsSuperiorError differentCollectiveAsSuperiorError = ( DifferentCollectiveAsSuperiorError ) element;
+    //            AttributeType source = ( AttributeType ) differentCollectiveAsSuperiorError.getSource();
+    //            AttributeType superior = ( AttributeType ) differentCollectiveAsSuperiorError.getSuperior();
+    //            return NLS
+    //                .bind(
+    //                    Messages.getString( "ProblemsViewLabelProvider.AttributeTypeCollective" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
+    //        }
+    //
+    //        return ""; //$NON-NLS-1$
+    //    }
 
-        return ""; //$NON-NLS-1$
+    private String getMessage( LdapSchemaException ldapSchemaException )
+    {
+        return ldapSchemaException.getCode().toString();
     }
 
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaErrorWrapper.java Tue Feb  1 16:57:59 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.studio.schemaeditor.view.wrappers;
 
 
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError;
+import org.apache.directory.shared.ldap.model.exception.LdapSchemaException;
 
 
 /**
@@ -30,8 +30,8 @@ import org.apache.directory.studio.schem
  */
 public class SchemaErrorWrapper extends AbstractTreeNode
 {
-    /** The wrapped SchemaError */
-    private SchemaError schemaError;
+    /** The wrapper {@link LdapSchemaException} */
+    private LdapSchemaException ldapSchemaException;
 
 
     /**
@@ -40,10 +40,10 @@ public class SchemaErrorWrapper extends 
      * @param error
      *      the wrapped SchemaError
      */
-    public SchemaErrorWrapper( SchemaError error )
+    public SchemaErrorWrapper( LdapSchemaException ldapSchemaException )
     {
         super( null );
-        schemaError = error;
+        this.ldapSchemaException = ldapSchemaException;
     }
 
 
@@ -55,22 +55,22 @@ public class SchemaErrorWrapper extends 
      * @param parent
      *      the parent TreeNode
      */
-    public SchemaErrorWrapper( SchemaError error, TreeNode parent )
+    public SchemaErrorWrapper( LdapSchemaException ldapSchemaException, TreeNode parent )
     {
         super( parent );
-        schemaError = error;
+        this.ldapSchemaException = ldapSchemaException;
     }
 
 
     /**
-     * Gets the wrapped SchemaError.
+     * Gets the wrapped {@link LdapSchemaException}.
      *
      * @return
      *      the wrapped SchemaError
      */
-    public SchemaError getSchemaError()
+    public LdapSchemaException getLdapSchemaException()
     {
-        return schemaError;
+        return ldapSchemaException;
     }
 
 
@@ -94,7 +94,7 @@ public class SchemaErrorWrapper extends 
             {
                 SchemaErrorWrapper sww = ( SchemaErrorWrapper ) obj;
 
-                if ( ( schemaError != null ) && ( !schemaError.equals( sww.getSchemaError() ) ) )
+                if ( ( ldapSchemaException != null ) && ( !ldapSchemaException.equals( sww.getLdapSchemaException() ) ) )
                 {
                     return false;
                 }
@@ -115,9 +115,9 @@ public class SchemaErrorWrapper extends 
     {
         int result = super.hashCode();
 
-        if ( schemaError != null )
+        if ( ldapSchemaException != null )
         {
-            result = 37 * result + schemaError.hashCode();
+            result = 37 * result + ldapSchemaException.hashCode();
         }
 
         return result;

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java?rev=1066096&r1=1066095&r2=1066096&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWarningWrapper.java Tue Feb  1 16:57:59 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.studio.schemaeditor.view.wrappers;
 
 
-import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaWarning;
 
 
 /**
@@ -31,7 +30,7 @@ import org.apache.directory.studio.schem
 public class SchemaWarningWrapper extends AbstractTreeNode
 {
     /** The wrapped SchemaError */
-    private SchemaWarning schemaWarning;
+    private Object schemaWarning;
 
 
     /**
@@ -40,7 +39,7 @@ public class SchemaWarningWrapper extend
      * @param warning
      *      the wrapped SchemaWarning
      */
-    public SchemaWarningWrapper( SchemaWarning warning )
+    public SchemaWarningWrapper( Object warning )
     {
         super( null );
         schemaWarning = warning;
@@ -55,7 +54,7 @@ public class SchemaWarningWrapper extend
      * @param parent
      *      the parent TreeNode
      */
-    public SchemaWarningWrapper( SchemaWarning warning, TreeNode parent )
+    public SchemaWarningWrapper( Object warning, TreeNode parent )
     {
         super( parent );
         schemaWarning = warning;
@@ -68,7 +67,7 @@ public class SchemaWarningWrapper extend
      * @return
      *      the wrapped SchemaWarning
      */
-    public SchemaWarning getSchemaWarning()
+    public Object getSchemaWarning()
     {
         return schemaWarning;
     }



Mime
View raw message