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 [7/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/ma...
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,533 @@
+/*
+ * 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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+
+
+/**
+ * This class represents an attribute type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeImpl extends AbstractAttributeType implements MutableSchemaObject
+{
+ private static final long serialVersionUID = 1L;
+
+ /** The object OID */
+ private String objectOid;
+
+ /** The name of the superior */
+ private String superiorName;
+
+ /** The OID of the syntax */
+ private String syntaxOid;
+
+ /** The name of the equality matching rule */
+ private String equalityName;
+
+ /** The name of the ordering matching rule */
+ private String orderingName;
+
+ /** The name of the substr matching rule */
+ private String substrName;
+
+
+ /**
+ * Creates a new instance of AttributeTypeImpl.
+ *
+ * @param oid
+ * the OID of the attribute type
+ */
+ public AttributeTypeImpl( String oid )
+ {
+ super( oid );
+ objectOid = oid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setNames(java.lang.String[])
+ */
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#getOid()
+ */
+ public String getOid()
+ {
+ return objectOid;
+ }
+
+
+ /**
+ * Set the OID.
+ *
+ * @param oid
+ * the OID value
+ */
+ public void setOid( String oid )
+ {
+ objectOid = oid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setDescription(java.lang.String)
+ */
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setObsolete(boolean)
+ */
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractAttributeType#setCanUserModify(boolean)
+ */
+ public void setCanUserModify( boolean canUserModify )
+ {
+ super.setCanUserModify( canUserModify );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractAttributeType#setCollective(boolean)
+ */
+ public void setCollective( boolean collective )
+ {
+ super.setCollective( collective );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractAttributeType#setSingleValue(boolean)
+ */
+ public void setSingleValue( boolean singleValue )
+ {
+ super.setSingleValue( singleValue );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractAttributeType#setUsage(org.apache.directory.shared.ldap.schema.UsageEnum)
+ */
+ public void setUsage( UsageEnum usage )
+ {
+ super.setUsage( usage );
+ }
+
+
+ /**
+ * Gets the superior name.
+ *
+ * @return
+ * the superior name
+ */
+ public String getSuperiorName()
+ {
+ return superiorName;
+ }
+
+
+ /**
+ * Sets the superior name.
+ *
+ * @param superiorName
+ * the superior name
+ */
+ public void setSuperiorName( String superiorName )
+ {
+ this.superiorName = superiorName;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSuperior()
+ */
+ public AttributeType getSuperior() throws NamingException
+ {
+ return null;
+ }
+
+
+ /**
+ * Gets the OID of the syntax.
+ *
+ * @return
+ * the OID of the syntax
+ */
+ public String getSyntaxOid()
+ {
+ return syntaxOid;
+ }
+
+
+ /**
+ * Sets the OID of the syntax.
+ *
+ * @param syntaxOid
+ * the OID of the syntax
+ */
+ public void setSyntaxOid( String syntaxOid )
+ {
+ this.syntaxOid = syntaxOid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSyntax()
+ */
+ public Syntax getSyntax() throws NamingException
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractAttributeType#setLength(int)
+ */
+ public void setLength( int length )
+ {
+ super.setLength( length );
+ }
+
+
+ /**
+ * Gets the equality matching rule name.
+ *
+ * @return
+ * the equality matching rule name
+ */
+ public String getEqualityName()
+ {
+ return equalityName;
+ }
+
+
+ /**
+ * Sets the equality matching rule name.
+ *
+ * @param equalityName
+ * the equality matching rule name
+ */
+ public void setEqualityName( String equalityName )
+ {
+ this.equalityName = equalityName;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getEquality()
+ */
+ public MatchingRule getEquality() throws NamingException
+ {
+ return null;
+ }
+
+
+ /**
+ * Gets the ordering matching rule name.
+ *
+ * @return
+ * the ordering matching rule name
+ */
+ public String getOrderingName()
+ {
+ return orderingName;
+ }
+
+
+ /**
+ * Sets the ordering matching rule name.
+ *
+ * @param orderingName
+ * the ordering matching rule name
+ */
+ public void setOrderingName( String orderingName )
+ {
+ this.orderingName = orderingName;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getOrdering()
+ */
+ public MatchingRule getOrdering() throws NamingException
+ {
+ return null;
+ }
+
+
+ /**
+ * Gets the substring matching rule name.
+ *
+ * @return
+ * the substring matching rule name
+ */
+ public String getSubstrName()
+ {
+ return substrName;
+ }
+
+
+ /**
+ * Sets the substring matching rule name.
+ *
+ * @param substrName
+ * the substring matching rule name
+ */
+ public void setSubstrName( String substrName )
+ {
+ this.substrName = substrName;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSubstr()
+ */
+ public MatchingRule getSubstr() throws NamingException
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#equals(java.lang.Object)
+ */
+ public boolean equals( Object obj )
+ {
+ if ( obj instanceof AttributeTypeImpl )
+ {
+ AttributeTypeImpl at = ( AttributeTypeImpl ) obj;
+
+ // OID
+ if ( ( getOid() == null ) && ( at.getOid() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getOid() != null ) && ( at.getOid() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getOid() != null ) && ( at.getOid() != null ) )
+ {
+ if ( !getOid().equals( at.getOid() ) )
+ {
+ return false;
+ }
+ }
+
+ // Aliases
+ if ( ( getNames() == null ) && ( at.getNames() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getNames() != null ) && ( at.getNames() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getNames() != null ) && ( at.getNames() != null ) )
+ {
+ if ( !getNames().equals( at.getNames() ) )
+ {
+ return false;
+ }
+ }
+
+ // Description
+ if ( ( getDescription() == null ) && ( at.getDescription() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getDescription() != null ) && ( at.getDescription() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getDescription() != null ) && ( at.getDescription() != null ) )
+ {
+ if ( !getDescription().equals( at.getDescription() ) )
+ {
+ return false;
+ }
+ }
+
+ // Superior
+ if ( ( getSuperiorName() == null ) && ( at.getSuperiorName() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getSuperiorName() != null ) && ( at.getSuperiorName() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getSuperiorName() != null ) && ( at.getSuperiorName() != null ) )
+ {
+ if ( !getSuperiorName().equals( at.getSuperiorName() ) )
+ {
+ return false;
+ }
+ }
+
+ // Usage
+ if ( ( getUsage() == null ) && ( at.getUsage() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getUsage() != null ) && ( at.getUsage() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getUsage() != null ) && ( at.getUsage() != null ) )
+ {
+ if ( !getUsage().equals( at.getUsage() ) )
+ {
+ return false;
+ }
+ }
+
+ // Syntax
+ if ( ( getSyntaxOid() == null ) && ( at.getSyntaxOid() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getSyntaxOid() != null ) && ( at.getSyntaxOid() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getSyntaxOid() != null ) && ( at.getSyntaxOid() != null ) )
+ {
+ if ( !getSyntaxOid().equals( at.getSyntaxOid() ) )
+ {
+ return false;
+ }
+ }
+
+ // Syntax length
+ if ( getLength() != at.getLength() )
+ {
+ return false;
+ }
+
+ // Obsolete
+ if ( isObsolete() != at.isObsolete() )
+ {
+ return false;
+ }
+
+ // Single value
+ if ( isSingleValue() != at.isSingleValue() )
+ {
+ return false;
+ }
+
+ // Collective
+ if ( isCollective() != at.isCollective() )
+ {
+ return false;
+ }
+
+ // No User Modification
+ if ( isCanUserModify() != at.isCanUserModify() )
+ {
+ return false;
+ }
+
+ // Equality matching rule
+ if ( ( getEqualityName() == null ) && ( at.getEqualityName() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getEqualityName() != null ) && ( at.getEqualityName() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getEqualityName() != null ) && ( at.getEqualityName() != null ) )
+ {
+ if ( !getEqualityName().equals( at.getEqualityName() ) )
+ {
+ return false;
+ }
+ }
+
+ // Ordering matching rule
+ if ( ( getOrderingName() == null ) && ( at.getOrderingName() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getOrderingName() != null ) && ( at.getOrderingName() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getOrderingName() != null ) && ( at.getOrderingName() != null ) )
+ {
+ if ( !getOrderingName().equals( at.getOrderingName() ) )
+ {
+ return false;
+ }
+ }
+
+ // Substring matching rule
+ if ( ( getSubstrName() == null ) && ( at.getSubstrName() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getSubstrName() != null ) && ( at.getSubstrName() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getSubstrName() != null ) && ( at.getSubstrName() != null ) )
+ {
+ if ( !getSubstrName().equals( at.getSubstrName() ) )
+ {
+ return false;
+ }
+ }
+
+ // If we've reached here, the two objects are equal.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/DependenciesComputer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/DependenciesComputer.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/DependenciesComputer.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/DependenciesComputer.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,473 @@
+/*
+ * 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;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.commons.collections.MultiMap;
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+
+
+/**
+ * This class represents the DependenciesComputer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DependenciesComputer
+{
+ /** The schemas List */
+ private List<Schema> schemasList;
+
+ /** The dependency ordered schemas List */
+ private List<Schema> dependencyOrderedSchemasList;
+
+ /** The SchemaHandler */
+ private SchemaHandler schemaHandler;
+
+ // The dependencies MultiMaps
+ private MultiMap schemasDependencies;
+ private MultiMap attributeTypesDependencies;
+ private MultiMap objectClassesDependencies;
+
+
+ /**
+ * Creates a new instance of DependenciesComputer.
+ *
+ * @param schemasList
+ * the schemasList
+ * @throws DependencyComputerException
+ */
+ public DependenciesComputer( List<Schema> schemas ) throws DependencyComputerException
+ {
+ this.schemasList = schemas;
+
+ // Creating the SchemaHandler
+ schemaHandler = new SchemaHandler();
+
+ // Creating the dependencies MultiMaps
+ schemasDependencies = new MultiValueMap();
+ attributeTypesDependencies = new MultiValueMap();
+ objectClassesDependencies = new MultiValueMap();
+
+ if ( schemas != null )
+ {
+ // Adding the schemasList in the SchemaHandler
+ for ( Schema schema : this.schemasList )
+ {
+ schemaHandler.addSchema( schema );
+ }
+
+ // Computing dependencies
+ for ( Schema schema : this.schemasList )
+ {
+ List<AttributeTypeImpl> attributeTypes = schema.getAttributeTypes();
+ if ( attributeTypes != null )
+ {
+ for ( AttributeTypeImpl attributeType : attributeTypes )
+ {
+ computeDependencies( schema, attributeType );
+ }
+ }
+
+ List<ObjectClassImpl> objectClasses = schema.getObjectClasses();
+ if ( objectClasses != null )
+ {
+ for ( ObjectClassImpl objectClass : objectClasses )
+ {
+ computeDependencies( schema, objectClass );
+ }
+ }
+ }
+
+ // Ordering the schemas
+ orderSchemasBasedOnDependencies();
+ }
+ }
+
+
+ /**
+ * Computes the dependencies for the given attribute type.
+ *
+ * @param schema
+ * the schema
+ * @param attributeType
+ * the attribute type
+ * @throws DependencyComputerException
+ */
+ private void computeDependencies( Schema schema, AttributeTypeImpl attributeType )
+ throws DependencyComputerException
+ {
+ // Superior
+ String superior = attributeType.getSuperiorName();
+ if ( superior != null )
+ {
+ AttributeTypeImpl superiorAT = schemaHandler.getAttributeType( superior );
+ if ( superiorAT == null )
+ {
+ throw new DependencyComputerException( "The superior attribute type '" + superior
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the superior attribute type
+ attributeTypesDependencies.put( attributeType, superiorAT );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, superiorAT );
+ }
+ }
+
+ // Syntax OID
+ String syntaxOID = attributeType.getSyntaxOid();
+ if ( syntaxOID != null )
+ {
+ SyntaxImpl syntax = schemaHandler.getSyntax( syntaxOID );
+ if ( syntax == null )
+ {
+ throw new DependencyComputerException( "The syntax with OID '" + syntaxOID
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ attributeTypesDependencies.put( attributeType, syntax );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, syntax );
+ }
+ }
+
+ // Equality Matching Rule
+ String equalityName = attributeType.getEqualityName();
+ if ( equalityName != null )
+ {
+ MatchingRuleImpl equalityMatchingRule = schemaHandler.getMatchingRule( equalityName );
+ if ( equalityMatchingRule == null )
+ {
+ throw new DependencyComputerException( "The equality matching rule '" + equalityName
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ attributeTypesDependencies.put( attributeType, equalityMatchingRule );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, equalityMatchingRule );
+ }
+ }
+
+ // Ordering Matching Rule
+ String orderingName = attributeType.getEqualityName();
+ if ( orderingName != null )
+ {
+ MatchingRuleImpl orderingMatchingRule = schemaHandler.getMatchingRule( orderingName );
+ if ( orderingMatchingRule == null )
+ {
+ throw new DependencyComputerException( "The ordering matching rule '" + orderingName
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ attributeTypesDependencies.put( attributeType, orderingMatchingRule );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, orderingMatchingRule );
+ }
+ }
+
+ // Substring Matching Rule
+ String substringName = attributeType.getEqualityName();
+ if ( substringName != null )
+ {
+ MatchingRuleImpl substringMatchingRule = schemaHandler.getMatchingRule( substringName );
+ if ( substringMatchingRule == null )
+ {
+ throw new DependencyComputerException( "The substring matching rule '" + substringName
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ attributeTypesDependencies.put( attributeType, substringMatchingRule );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, substringMatchingRule );
+ }
+ }
+ }
+
+
+ /**
+ * Computes the dependencies for the given object Class.
+ *
+ * @param schema
+ * the schema
+ * @param objectClass
+ * the object class
+ * @throws DependencyComputerException
+ */
+ private void computeDependencies( Schema schema, ObjectClassImpl objectClass ) throws DependencyComputerException
+ {
+ // Super Classes
+ String[] superClassesNames = objectClass.getSuperClassesNames();
+ if ( superClassesNames != null )
+ {
+ for ( String superClassName : superClassesNames )
+ {
+ ObjectClassImpl superObjectClass = schemaHandler.getObjectClass( superClassName );
+ if ( superObjectClass == null )
+ {
+ throw new DependencyComputerException( "The superior object class '" + superClassName
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ objectClassesDependencies.put( objectClass, superObjectClass );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, superObjectClass );
+ }
+ }
+ }
+
+ // Optional attribute types
+ String[] optionalAttributeTypes = objectClass.getMayNamesList();
+ if ( optionalAttributeTypes != null )
+ {
+ for ( String optionalAttributeTypeName : optionalAttributeTypes )
+ {
+ AttributeTypeImpl optionalAttributeType = schemaHandler.getAttributeType( optionalAttributeTypeName );
+ if ( optionalAttributeType == null )
+ {
+ throw new DependencyComputerException( "The optional attribute type '" + optionalAttributeType
+ + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ objectClassesDependencies.put( objectClass, optionalAttributeType );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, optionalAttributeType );
+ }
+ }
+ }
+
+ // Mandatory attribute types
+ String[] mandatoryAttributeTypes = objectClass.getMustNamesList();
+ if ( mandatoryAttributeTypes != null )
+ {
+ for ( String mandatoryAttributeTypeName : mandatoryAttributeTypes )
+ {
+ AttributeTypeImpl mandatoryAttributeType = schemaHandler.getAttributeType( mandatoryAttributeTypeName );
+ if ( mandatoryAttributeType == null )
+ {
+ throw new DependencyComputerException( "The mandatory attribute type '"
+ + mandatoryAttributeTypeName + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the syntax
+ objectClassesDependencies.put( objectClass, mandatoryAttributeType );
+
+ // Computing the schema dependency
+ computeSchemaDependency( schema, mandatoryAttributeType );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Computes the Schema Dependency.
+ *
+ * @param schema
+ * the schema
+ * @param object
+ * the SchemaObject
+ * @throws DependencyComputerException
+ */
+ private void computeSchemaDependency( Schema schema, SchemaObject object ) throws DependencyComputerException
+ {
+ String schemaName = object.getSchema();
+ if ( !schemaName.equalsIgnoreCase( schema.getName() ) )
+ {
+ Schema schemaFromSuperiorAT = schemaHandler.getSchema( schemaName );
+ if ( schemaFromSuperiorAT == null )
+ {
+ throw new DependencyComputerException( "The schema '" + schemaName + "' does not exists in the Schema." );
+ }
+ else
+ {
+ // Adding a dependency on the schema of schema object
+ schemasDependencies.put( schema, schemaFromSuperiorAT );
+ }
+ }
+ }
+
+
+ /**
+ * Orders the schemas based on their dependencies.
+ */
+ private void orderSchemasBasedOnDependencies()
+ {
+ dependencyOrderedSchemasList = new ArrayList<Schema>();
+
+ int counter = 0;
+ schemasLoop: while ( dependencyOrderedSchemasList.size() != schemasList.size() )
+ {
+ Schema schema = schemasList.get( counter );
+
+ if ( !dependencyOrderedSchemasList.contains( schema ) )
+ {
+
+ List<Schema> dependencies = getDependencies( schema );
+ if ( dependencies == null )
+ {
+ dependencyOrderedSchemasList.add( schema );
+ }
+ else
+ {
+ for ( Schema dependency : dependencies )
+ {
+ if ( !dependencyOrderedSchemasList.contains( dependency ) )
+ {
+ counter = ++counter % schemasList.size();
+
+ continue schemasLoop;
+ }
+ }
+
+ dependencyOrderedSchemasList.add( schema );
+ }
+ }
+
+ counter = ++counter % schemasList.size();
+ }
+
+ }
+
+
+ /**
+ * Gets the dependencies of the given schema.
+ *
+ * @param schema
+ * the schema
+ * @return
+ * the dependencies of the schema
+ */
+ @SuppressWarnings("unchecked")
+ public List<Schema> getDependencies( Schema schema )
+ {
+ List<Schema> dependencies = ( List<Schema> ) schemasDependencies.get( schema );
+
+ HashSet<Schema> set = new HashSet<Schema>();
+
+ if ( dependencies != null )
+ {
+ set.addAll( dependencies );
+ }
+
+ return Arrays.asList( set.toArray( new Schema[0] ) );
+ }
+
+
+ /**
+ * Gets the List of the schemas ordered according to their
+ * dependencies.
+ *
+ * @return
+ * the List of the schemas ordered according to their
+ * dependencies
+ */
+ public List<Schema> getDependencyOrderedSchemasList()
+ {
+ return dependencyOrderedSchemasList;
+ }
+
+
+ /**
+ * Gets the schemasList dependencies MultiMap.
+ *
+ * @return
+ * the schemasList dependencies MultiMap
+ */
+ public MultiMap getSchemasDependencies()
+ {
+ return schemasDependencies;
+ }
+
+
+ /**
+ * Get the attribute types dependencies MultiMap.
+ *
+ * @return
+ * the attribute types dependencies MultiMap
+ */
+ public MultiMap getAttributeTypesDependencies()
+ {
+ return attributeTypesDependencies;
+ }
+
+
+ /**
+ * Gets the object classes dependencies MultiMap.
+ *
+ * @return
+ * the object classes dependencies MultiMap
+ */
+ public MultiMap getObjectClassesDependencies()
+ {
+ return objectClassesDependencies;
+ }
+
+ /**
+ * This class represents the DependencyComputerException.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public class DependencyComputerException extends Exception
+ {
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Creates a new instance of DependencyComputerException.
+ *
+ * @param message
+ * the message
+ */
+ public DependencyComputerException( String message )
+ {
+ super( message );
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/DependenciesComputer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,135 @@
+/*
+ * 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;
+
+
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AbstractMatchingRule;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.Syntax;
+
+
+/**
+ * This class represents a matching rule.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MatchingRuleImpl extends AbstractMatchingRule implements MutableSchemaObject
+{
+ private static final long serialVersionUID = 1L;
+
+ /** The OID of the syntax */
+ private String syntaxOid;
+
+
+ /**
+ * Gets the OID of the syntax.
+ *
+ * @return
+ * the OID of the syntax
+ */
+ public String getSyntaxOid()
+ {
+ return syntaxOid;
+ }
+
+
+ /**
+ * Sets the OID of the syntax.
+ *
+ * @param syntaxOid
+ * the OID of the syntax
+ */
+ public void setSyntaxOid( String syntaxOid )
+ {
+ this.syntaxOid = syntaxOid;
+ }
+
+
+ /**
+ * Creates a new instance of MatchingRuleImpl.
+ *
+ * @param oid
+ * the OID
+ */
+ public MatchingRuleImpl( String oid )
+ {
+ super( oid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.MatchingRule#getComparator()
+ */
+ public Comparator<?> getComparator() throws NamingException
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.MatchingRule#getNormalizer()
+ */
+ public Normalizer getNormalizer() throws NamingException
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.MatchingRule#getSyntax()
+ */
+ public Syntax getSyntax() throws NamingException
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setDescription(java.lang.String)
+ */
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setNames(java.lang.String[])
+ */
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setObsolete(boolean)
+ */
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+}
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,414 @@
+/*
+ * 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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AbstractSchemaObject;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MutableSchemaObject;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+
+
+/**
+ * This class implements an object class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassImpl extends AbstractSchemaObject implements MutableSchemaObject, ObjectClass
+{
+ private static final long serialVersionUID = 1L;
+
+ /** The object OID */
+ private String objectOid;
+
+ /** The object class type */
+ private ObjectClassTypeEnum type;
+
+ /** The optional attribute type names list */
+ private String[] mayNamesList = new String[0];
+
+ /** The mandatory attribute type names list */
+ private String[] mustNamesList = new String[0];
+
+ /** The super class names list */
+ private String[] superClassesNames = new String[0];
+
+
+ /**
+ * Creates a new instance of ObjectClassImpl.
+ *
+ * @param oid
+ * the OID of the object class
+ */
+ public ObjectClassImpl( String oid )
+ {
+ super( oid );
+ objectOid = oid;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setNames(java.lang.String[])
+ */
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#getOid()
+ */
+ public String getOid()
+ {
+ return objectOid;
+ }
+
+
+ /**
+ * Set the OID.
+ *
+ * @param oid
+ * the OID value
+ */
+ public void setOid( String oid )
+ {
+ objectOid = oid;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setDescription(java.lang.String)
+ */
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setObsolete(boolean)
+ */
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#getType()
+ */
+ public ObjectClassTypeEnum getType()
+ {
+ return type;
+ }
+
+
+ /**
+ * Sets the type of the object class.
+ *
+ * @param objectClassTypeEnum
+ * the type of the object class
+ */
+ public void setType( ObjectClassTypeEnum objectClassTypeEnum )
+ {
+ this.type = objectClassTypeEnum;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#isAbstract()
+ */
+ public boolean isAbstract()
+ {
+ return ObjectClassTypeEnum.ABSTRACT.equals( getType() );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#isAuxiliary()
+ */
+ public boolean isAuxiliary()
+ {
+ return ObjectClassTypeEnum.AUXILIARY.equals( getType() );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#isStructural()
+ */
+ public boolean isStructural()
+ {
+ return ObjectClassTypeEnum.STRUCTURAL.equals( getType() );
+ }
+
+
+ /**
+ * gets the names of the super classes.
+ *
+ * @return the names of the super classes
+ */
+ public String[] getSuperClassesNames()
+ {
+ return superClassesNames;
+ }
+
+
+ /**
+ * Sets the names of the super classes.
+ *
+ * @param superClassesNames
+ * the names of the super classes
+ */
+ public void setSuperClassesNames( String[] superClassesNames )
+ {
+ this.superClassesNames = superClassesNames;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#getSuperClasses()
+ */
+ public ObjectClass[] getSuperClasses() throws NamingException
+ {
+ return null;
+ }
+
+
+ /**
+ * Gets the names of the mandatory attribute types.
+ *
+ * @return the names of the mandatory attribute types
+ */
+ public String[] getMustNamesList()
+ {
+ return mustNamesList;
+ }
+
+
+ /**
+ * Set the names of the mandatory attribute types.
+ *
+ * @param mustNamesList
+ * the names of the mandatory attribute types
+ */
+ public void setMustNamesList( String[] mustNamesList )
+ {
+ this.mustNamesList = mustNamesList;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#getMustList()
+ */
+ public AttributeType[] getMustList() throws NamingException
+ {
+ return null;
+ }
+
+
+ /**
+ * Gets the names of the optional attribute types.
+ *
+ * @return the names of the optional attribute types
+ */
+ public String[] getMayNamesList()
+ {
+ return mayNamesList;
+ }
+
+
+ /**
+ * Sets the names of the optional attribute types.
+ *
+ * @param mayNamesList
+ * the names of the optional attribute types
+ */
+ public void setMayNamesList( String[] mayNamesList )
+ {
+ this.mayNamesList = mayNamesList;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.ObjectClass#getMayList()
+ */
+ public AttributeType[] getMayList() throws NamingException
+ {
+ return null;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#equals(java.lang.Object)
+ */
+ public boolean equals( Object obj )
+ {
+ if ( obj instanceof ObjectClassImpl )
+ {
+ ObjectClassImpl oc = ( ObjectClassImpl ) obj;
+
+ // OID
+ if ( ( getOid() == null ) && ( oc.getOid() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getOid() != null ) && ( oc.getOid() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getOid() != null ) && ( oc.getOid() != null ) )
+ {
+ if ( !getOid().equals( oc.getOid() ) )
+ {
+ return false;
+ }
+ }
+
+ // Aliases
+ if ( ( getNames() == null ) && ( oc.getNames() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getNames() != null ) && ( oc.getNames() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getNames() != null ) && ( oc.getNames() != null ) )
+ {
+ if ( !getNames().equals( oc.getNames() ) )
+ {
+ return false;
+ }
+ }
+
+ // Description
+ if ( ( getDescription() == null ) && ( oc.getDescription() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getDescription() != null ) && ( oc.getDescription() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getDescription() != null ) && ( oc.getDescription() != null ) )
+ {
+ if ( !getDescription().equals( oc.getDescription() ) )
+ {
+ return false;
+ }
+ }
+
+ // Superiors
+ if ( ( getSuperClassesNames() == null ) && ( oc.getSuperClassesNames() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getSuperClassesNames() != null ) && ( oc.getSuperClassesNames() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getSuperClassesNames() != null ) && ( oc.getSuperClassesNames() != null ) )
+ {
+ if ( !getSuperClassesNames().equals( oc.getSuperClassesNames() ) )
+ {
+ return false;
+ }
+ }
+
+ // Type
+ if ( getType() != oc.getType() )
+ {
+ return false;
+ }
+
+ // Obsolete
+ if ( isObsolete() != oc.isObsolete() )
+ {
+ return false;
+ }
+
+ // Mandatory attributes
+ if ( ( getMustNamesList() == null ) && ( oc.getMustNamesList() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getMustNamesList() != null ) && ( oc.getMustNamesList() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getMustNamesList() != null ) && ( oc.getMustNamesList() != null ) )
+ {
+ if ( !getMustNamesList().equals( oc.getMustNamesList() ) )
+ {
+ return false;
+ }
+ }
+
+ // Optional attributes
+ if ( ( getMayNamesList() == null ) && ( oc.getMayNamesList() != null ) )
+ {
+ return false;
+ }
+ else if ( ( getMayNamesList() != null ) && ( oc.getMayNamesList() == null ) )
+ {
+ return false;
+ }
+ else if ( ( getMayNamesList() != null ) && ( oc.getMayNamesList() != null ) )
+ {
+ if ( !getMayNamesList().equals( oc.getMayNamesList() ) )
+ {
+ return false;
+ }
+ }
+
+ // If we've reached here, the two objects are equal.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,363 @@
+/*
+ * 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;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.StudioProgressMonitor;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.model.io.SchemaConnector;
+import org.apache.directory.studio.schemaeditor.model.schemachecker.SchemaChecker;
+
+
+/**
+ * This class implements a Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Project
+{
+ /**
+ * This enum represents the different states of Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum ProjectState
+ {
+ /** An Open project*/
+ OPEN,
+ /** A Closed project*/
+ CLOSED
+ }
+
+ /** The type of the project */
+ private ProjectType type;
+
+ /** The name of the project */
+ private String name;
+
+ /** The connection of the project */
+ private Connection connection;
+
+ /** The state of the project */
+ private ProjectState state;
+
+ /** The SchemaConnector of the project */
+ private SchemaConnector schemaConnector;
+
+ /** The SchemaHandler */
+ private SchemaHandler schemaHandler;
+
+ /** The SchemaCheker */
+ private SchemaChecker schemaChecker;
+
+ /** The backup of the Online Schema */
+ private List<Schema> schemaBackup;
+
+ /** The flag for Online Schema Fetch */
+ private boolean hasOnlineSchemaBeenFetched = false;
+
+
+ /**
+ * Creates a new instance of Project.
+ *
+ * @param type
+ * the type of project
+ * @param name
+ * the name of project
+ */
+ public Project( ProjectType type, String name )
+ {
+ this.type = type;
+ this.name = name;
+ this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
+ }
+
+
+ /**
+ * Creates a new instance of Project.
+ * The default type is used : OFFLINE.
+ */
+ public Project()
+ {
+ type = ProjectType.OFFLINE;
+ this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
+ }
+
+
+ /**
+ * Creates a new instance of Project.
+ *
+ * @param type
+ * the type of project
+ */
+ public Project( ProjectType type )
+ {
+ this.type = type;
+ this.state = ProjectState.CLOSED;
+ schemaHandler = new SchemaHandler();
+ schemaChecker = new SchemaChecker();
+ }
+
+
+ /**
+ * Gets the type of the project.
+ *
+ * @return
+ * the type of the project
+ */
+ public ProjectType getType()
+ {
+ return type;
+ }
+
+
+ /**
+ * Sets the type of the project.
+ *
+ * @param type
+ * the type of the project
+ */
+ public void setType( ProjectType type )
+ {
+ this.type = type;
+ }
+
+
+ /**
+ * Gets the name of the project.
+ *
+ * @return
+ * the name of the project
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * Sets the name of the project
+ *
+ * @param name
+ * the name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Gets the state of the project.
+ *
+ * @return
+ * the state of the project
+ */
+ public ProjectState getState()
+ {
+ return state;
+ }
+
+
+ /**
+ * Sets the state of the project
+ *
+ * @param state
+ * the state
+ */
+ public void setState( ProjectState state )
+ {
+ this.state = state;
+ }
+
+
+ /**
+ * Gets the SchemaHandler
+ *
+ * @return
+ * the SchemaHandler
+ */
+ public SchemaHandler getSchemaHandler()
+ {
+ return schemaHandler;
+ }
+
+
+ /**
+ * Gets the SchemaChecker
+ *
+ * @return
+ * the SchemaChecker
+ */
+ public SchemaChecker getSchemaChecker()
+ {
+ return schemaChecker;
+ }
+
+
+ /**
+ * Gets the Connection.
+ *
+ * @return
+ * the connection
+ */
+ public Connection getConnection()
+ {
+ return connection;
+ }
+
+
+ /**
+ * Sets the Connection.
+ *
+ * @param connection
+ * the connection
+ */
+ public void setConnection( Connection connection )
+ {
+ this.connection = connection;
+ }
+
+
+ /**
+ * Fetches the Online Schema.
+ *
+ * @param monitor
+ * a StudioProgressMonitor
+ */
+ public void fetchOnlineSchema( StudioProgressMonitor monitor )
+ {
+ if ( ( !hasOnlineSchemaBeenFetched ) && ( connection != null ) && ( schemaConnector != null ) )
+ {
+ schemaBackup = schemaConnector.importSchema( connection, monitor );
+
+ if ( schemaBackup != null )
+ {
+ monitor.beginTask( "Adding Schema to project", schemaBackup.size() );
+ for ( Schema schema : schemaBackup )
+ {
+ getSchemaHandler().addSchema( schema );
+ }
+ }
+
+ // TODO Add error Handling
+ monitor.done();
+ hasOnlineSchemaBeenFetched = true;
+ }
+ }
+
+
+ /**
+ * Returns whether the online schema has been fetched.
+ *
+ * @return
+ * true if the online schema has bee fetched
+ */
+ public boolean hasOnlineSchemaBeenFetched()
+ {
+ return hasOnlineSchemaBeenFetched;
+ }
+
+
+ /**
+ * Gets the Schema Backup.
+ *
+ * @return
+ * the Schema Backup
+ */
+ public List<Schema> getSchemaBackup()
+ {
+ return schemaBackup;
+ }
+
+
+ /**
+ * Sets the Schema Backup
+ *
+ * @param schemaBackup
+ * the Schema Backup
+ */
+ public void setSchemaBackup( List<Schema> schemaBackup )
+ {
+ this.schemaBackup = schemaBackup;
+ }
+
+
+ /**
+ * Gets the SchemaConnector.
+ *
+ * @return
+ * the SchemaConnector
+ */
+ public SchemaConnector getSchemaConnector()
+ {
+ return schemaConnector;
+ }
+
+
+ /**
+ * Sets the SchemaConnector.
+ *
+ * @param schemaConnector
+ * the SchemaConnector
+ */
+ public void setSchemaConnector( SchemaConnector schemaConnector )
+ {
+ this.schemaConnector = schemaConnector;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object obj )
+ {
+ if ( obj instanceof Project )
+ {
+ Project project = ( Project ) obj;
+ if ( !getName().equals( project.getName() ) )
+ {
+ return false;
+ }
+ else if ( !getType().equals( project.getType() ) )
+ {
+ return false;
+ }
+ else if ( !getState().equals( project.getState() ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ // Default
+ return super.equals( obj );
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ProjectType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ProjectType.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ProjectType.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ProjectType.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+
+/**
+ * This enum represents the different types of Project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum ProjectType
+{
+ /** A schema project not linked to any LDAP Server */
+ OFFLINE,
+ /** A schema project linked to a Directory Server */
+ ONLINE
+}
\ No newline at end of file
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ProjectType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,206 @@
+/*
+ * 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;
+
+
+import java.util.List;
+
+
+/**
+ * This interface represents a Schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface Schema
+{
+ /**
+ * Gets the name of the Schema.
+ *
+ * @return
+ * the name of the Schema
+ */
+ public String getName();
+
+
+ /**
+ * Sets the name of the Schema.
+ *
+ * @param name
+ * the name of the schema
+ */
+ public void setName( String name );
+
+
+ /**
+ * Gets all the ObjectClassImpl objects contained in the Schema.
+ *
+ * @return
+ * all the ObjectClassImpl objects contained in the Schema
+ */
+ public List<ObjectClassImpl> getObjectClasses();
+
+
+ /**
+ * Gets all the AttributeTypeImpl objects contained in the Schema.
+ *
+ * @return
+ * all the AttributeTypeImpl objects contained in the Schema
+ */
+ public List<AttributeTypeImpl> getAttributeTypes();
+
+
+ /**
+ * Gets all the MatchingRuleImpl objects contained in the Schema.
+ *
+ * @return
+ * all the MatchingRuleImpl objects contained in the Schema
+ */
+ public List<MatchingRuleImpl> getMatchingRules();
+
+
+ /**
+ * Gets all the SyntaxImpl objects contained in the Schema.
+ *
+ * @return
+ * all the SyntaxImpl objects contained in the Schema
+ */
+ public List<SyntaxImpl> getSyntaxes();
+
+
+ /**
+ * Gets the ObjectClassImpl identified by the given id.
+ *
+ * @param id
+ * the name or the oid of the ObjectClassImpl
+ * @return
+ * the ObjectClassImpl identified by the given id, or null if the
+ * ObjectClassImpl has not been found
+ */
+ public ObjectClassImpl getObjectClass( String id );
+
+
+ /**
+ * Gets the AttributeTypeImpl identified by the given id.
+ *
+ * @param id
+ * the name or the oid of the AttributeTypeImpl
+ * @return
+ * the AttributeTypeImpl identified by the given id, or null if the
+ * AttributeTypeImpl has not been found
+ */
+ public AttributeTypeImpl getAttributeType( String id );
+
+
+ /**
+ * Gets the MatchingRuleImpl identified by the given id.
+ *
+ * @param id
+ * the name or the oid of the MatchingRuleImpl
+ * @return
+ * the MatchingRuleImpl identified by the given id, or null if the
+ * MatchingRuleImpl has not been found
+ */
+ public MatchingRuleImpl getMatchingRule( String id );
+
+
+ /**
+ * Gets the SyntaxImpl identified by the given id.
+ *
+ * @param id
+ * the name or the oid of the SyntaxImpl
+ * @return
+ * the SyntaxImpl identified by the given id, or null if the
+ * SyntaxImpl has not been found
+ */
+ public SyntaxImpl getSyntax( String id );
+
+
+ /**
+ * Adds an ObjectClassImpl to the Schema.
+ *
+ * @param oc
+ * the ObjectClassImpl
+ */
+ public boolean addObjectClass( ObjectClassImpl oc );
+
+
+ /**
+ * Adds an AttributeTypeImpl to the Schema.
+ *
+ * @param at
+ * the AttributeTypeImpl
+ */
+ public boolean addAttributeType( AttributeTypeImpl at );
+
+
+ /**
+ * Adds a MatchingRuleImpl from the Schema.
+ *
+ * @param mr
+ * the MatchingRuleImpl
+ */
+ public boolean addMatchingRule( MatchingRuleImpl mr );
+
+
+ /**
+ * Adds a SyntaxImpl from the Schema.
+ *
+ * @param syntax
+ * the SyntaxImpl
+ */
+ public boolean addSyntax( SyntaxImpl syntax );
+
+
+ /**
+ * Removes an ObjectClassImpl from the Schema.
+ *
+ * @param oc
+ * the ObjectClassImpl
+ */
+ public boolean removeObjectClass( ObjectClassImpl oc );
+
+
+ /**
+ * Removes an AttributeTypeImpl from the Schema.
+ *
+ * @param at
+ * the AttributeTypeImpl
+ */
+ public boolean removeAttributeType( AttributeTypeImpl at );
+
+
+ /**
+ * Removes a MatchingRuleImpl from the Schema.
+ *
+ * @param mr
+ * the MatchingRuleImpl
+ */
+ public boolean removeMatchingRule( MatchingRuleImpl mr );
+
+
+ /**
+ * Removes a SyntaxImpl from the Schema.
+ *
+ * @param syntax
+ * the SyntaxImpl
+ */
+ public boolean removeSyntax( SyntaxImpl syntax );
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,308 @@
+/*
+ * 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;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * This class represents a schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaImpl implements Schema
+{
+ /** The name */
+ private String name;
+
+ /** The AttributeType List */
+ private List<AttributeTypeImpl> attributeTypes = new ArrayList<AttributeTypeImpl>();
+
+ /** The ObjectClass List */
+ private List<ObjectClassImpl> objectClasses = new ArrayList<ObjectClassImpl>();
+
+ /** The MatchingRule List */
+ private List<MatchingRuleImpl> matchingRules = new ArrayList<MatchingRuleImpl>();
+
+ /** The Syntax List */
+ private List<SyntaxImpl> syntaxes = new ArrayList<SyntaxImpl>();
+
+
+ /**
+ * Creates a new instance of SchemaImpl.
+ *
+ * @param name
+ * the name of the schema
+ */
+ public SchemaImpl( String name )
+ {
+ this.name = name;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#addAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
+ */
+ public boolean addAttributeType( AttributeTypeImpl at )
+ {
+ return attributeTypes.add( at );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#addMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
+ */
+ public boolean addMatchingRule( MatchingRuleImpl mr )
+ {
+ return matchingRules.add( mr );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#addObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
+ */
+ public boolean addObjectClass( ObjectClassImpl oc )
+ {
+ return objectClasses.add( oc );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#addSyntax(org.apache.directory.shared.ldap.schema.Syntax)
+ */
+ public boolean addSyntax( SyntaxImpl syntax )
+ {
+ return syntaxes.add( syntax );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getAttributeType(java.lang.String)
+ */
+ public AttributeTypeImpl getAttributeType( String id )
+ {
+ for ( AttributeTypeImpl at : attributeTypes )
+ {
+ String[] aliases = at.getNames();
+ if ( aliases != null )
+ {
+ for ( String alias : aliases )
+ {
+ if ( alias.equalsIgnoreCase( id ) )
+ {
+ return at;
+ }
+ }
+ }
+ if ( at.getOid().equalsIgnoreCase( id ) )
+ {
+ return at;
+ }
+ }
+
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getAttributeTypes()
+ */
+ public List<AttributeTypeImpl> getAttributeTypes()
+ {
+ return attributeTypes;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getMatchingRule(java.lang.String)
+ */
+ public MatchingRuleImpl getMatchingRule( String id )
+ {
+ for ( MatchingRuleImpl mr : matchingRules )
+ {
+ String[] aliases = mr.getNames();
+ if ( aliases != null )
+ {
+ for ( String alias : aliases )
+ {
+ if ( alias.equalsIgnoreCase( id ) )
+ {
+ return mr;
+ }
+ }
+ }
+ if ( mr.getOid().equalsIgnoreCase( id ) )
+ {
+ return mr;
+ }
+ }
+
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getMatchingRules()
+ */
+ public List<MatchingRuleImpl> getMatchingRules()
+ {
+ return matchingRules;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getObjectClass(java.lang.String)
+ */
+ public ObjectClassImpl getObjectClass( String id )
+ {
+ for ( ObjectClassImpl oc : objectClasses )
+ {
+ String[] aliases = oc.getNames();
+ if ( aliases != null )
+ {
+ for ( String alias : aliases )
+ {
+ if ( alias.equalsIgnoreCase( id ) )
+ {
+ return oc;
+ }
+ }
+ }
+ if ( oc.getOid().equalsIgnoreCase( id ) )
+ {
+ return oc;
+ }
+ }
+
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getObjectClasses()
+ */
+ public List<ObjectClassImpl> getObjectClasses()
+ {
+ return objectClasses;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getSyntax(java.lang.String)
+ */
+ public SyntaxImpl getSyntax( String id )
+ {
+ for ( SyntaxImpl syntax : syntaxes )
+ {
+ String[] aliases = syntax.getNames();
+ if ( aliases != null )
+ {
+ for ( String alias : aliases )
+ {
+ if ( alias.equalsIgnoreCase( id ) )
+ {
+ return syntax;
+ }
+ }
+ }
+ if ( syntax.getOid().equalsIgnoreCase( id ) )
+ {
+ return syntax;
+ }
+ }
+
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#getSyntaxes()
+ */
+ public List<SyntaxImpl> getSyntaxes()
+ {
+ return syntaxes;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#removeAttributeType(org.apache.directory.shared.ldap.schema.AttributeType)
+ */
+ public boolean removeAttributeType( AttributeTypeImpl at )
+ {
+ return attributeTypes.remove( at );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#removeMatchingRule(org.apache.directory.shared.ldap.schema.MatchingRule)
+ */
+ public boolean removeMatchingRule( MatchingRuleImpl mr )
+ {
+ return matchingRules.remove( mr );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#removeObjectClass(org.apache.directory.shared.ldap.schema.ObjectClass)
+ */
+ public boolean removeObjectClass( ObjectClassImpl oc )
+ {
+ return objectClasses.remove( oc );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#removeSyntax(org.apache.directory.shared.ldap.schema.Syntax)
+ */
+ public boolean removeSyntax( SyntaxImpl syntax )
+ {
+ return syntaxes.remove( syntax );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.Schema#setName(java.lang.String)
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return getName();
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AbstractSyntax;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
+
+
+/**
+ * This class represents a syntax.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SyntaxImpl extends AbstractSyntax
+{
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Creates a new instance of SyntaxImpl.
+ *
+ * @param oid
+ * the OID
+ */
+ public SyntaxImpl( String oid )
+ {
+ super( oid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSyntax#setHumanReadable(boolean)
+ */
+ public void setHumanReadable( boolean isHumanReadable )
+ {
+ super.setHumanReadable( isHumanReadable );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setDescription(java.lang.String)
+ */
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setNames(java.lang.String[])
+ */
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#setObsolete(boolean)
+ */
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.Syntax#getSyntaxChecker()
+ */
+ public SyntaxChecker getSyntaxChecker() throws NamingException
+ {
+ return null;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractDifference.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractDifference.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractDifference.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractDifference.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,126 @@
+/*
+ * 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.difference;
+
+
+/**
+ * This class represents the AbstractDifference.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AbstractDifference implements Difference
+{
+ /** The source Object */
+ private Object source;
+
+ /** The destination Object */
+ private Object destination;
+
+ /** The type of difference */
+ private DifferenceType type;
+
+
+ /**
+ * Creates a new instance of AbstractDifference.
+ *
+ * @param source
+ * the source Object
+ * @param destination
+ * the destination Object
+ */
+ public AbstractDifference( Object source, Object destination )
+ {
+ this.source = source;
+ this.destination = destination;
+ }
+
+
+ /**
+ * Creates a new instance of AbstractDifference.
+ *
+ * @param source
+ * the source Object
+ * @param destination
+ * the destination Object
+ * @param type
+ * the type
+ */
+ public AbstractDifference( Object source, Object destination, DifferenceType type )
+ {
+ this.source = source;
+ this.destination = destination;
+ this.type = type;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#getDestination()
+ */
+ public Object getDestination()
+ {
+ return destination;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#setDestination(java.lang.Object)
+ */
+ public void setDestination( Object destination )
+ {
+ this.destination = destination;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#getSource()
+ */
+ public Object getSource()
+ {
+ return source;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#setSource(java.lang.Object)
+ */
+ public void setSource( Object source )
+ {
+ this.source = source;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#getType()
+ */
+ public DifferenceType getType()
+ {
+ return type;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.Difference#setType(org.apache.directory.studio.schemaeditor.model.difference.DifferenceType)
+ */
+ public void setType( DifferenceType type )
+ {
+ this.type = type;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractDifference.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractPropertyDifference.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractPropertyDifference.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractPropertyDifference.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractPropertyDifference.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.difference;
+
+
+/**
+ * This abstract class represents an Abstract Property Difference.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractPropertyDifference extends AbstractDifference implements PropertyDifference
+{
+ /** The old value*/
+ private Object oldValue;
+
+ /** The new value */
+ private Object newValue;
+
+
+ /**
+ * Creates a new instance of AbstractPropertyDifference.
+ *
+ * @param source
+ * the source Object
+ * @param destination
+ * the destination Object
+ * @param type
+ * the type
+ */
+ public AbstractPropertyDifference( Object source, Object destination, DifferenceType type )
+ {
+ super( source, destination, type );
+ }
+
+
+ /**
+ * Creates a new instance of AbstractPropertyDifference.
+ *
+ * @param source
+ * the source Object
+ * @param destination
+ * the destination Object
+ */
+ public AbstractPropertyDifference( Object source, Object destination )
+ {
+ super( source, destination );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference#getNewValue()
+ */
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference#setNewValue(java.lang.Object)
+ */
+ public void setNewValue( Object newValue )
+ {
+ this.newValue = newValue;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference#getOldValue()
+ */
+ public Object getOldValue()
+ {
+ return oldValue;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference#setOldValue(java.lang.Object)
+ */
+ public void setOldValue( Object oldValue )
+ {
+ this.oldValue = oldValue;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/difference/AbstractPropertyDifference.java
------------------------------------------------------------------------------
svn:eol-style = native