directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r569419 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: model/schemachecker/ view/views/
Date Fri, 24 Aug 2007 15:27:19 GMT
Author: pamarcelot
Date: Fri Aug 24 08:27:18 2007
New Revision: 569419

URL: http://svn.apache.org/viewvc?rev=569419&view=rev
Log:
Improved SchemaChecker by adding a verification on the usage and collective values of the
superior of an attribute type.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java?rev=569419&view=auto
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
Fri Aug 24 08:27:18 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the DifferentCollectiveAsSuperiorError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferentCollectiveAsSuperiorError implements SchemaError
+{
+    /** The source object */
+    private SchemaObject source;
+
+    /** The superior */
+    private SchemaObject superior;
+
+
+    /**
+     * Creates a new instance of ClassTypeHierarchyError.
+     *
+     * @param source
+     *      the source object
+     * @param superior
+     *      the superior object
+     */
+    public DifferentCollectiveAsSuperiorError( SchemaObject source, SchemaObject duplicate
)
+    {
+        this.source = source;
+        this.superior = duplicate;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
+     */
+    public SchemaObject getSource()
+    {
+        return source;
+    }
+
+
+    /**
+     * Gets the superior object.
+     *
+     * @return
+     *      the superior object
+     */
+    public SchemaObject getSuperior()
+    {
+        return superior;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "[DifferentCollectiveAsSuperiorError - Source: " + getSource() + " - Superior:
" + getSuperior() + "]";
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java?rev=569419&view=auto
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
Fri Aug 24 08:27:18 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the DifferentUsageAsSuperiorError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferentUsageAsSuperiorError implements SchemaError
+{
+    /** The source object */
+    private SchemaObject source;
+
+    /** The superior */
+    private SchemaObject superior;
+
+
+    /**
+     * Creates a new instance of ClassTypeHierarchyError.
+     *
+     * @param source
+     *      the source object
+     * @param superior
+     *      the superior object
+     */
+    public DifferentUsageAsSuperiorError( SchemaObject source, SchemaObject duplicate )
+    {
+        this.source = source;
+        this.superior = duplicate;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.SchemaError#getSource()
+     */
+    public SchemaObject getSource()
+    {
+        return source;
+    }
+
+
+    /**
+     * Gets the superior object.
+     *
+     * @return
+     *      the superior object
+     */
+    public SchemaObject getSuperior()
+    {
+        return superior;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "[DifferentUsageAsSuperiorError - Source: " + getSource() + " - Superior:
" + getSuperior() + "]";
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java?rev=569419&r1=569418&r2=569419&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
Fri Aug 24 08:27:18 2007
@@ -27,6 +27,7 @@
 import org.apache.commons.collections.map.MultiValueMap;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandlerAdapter;
@@ -373,6 +374,26 @@
             {
                 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 );
+                }
             }
         }
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java?rev=569419&r1=569418&r2=569419&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ProblemsViewLabelProvider.java
Fri Aug 24 08:27:18 2007
@@ -27,6 +27,8 @@
 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.schemachecker.ClassTypeHierarchyError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.DifferentCollectiveAsSuperiorError;
+import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.DifferentUsageAsSuperiorError;
 import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.DuplicateAliasError;
 import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.DuplicateOidError;
 import org.apache.directory.studio.apacheds.schemaeditor.model.schemachecker.NoAliasWarning;
@@ -259,7 +261,24 @@
                     message.append( "Structural object class :'" + getDisplayName( superior
) + "'." );
                 }
             }
+        }
+        else if ( element instanceof DifferentUsageAsSuperiorError )
+        {
+            DifferentUsageAsSuperiorError differentUsageAsSuperiorError = ( DifferentUsageAsSuperiorError
) element;
+            AttributeTypeImpl source = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSource();
+            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentUsageAsSuperiorError.getSuperior();
+
+            message.append( "Attribute type '" + getDisplayName( source )
+                + "' has a different usage value than its superior '" + getDisplayName( superior
) + "'." );
+        }
+        else if ( element instanceof DifferentCollectiveAsSuperiorError )
+        {
+            DifferentCollectiveAsSuperiorError differentCollectiveAsSuperiorError = ( DifferentCollectiveAsSuperiorError
) element;
+            AttributeTypeImpl source = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSource();
+            AttributeTypeImpl superior = ( AttributeTypeImpl ) differentCollectiveAsSuperiorError.getSuperior();
 
+            message.append( "Attribute type '" + getDisplayName( source ) + "' must be collective
as its superior '"
+                + getDisplayName( superior ) + "'." );
         }
 
         return message.toString();



Mime
View raw message