You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC
svn commit: r592094 [11/35] - in
/directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/directory/
src/main/java/org/apache/directory/studio/ src/m...
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,842 @@
+/*
+ * 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.schemaeditor.model.io;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.model.SchemaImpl;
+import org.apache.directory.studio.schemaeditor.model.SyntaxImpl;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+
+/**
+ * This class is used to import a Schema file from the XML Format.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class XMLSchemaFileImporter
+{
+ // The Tags
+ private static final String ALIAS_TAG = "alias";
+ private static final String ALIASES_TAG = "aliases";
+ private static final String ATTRIBUTE_TYPE_TAG = "attributetype";
+ private static final String ATTRIBUTE_TYPES_TAG = "attributetypes";
+ private static final String BOOLEAN_FALSE = "false";
+ private static final String BOOLEAN_TRUE = "true";
+ private static final String COLLECTIVE_TAG = "collective";
+ private static final String DESCRIPTION_TAG = "description";
+ private static final String EQUALITY_TAG = "equality";
+ private static final String HUMAN_READABLE_TAG = "humanreadable";
+ private static final String MANDATORY_TAG = "mandatory";
+ private static final String MATCHING_RULE_TAG = "matchingrule";
+ private static final String MATCHING_RULES_TAG = "matchingrules";
+ private static final String NAME_TAG = "name";
+ private static final String NO_USER_MODIFICATION_TAG = "nousermodification";
+ private static final String OBJECT_CLASS_TAG = "objectclass";
+ private static final String OBJECT_CLASSES_TAG = "objectclasses";
+ private static final String OBSOLETE_TAG = "obsolete";
+ private static final String OID_TAG = "oid";
+ private static final String OPTIONAL_TAG = "optional";
+ private static final String ORDERING_TAG = "ordering";
+ private static final String SCHEMA_TAG = "schema";
+ private static final String SCHEMAS_TAG = "schemas";
+ private static final String SINGLE_VALUE_TAG = "singlevalue";
+ private static final String SUBSTRING_TAG = "substring";
+ private static final String SUPERIOR_TAG = "superior";
+ private static final String SUPERIORS_TAG = "superiors";
+ private static final String SYNTAX_LENGTH_TAG = "syntaxlength";
+ private static final String SYNTAX_OID_TAG = "syntaxoid";
+ private static final String SYNTAX_TAG = "syntax";
+ private static final String SYNTAXES_TAG = "syntaxes";
+ private static final String TYPE_TAG = "type";
+ private static final String USAGE_TAG = "usage";
+
+
+ /**
+ * Extracts the Schemas from the given path.
+ *
+ * @param path
+ * the path of the file.
+ * @return
+ * the corresponding schema
+ * @throws XMLSchemaFileImportException
+ * if an error occurs when importing the schema
+ */
+ public static Schema[] getSchemas( String path ) throws XMLSchemaFileImportException
+ {
+ SAXReader reader = new SAXReader();
+ Document document = null;
+ try
+ {
+ document = reader.read( path );
+ }
+ catch ( DocumentException e )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' can not be read correctly." );
+ }
+
+ Element rootElement = document.getRootElement();
+ if ( !rootElement.getName().equals( SCHEMAS_TAG ) )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' does not seem to be a valid Schema file." );
+ }
+
+ return readSchemas( rootElement, path );
+ }
+
+
+ /**
+ * Extracts the Schema from the given path.
+ *
+ * @param path
+ * the path of the file.
+ * @return
+ * the corresponding schema
+ * @throws XMLSchemaFileImportException
+ * if an error occurs when importing the schema
+ */
+ public static Schema getSchema( String path ) throws XMLSchemaFileImportException
+ {
+ SAXReader reader = new SAXReader();
+ Document document = null;
+ try
+ {
+ document = reader.read( path );
+ }
+ catch ( DocumentException e )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' can not be read correctly." );
+ }
+
+ Element rootElement = document.getRootElement();
+
+ return readSchema( rootElement, path );
+ }
+
+
+ /**
+ * Reads schemas.
+ *
+ * @param element
+ * the element
+ * @param path
+ * the path of the file
+ * @throws XMLSchemaFileImportException
+ * if an error occurs when importing the schema
+ * @return
+ * the corresponding schemas
+ */
+ public static Schema[] readSchemas( Element element, String path ) throws XMLSchemaFileImportException
+ {
+ List<Schema> schemas = new ArrayList<Schema>();
+
+ if ( !element.getName().equals( SCHEMAS_TAG ) )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' does not seem to be a valid Schema file." );
+ }
+
+ for ( Iterator<?> i = element.elementIterator( SCHEMA_TAG ); i.hasNext(); )
+ {
+ Element schemaElement = ( Element ) i.next();
+ schemas.add( readSchema( schemaElement, path ) );
+ }
+
+ return schemas.toArray( new Schema[0] );
+ }
+
+
+ /**
+ * Reads a schema.
+ *
+ * @param element
+ * the element
+ * @param path
+ * the path of the file
+ * @throws XMLSchemaFileImportException
+ * if an error occurs when importing the schema
+ * @return
+ * the corresponding schema
+ */
+ public static Schema readSchema( Element element, String path ) throws XMLSchemaFileImportException
+ {
+ // Creating the schema with an empty name
+ Schema schema = new SchemaImpl( null );
+
+ // Name
+ schema.setName( getSchemaName( element, path ) );
+
+ // Attribute Types
+ readAttributeTypes( element, schema );
+
+ // Object Classes
+ readObjectClasses( element, schema );
+
+ // Matching Rules
+ readMatchingRules( element, schema );
+
+ // Syntaxes
+ readSyntaxes( element, schema );
+
+ return schema;
+ }
+
+
+ /**
+ * Gets the name of the schema.
+ *
+ * @param element
+ * the element
+ * @param path
+ * the path
+ * @return
+ * the name of the schema
+ * @throws XMLSchemaFileImportException
+ * if an error occurs when reading the file
+ */
+ private static String getSchemaName( Element element, String path ) throws XMLSchemaFileImportException
+ {
+ if ( !element.getName().equals( SCHEMA_TAG ) )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' does not seem to be a valid Schema file." );
+ }
+
+ Attribute nameAttribute = element.attribute( NAME_TAG );
+ if ( ( nameAttribute != null ) && ( !nameAttribute.getValue().equals( "" ) ) )
+ {
+ return nameAttribute.getValue();
+ }
+ else
+ {
+ return getNameFromPath( path );
+ }
+ }
+
+
+ /**
+ * Gets the name of the file.
+ *
+ * @param path
+ * the path
+ * @return
+ * the name of the file.
+ */
+ private static final String getNameFromPath( String path )
+ {
+ File file = new File( path );
+ String fileName = file.getName();
+ if ( fileName.endsWith( ".xml" ) ) //$NON-NLS-1$
+ {
+ String[] fileNameSplitted = fileName.split( "\\." ); //$NON-NLS-1$
+ return fileNameSplitted[0];
+ }
+
+ return fileName;
+ }
+
+
+ /**
+ * Reads the attribute types.
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readAttributeTypes( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ for ( Iterator<?> i = element.elementIterator( ATTRIBUTE_TYPES_TAG ); i.hasNext(); )
+ {
+ Element attributesTypesElement = ( Element ) i.next();
+ for ( Iterator<?> i2 = attributesTypesElement.elementIterator( ATTRIBUTE_TYPE_TAG ); i2.hasNext(); )
+ {
+ readAttributeType( ( Element ) i2.next(), schema );
+ }
+ }
+ }
+
+
+ /**
+ * Reads an attribute type.
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ */
+ private static void readAttributeType( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ AttributeTypeImpl at = null;
+
+ // OID
+ Attribute oidAttribute = element.attribute( OID_TAG );
+ if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
+ {
+ at = new AttributeTypeImpl( oidAttribute.getValue() );
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException(
+ "An attribute type definition must contain an attribute for the OID." );
+ }
+
+ // Schema
+ at.setSchema( schema.getName() );
+
+ // Aliases
+ Element aliasesElement = element.element( ALIASES_TAG );
+ if ( aliasesElement != null )
+ {
+ List<String> aliases = new ArrayList<String>();
+ for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
+ {
+ Element aliasElement = ( Element ) i.next();
+ aliases.add( aliasElement.getText() );
+ }
+ if ( aliases.size() >= 1 )
+ {
+ at.setNames( aliases.toArray( new String[0] ) );
+ }
+ }
+
+ // Description
+ Element descriptionElement = element.element( DESCRIPTION_TAG );
+ if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
+ {
+ at.setDescription( descriptionElement.getText() );
+ }
+
+ // Superior
+ Element superiorElement = element.element( SUPERIOR_TAG );
+ if ( ( superiorElement != null ) && ( !superiorElement.getText().equals( "" ) ) )
+ {
+ at.setSuperiorName( superiorElement.getText() );
+ }
+
+ // Usage
+ Element usageElement = element.element( USAGE_TAG );
+ if ( ( usageElement != null ) && ( !usageElement.getText().equals( "" ) ) )
+ {
+ try
+ {
+ at.setUsage( UsageEnum.valueOf( usageElement.getText() ) );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ throw new XMLSchemaFileImportException(
+ "The parser was not able to convert the usage value of the attribute type." );
+ }
+ }
+
+ // Syntax
+ Element syntaxElement = element.element( SYNTAX_TAG );
+ if ( ( syntaxElement != null ) && ( !syntaxElement.getText().equals( "" ) ) )
+ {
+ at.setSyntaxOid( syntaxElement.getText() );
+ }
+
+ // Syntax Length
+ Element syntaxLengthElement = element.element( SYNTAX_LENGTH_TAG );
+ if ( ( syntaxLengthElement != null ) && ( !syntaxLengthElement.getText().equals( "" ) ) )
+ {
+ try
+ {
+ at.setLength( Integer.parseInt( syntaxLengthElement.getText() ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ throw new XMLSchemaFileImportException(
+ "The parser was not able to convert the syntax length value of the attribute type to an integer." );
+ }
+ }
+
+ // Obsolete
+ Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
+ if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
+ {
+ at.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
+ }
+
+ // Single Value
+ Attribute singleValueAttribute = element.attribute( SINGLE_VALUE_TAG );
+ if ( ( singleValueAttribute != null ) && ( !singleValueAttribute.getValue().equals( "" ) ) )
+ {
+ at.setSingleValue( readBoolean( singleValueAttribute.getValue() ) );
+ }
+
+ // Collective
+ Attribute collectiveAttribute = element.attribute( COLLECTIVE_TAG );
+ if ( ( collectiveAttribute != null ) && ( !collectiveAttribute.getValue().equals( "" ) ) )
+ {
+ at.setCollective( readBoolean( collectiveAttribute.getValue() ) );
+ }
+
+ // No User Modification
+ Attribute noUserModificationAttribute = element.attribute( NO_USER_MODIFICATION_TAG );
+ if ( ( noUserModificationAttribute != null ) && ( !noUserModificationAttribute.getValue().equals( "" ) ) )
+ {
+ at.setCanUserModify( !readBoolean( noUserModificationAttribute.getValue() ) );
+ }
+
+ // Equality
+ Element equalityElement = element.element( EQUALITY_TAG );
+ if ( ( equalityElement != null ) && ( !equalityElement.getText().equals( "" ) ) )
+ {
+ at.setEqualityName( equalityElement.getText() );
+ }
+
+ // Ordering
+ Element orderingElement = element.element( ORDERING_TAG );
+ if ( ( orderingElement != null ) && ( !orderingElement.getText().equals( "" ) ) )
+ {
+ at.setOrderingName( orderingElement.getText() );
+ }
+
+ // Substring
+ Element substringElement = element.element( SUBSTRING_TAG );
+ if ( ( substringElement != null ) && ( !substringElement.getText().equals( "" ) ) )
+ {
+ at.setSubstrName( substringElement.getText() );
+ }
+
+ // Adding the attribute type to the schema
+ schema.addAttributeType( at );
+ }
+
+
+ /**
+ * Reads the object classes
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readObjectClasses( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ for ( Iterator<?> i = element.elementIterator( OBJECT_CLASSES_TAG ); i.hasNext(); )
+ {
+ Element objectClassesElement = ( Element ) i.next();
+ for ( Iterator<?> i2 = objectClassesElement.elementIterator( OBJECT_CLASS_TAG ); i2.hasNext(); )
+ {
+ readObjectClass( ( Element ) i2.next(), schema );
+ }
+ }
+ }
+
+
+ /**
+ * Reads an object class
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readObjectClass( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ ObjectClassImpl oc = null;
+
+ // OID
+ Attribute oidAttribute = element.attribute( OID_TAG );
+ if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
+ {
+ oc = new ObjectClassImpl( oidAttribute.getValue() );
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException( "An object class definition must contain an attribute for the OID." );
+ }
+
+ // Schema
+ oc.setSchema( schema.getName() );
+
+ // Aliases
+ Element aliasesElement = element.element( ALIASES_TAG );
+ if ( aliasesElement != null )
+ {
+ List<String> aliases = new ArrayList<String>();
+ for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
+ {
+ Element aliasElement = ( Element ) i.next();
+ aliases.add( aliasElement.getText() );
+ }
+ if ( aliases.size() >= 1 )
+ {
+ oc.setNames( aliases.toArray( new String[0] ) );
+ }
+ }
+
+ // Description
+ Element descriptionElement = element.element( DESCRIPTION_TAG );
+ if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
+ {
+ oc.setDescription( descriptionElement.getText() );
+ }
+
+ // Superiors
+ Element superiorsElement = element.element( SUPERIORS_TAG );
+ if ( superiorsElement != null )
+ {
+ List<String> superiors = new ArrayList<String>();
+ for ( Iterator<?> i = superiorsElement.elementIterator( SUPERIOR_TAG ); i.hasNext(); )
+ {
+ Element superiorElement = ( Element ) i.next();
+ superiors.add( superiorElement.getText() );
+ }
+ if ( superiors.size() >= 1 )
+ {
+ oc.setSuperClassesNames( superiors.toArray( new String[0] ) );
+ }
+ }
+
+ // Class Type
+ Element classTypeElement = element.element( TYPE_TAG );
+ if ( ( classTypeElement != null ) && ( !classTypeElement.getText().equals( "" ) ) )
+ {
+ try
+ {
+ oc.setType( ObjectClassTypeEnum.valueOf( classTypeElement.getText() ) );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ throw new XMLSchemaFileImportException(
+ "The parser was not able to convert the usage value of the attribute type." );
+ }
+ }
+
+ // Obsolete
+ Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
+ if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
+ {
+ oc.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
+ }
+
+ // Mandatory Attribute Types
+ Element mandatoryElement = element.element( MANDATORY_TAG );
+ if ( mandatoryElement != null )
+ {
+ List<String> mandatoryATs = new ArrayList<String>();
+ for ( Iterator<?> i = mandatoryElement.elementIterator( ATTRIBUTE_TYPE_TAG ); i.hasNext(); )
+ {
+ Element attributeTypeElement = ( Element ) i.next();
+ mandatoryATs.add( attributeTypeElement.getText() );
+ }
+ if ( mandatoryATs.size() >= 1 )
+ {
+ oc.setMustNamesList( mandatoryATs.toArray( new String[0] ) );
+ }
+ }
+
+ // Optional Attribute Types
+ Element optionalElement = element.element( OPTIONAL_TAG );
+ if ( optionalElement != null )
+ {
+ List<String> optionalATs = new ArrayList<String>();
+ for ( Iterator<?> i = optionalElement.elementIterator( ATTRIBUTE_TYPE_TAG ); i.hasNext(); )
+ {
+ Element attributeTypeElement = ( Element ) i.next();
+ optionalATs.add( attributeTypeElement.getText() );
+ }
+ if ( optionalATs.size() >= 1 )
+ {
+ oc.setMayNamesList( optionalATs.toArray( new String[0] ) );
+ }
+ }
+
+ // Adding the object class to the schema
+ schema.addObjectClass( oc );
+ }
+
+
+ /**
+ * Reads the matching rules.
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readMatchingRules( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ for ( Iterator<?> i = element.elementIterator( MATCHING_RULES_TAG ); i.hasNext(); )
+ {
+ Element matchingRulesElement = ( Element ) i.next();
+ for ( Iterator<?> i2 = matchingRulesElement.elementIterator( MATCHING_RULE_TAG ); i2.hasNext(); )
+ {
+ readMatchingRule( ( Element ) i2.next(), schema );
+ }
+ }
+ }
+
+
+ /**
+ * Reads a matching rule.
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readMatchingRule( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ MatchingRuleImpl mr = null;
+
+ // OID
+ Attribute oidAttribute = element.attribute( OID_TAG );
+ if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
+ {
+ mr = new MatchingRuleImpl( oidAttribute.getValue() );
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException( "A matching rule definition must contain an attribute for the OID." );
+ }
+
+ // Schema
+ mr.setSchema( schema.getName() );
+
+ // Aliases
+ Element aliasesElement = element.element( ALIASES_TAG );
+ if ( aliasesElement != null )
+ {
+ List<String> aliases = new ArrayList<String>();
+ for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
+ {
+ Element aliasElement = ( Element ) i.next();
+ aliases.add( aliasElement.getText() );
+ }
+ if ( aliases.size() >= 1 )
+ {
+ mr.setNames( aliases.toArray( new String[0] ) );
+ }
+ }
+
+ // Description
+ Element descriptionElement = element.element( DESCRIPTION_TAG );
+ if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
+ {
+ mr.setDescription( descriptionElement.getText() );
+ }
+
+ // Obsolete
+ Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
+ if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
+ {
+ mr.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
+ }
+
+ // Syntax OID
+ Element syntaxOidElement = element.element( SYNTAX_OID_TAG );
+ if ( ( syntaxOidElement != null ) && ( !syntaxOidElement.getText().equals( "" ) ) )
+ {
+ mr.setSyntaxOid( syntaxOidElement.getText() );
+ }
+
+ // Adding the matching rule to the schema
+ schema.addMatchingRule( mr );
+ }
+
+
+ /**
+ * Reads the syntaxes
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readSyntaxes( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ for ( Iterator<?> i = element.elementIterator( SYNTAXES_TAG ); i.hasNext(); )
+ {
+ Element syntaxElement = ( Element ) i.next();
+ for ( Iterator<?> i2 = syntaxElement.elementIterator( SYNTAX_TAG ); i2.hasNext(); )
+ {
+ readSyntax( ( Element ) i2.next(), schema );
+ }
+ }
+ }
+
+
+ /**
+ * Reads a syntax.
+ *
+ * @param element
+ * the element
+ * @param schema
+ * the schema
+ * @throws XMLSchemaFileImportException
+ */
+ private static void readSyntax( Element element, Schema schema ) throws XMLSchemaFileImportException
+ {
+ SyntaxImpl syntax = null;
+
+ // OID
+ Attribute oidAttribute = element.attribute( OID_TAG );
+ if ( ( oidAttribute != null ) && ( !oidAttribute.getValue().equals( "" ) ) )
+ {
+ syntax = new SyntaxImpl( oidAttribute.getValue() );
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException( "A syntax definition must contain an attribute for the OID." );
+ }
+
+ // Schema
+ syntax.setSchema( schema.getName() );
+
+ // Aliases
+ Element aliasesElement = element.element( ALIASES_TAG );
+ if ( aliasesElement != null )
+ {
+ List<String> aliases = new ArrayList<String>();
+ for ( Iterator<?> i = aliasesElement.elementIterator( ALIAS_TAG ); i.hasNext(); )
+ {
+ Element aliasElement = ( Element ) i.next();
+ aliases.add( aliasElement.getText() );
+ }
+ if ( aliases.size() >= 1 )
+ {
+ syntax.setNames( aliases.toArray( new String[0] ) );
+ }
+ }
+
+ // Description
+ Element descriptionElement = element.element( DESCRIPTION_TAG );
+ if ( ( descriptionElement != null ) && ( !descriptionElement.getText().equals( "" ) ) )
+ {
+ syntax.setDescription( descriptionElement.getText() );
+ }
+
+ // Obsolete
+ Attribute obsoleteAttribute = element.attribute( OBSOLETE_TAG );
+ if ( ( obsoleteAttribute != null ) && ( !obsoleteAttribute.getValue().equals( "" ) ) )
+ {
+ syntax.setObsolete( readBoolean( obsoleteAttribute.getValue() ) );
+ }
+
+ // Human Readible
+ Attribute humanReadibleAttribute = element.attribute( HUMAN_READABLE_TAG );
+ if ( ( humanReadibleAttribute != null ) && ( !humanReadibleAttribute.getValue().equals( "" ) ) )
+ {
+ syntax.setHumanReadable( readBoolean( humanReadibleAttribute.getValue() ) );
+ }
+
+ // Adding the syntax to the schema
+ schema.addSyntax( syntax );
+ }
+
+
+ /**
+ * Reads a boolean value
+ *
+ * @param value
+ * the value
+ * @return
+ * the boolean value
+ * @throws XMLSchemaFileImportException
+ * if the boolean could not be read
+ */
+ private static boolean readBoolean( String value ) throws XMLSchemaFileImportException
+ {
+ if ( value.equals( BOOLEAN_TRUE ) )
+ {
+ return true;
+ }
+ else if ( value.equals( BOOLEAN_FALSE ) )
+ {
+ return false;
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException( "The parser was not able to convert a boolean value." );
+ }
+ }
+
+ /**
+ * This enum represents the different types of schema files.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum SchemaFileType
+ {
+ SINGLE, MULTIPLE
+ };
+
+
+ /**
+ * Gets the type of file.
+ *
+ * @param path
+ * the path of the file
+ * @return
+ * the type of the file
+ * @throws XMLSchemaFileImportException
+ */
+ public static SchemaFileType getSchemaFileType( String path ) throws XMLSchemaFileImportException
+ {
+ SAXReader reader = new SAXReader();
+ Document document = null;
+ try
+ {
+ document = reader.read( path );
+ }
+ catch ( DocumentException e )
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' can not be read correctly." );
+ }
+
+ Element rootElement = document.getRootElement();
+ if ( rootElement.getName().equals( SCHEMA_TAG ) )
+ {
+ return SchemaFileType.SINGLE;
+ }
+ else if ( rootElement.getName().equals( SCHEMAS_TAG ) )
+ {
+ return SchemaFileType.MULTIPLE;
+ }
+ else
+ {
+ throw new XMLSchemaFileImportException( "The file '" + path + "' does not seem to be a valid Schema file." );
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the ClassTypeHierarchyError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ClassTypeHierarchyError 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 ClassTypeHierarchyError( SchemaObject source, SchemaObject duplicate )
+ {
+ this.source = source;
+ this.superior = duplicate;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.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 "[ClassTypeHierarchyError - Source: " + getSource() + " - Superior: " + getSuperior() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/ClassTypeHierarchyError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java Mon Nov 5 09:14:24 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.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.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() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentCollectiveAsSuperiorError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java Mon Nov 5 09:14:24 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.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.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() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DifferentUsageAsSuperiorError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,103 @@
+/*
+ * 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the DuplicateAliasError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DuplicateAliasError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The duplicated alias */
+ private String alias;
+
+ /** The duplicate */
+ private SchemaObject duplicate;
+
+
+ /**
+ * Creates a new instance of DuplicateAliasError.
+ *
+ * @param source
+ * the source object
+ * @param alias
+ * the duplicated alias
+ * @param duplicate
+ * the duplicate object
+ */
+ public DuplicateAliasError( SchemaObject source, String alias, SchemaObject duplicate )
+ {
+ this.source = source;
+ this.alias = alias;
+ this.duplicate = duplicate;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the duplicated alias.
+ *
+ * @return
+ * the duplicated alias
+ */
+ public String getAlias()
+ {
+ return alias;
+ }
+
+
+ /**
+ * Gets the duplicate object.
+ *
+ * @return
+ * the duplicate object
+ */
+ public SchemaObject getDuplicate()
+ {
+ return duplicate;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[DuplicateAliasError - Source: " + getSource() + " - Alias: " + getAlias() + " - Duplicate: "
+ + getDuplicate() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateAliasError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,103 @@
+/*
+ * 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the DuplicateOidError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DuplicateOidError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The duplicated OID */
+ private String oid;
+
+ /** The duplicate */
+ private SchemaObject duplicate;
+
+
+ /**
+ * Creates a new instance of DuplicateAliasError.
+ *
+ * @param source
+ * the source object
+ * @param oid
+ * the duplicated alias
+ * @param duplicate
+ * the duplicate object
+ */
+ public DuplicateOidError( SchemaObject source, String oid, SchemaObject duplicate )
+ {
+ this.source = source;
+ this.oid = oid;
+ this.duplicate = duplicate;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the duplicated OID.
+ *
+ * @return
+ * the duplicated OID
+ */
+ public String getOid()
+ {
+ return oid;
+ }
+
+
+ /**
+ * Gets the duplicate object.
+ *
+ * @return
+ * the duplicate object
+ */
+ public SchemaObject getDuplicate()
+ {
+ return duplicate;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[DuplicateOidError - Source: " + getSource() + " - OID: " + getOid() + " - Duplicate: "
+ + getDuplicate() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/DuplicateOidError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NoAliasWarning.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NoAliasWarning implements SchemaWarning
+{
+ /** The source object */
+ private SchemaObject source;
+
+
+ /**
+ * Creates a new instance of NoAliasWarning.
+ *
+ * @param source
+ * the source object
+ */
+ public NoAliasWarning( SchemaObject source )
+ {
+ this.source = source;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaWarning#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NoAliasWarning.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingATSuperiorError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingATSuperiorError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The superior's alias */
+ private String supAlias;
+
+
+ /**
+ * Creates a new instance of NonExistingATSuperiorError.
+ *
+ * @param source
+ * the source object
+ * @param supAlias
+ * the superior's alias
+ */
+ public NonExistingATSuperiorError( SchemaObject source, String supAlias )
+ {
+ this.source = source;
+ this.supAlias = supAlias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the superior's alias.
+ *
+ * @return
+ * the superior's alias
+ */
+ public String getSuperiorAlias()
+ {
+ return supAlias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingATSuperiorError - Source: " + getSource() + " - supAlias: " + getSuperiorAlias() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingATSuperiorError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingMandatoryATError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingMandatoryATError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The mandatory attribute type's alias */
+ private String alias;
+
+
+ /**
+ * Creates a new instance of NonExistingMandatoryATError.
+ *
+ * @param source
+ * the source object
+ * @param alias
+ * the mandatory attribute type's alias
+ */
+ public NonExistingMandatoryATError( SchemaObject source, String alias )
+ {
+ this.source = source;
+ this.alias = alias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the mandatory attribute type's alias.
+ *
+ * @return
+ * the mandatory attribute type's alias
+ */
+ public String getAlias()
+ {
+ return alias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingMandatoryATError - Source: " + getSource() + " - alias: " + getAlias() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMandatoryATError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,112 @@
+/*
+ * 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingMatchingRuleError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingMatchingRuleError implements SchemaError
+{
+ /**
+ * This enum represents the different types of NonExistingMatchingRuleError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum NonExistingMatchingRuleErrorEnum
+ {
+ EQUALITY, ORDERING, SUBSTRING
+ }
+
+ /** The source object */
+ private SchemaObject source;
+
+ /** The matching rule's alias */
+ private String mrAlias;
+
+ /** The type */
+ private NonExistingMatchingRuleErrorEnum type;
+
+
+ /**
+ * Creates a new instance of NonExistingMatchingRuleError.
+ *
+ * @param source
+ * the source object
+ * @param mrAlias
+ * the matching rule alias
+ */
+ public NonExistingMatchingRuleError( SchemaObject source, String mrAlias, NonExistingMatchingRuleErrorEnum type )
+ {
+ this.source = source;
+ this.mrAlias = mrAlias;
+ this.type = type;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the matching rule alias.
+ *
+ * @return
+ * the matching rule alias
+ */
+ public String getMatchingRuleAlias()
+ {
+ return mrAlias;
+ }
+
+
+ /**
+ * Gets the type of NonExistingMatchingRuleError.
+ *
+ * @return
+ * the type of NonExistingMatchingRuleError
+ */
+ public NonExistingMatchingRuleErrorEnum getType()
+ {
+ return type;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingMatchingRuleError - Source: " + getSource() + " - mrAlias: " + getMatchingRuleAlias()
+ + " - Type: " + getType() + "]";
+ }
+}
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingMatchingRuleError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingOCSuperiorError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingOCSuperiorError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The superior's alias */
+ private String supAlias;
+
+
+ /**
+ * Creates a new instance of NonExistingATSuperiorError.
+ *
+ * @param source
+ * the source object
+ * @param supAlias
+ * the superior's alias
+ */
+ public NonExistingOCSuperiorError( SchemaObject source, String supAlias )
+ {
+ this.source = source;
+ this.supAlias = supAlias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the superior's alias.
+ *
+ * @return
+ * the superior's alias
+ */
+ public String getSuperiorAlias()
+ {
+ return supAlias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingOCSuperiorError - Source: " + getSource() + " - supAlias: " + getSuperiorAlias() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOCSuperiorError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingOptionalATError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingOptionalATError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The optional attribute type's alias */
+ private String alias;
+
+
+ /**
+ * Creates a new instance of NonExistingOptionalATError.
+ *
+ * @param source
+ * the source object
+ * @param alias
+ * the optional attribute type's alias
+ */
+ public NonExistingOptionalATError( SchemaObject source, String alias )
+ {
+ this.source = source;
+ this.alias = alias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the optional attribute type's alias.
+ *
+ * @return
+ * the optional attribute type's alias
+ */
+ public String getAlias()
+ {
+ return alias;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingOptionalATError - Source: " + getSource() + " - alias: " + getAlias() + "]";
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingOptionalATError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java Mon Nov 5 09:14:24 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.schemaeditor.model.schemachecker;
+
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+
+
+/**
+ * This class represents the NonExistingSyntaxError.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingSyntaxError implements SchemaError
+{
+ /** The source object */
+ private SchemaObject source;
+
+ /** The syntax's oid */
+ private String oid;
+
+
+ /**
+ * Creates a new instance of NonExistingSyntaxError.
+ *
+ * @param source
+ * the source object
+ * @param oid
+ * the matching rule alias
+ */
+ public NonExistingSyntaxError( SchemaObject source, String oid )
+ {
+ this.source = source;
+ this.oid = oid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaError#getSource()
+ */
+ public SchemaObject getSource()
+ {
+ return source;
+ }
+
+
+ /**
+ * Gets the syntax OID.
+ *
+ * @return
+ * the syntax OID
+ */
+ public String getSyntaxOid()
+ {
+ return oid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "[NonExistingSyntaxError - Source: " + getSource() + " - OID: " + getSyntaxOid() + "]";
+ }
+}
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/schemachecker/NonExistingSyntaxError.java
------------------------------------------------------------------------------
svn:eol-style = native