You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/12/19 23:48:45 UTC
svn commit: r488843 - in /directory/branches/trunks/schema:
apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/
apacheds/bootstrap-plugin/
apacheds/bootstrap-plugin/src/main/java/org/apache/directory/serve...
Author: akarasulu
Date: Tue Dec 19 14:48:43 2006
New Revision: 488843
URL: http://svn.apache.org/viewvc?view=rev&rev=488843
Log:
changes ...
o added some new MR, AT, and OC implementations for use in loading objs from
schema partition
o added constants for meta, system, and core schemas
o used constants instead of strings in the bootstrap-plugin and in the core
schema loader code
o added code to load MR, AT, and OC from schema partition
Added:
directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/
directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/CoreSchemaConstants.java
directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/MetaSchemaConstants.java
directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleImpl.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java
directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MutableSchemaObject.java
Modified:
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
directory/branches/trunks/schema/apacheds/bootstrap-plugin/pom.xml
directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
directory/branches/trunks/schema/apacheds/mitosis/ (props changed)
directory/branches/trunks/schema/daemon/ (props changed)
directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java
directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractMatchingRule.java
Modified: directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/schema/bootstrap/partition/DbFileType.java Tue Dec 19 14:48:43 2006
@@ -1,4 +1,4 @@
-/*
+/*
* 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
Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/pom.xml?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/pom.xml (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/pom.xml Tue Dec 19 14:48:43 2006
@@ -37,6 +37,11 @@
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-constants</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-schema-extras</artifactId>
<version>${pom.version}</version>
</dependency>
Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/AttributesFactory.java Tue Dec 19 14:48:43 2006
@@ -28,6 +28,8 @@
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
+import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -52,82 +54,21 @@
*/
public class AttributesFactory
{
- private static final Object META_SCHEMA_OC = "metaSchema";
- private static final String META_OBJECT_CLASS_OC = "metaObjectClass";
- private static final String META_ATTRIBUTE_TYPE_OC = "metaAttributeType";
- private static final String META_MATCHING_RULE_OC = "metaMatchingRule";
- private static final String META_NORMALIZER_OC = "metaNormalizer";
- private static final String META_SYNTAX_OC = "metaSyntax";
- private static final String META_SYNTAX_CHECKER_OC = "metaSyntaxChecker";
- private static final String META_COMPARATOR_OC = "metaComparator";
-
- /*
- # | 1.3.6.1.4.1.18060.0.4.0.2.9 | m-extensionObjectClass |
- # | 1.3.6.1.4.1.18060.0.4.0.2.20 | m-ruleId |
- # | 1.3.6.1.4.1.18060.0.4.0.2.21 | m-form |
- # | 1.3.6.1.4.1.18060.0.4.0.2.22 | m-supDITStructureRule |
- # | 1.3.6.1.4.1.18060.0.4.0.2.23 | m-extensionDITStructureRule |
- # | 1.3.6.1.4.1.18060.0.4.0.2.24 | m-oc |
- # | 1.3.6.1.4.1.18060.0.4.0.2.25 | m-extensionNameForm |
- # | 1.3.6.1.4.1.18060.0.4.0.2.26 | m-aux |
- # | 1.3.6.1.4.1.18060.0.4.0.2.27 | m-not |
- # | 1.3.6.1.4.1.18060.0.4.0.2.28 | m-extensionDITContentRule |
- # | 1.3.6.1.4.1.18060.0.4.0.2.29 | m-applies |
- # | 1.3.6.1.4.1.18060.0.4.0.2.30 | m-extensionMatchingRuleUse |
- # | 1.3.6.1.4.1.18060.0.4.0.2.31 | m-matchingRuleSyntax |
- */
-
- private static final String OBJECT_CLASS_AT = "objectClass";
- private static final String M_OID_AT = "m-oid";
- private static final String M_NAME_AT = "m-name";
- private static final String M_DESC_AT = "m-description";
- private static final String M_OBSOLETE_AT = "m-obsolete";
- private static final String M_MUST_AT = "m-must";
- private static final String M_MAY_AT = "m-may";
- private static final String M_TYPE_OBJECT_CLASS_AT = "m-typeObjectClass";
- private static final String M_FQCN_AT = "m-fqcn";
- // private static final String M_BYTECODE_AT = "m-bytecode";
- private static final String X_HUMAN_READIBLE_AT = "x-humanReadible";
- private static final String M_COLLECTIVE_AT = "m-collective";
- private static final String M_SYNTAX_AT = "m-syntax";
- private static final String M_NO_USER_MODIFICATION_AT = "m-noUserModification";
- private static final String M_EQUALITY_AT = "m-equality";
- private static final String M_ORDERING_AT = "m-ordering";
- private static final String M_SUBSTR_AT = "m-substr";
- private static final String M_SUP_ATTRIBUTE_TYPE_AT = "m-supAttributeType";
- private static final String M_SINGLE_VALUE_AT = "m-singleValue";
- private static final String M_USAGE_AT = "m-usage";
- // private static final String M_EXTENSION_ATTRIBUTE_TYPE_AT = "m-extensionAttributeType";
- private static final String M_SUP_OBJECT_CLASS_AT = "m-supObjectClass";
- private static final String M_IS_DISABLED_AT = null;
-
- /*
-
- private static final String _AT = "";
- private static final String _AT = "";
- private static final String _AT = "";
- private static final String _AT = "";
- private static final String _AT = "";
- private static final String _AT = "";
- private static final String _AT = "";
-*/
-
-
public Attributes getAttributes( Schema schema )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_SCHEMA_OC );
- entry.put( "cn", schema.getSchemaName() );
- entry.put( "m-owner", schema.getOwner() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_SCHEMA_OC );
+ entry.put( SystemSchemaConstants.CN_AT, schema.getSchemaName() );
+ entry.put( MetaSchemaConstants.M_OWNER_AT, schema.getOwner() );
if ( schema.isDisabled() )
{
- entry.put( M_IS_DISABLED_AT, "TRUE" );
+ entry.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" );
}
if ( schema.getDependencies() != null && schema.getDependencies().length > 0 )
{
- Attribute attr = new LockableAttributeImpl( "m-dependencies" );
+ Attribute attr = new LockableAttributeImpl( MetaSchemaConstants.M_DEPENDENCIES_AT );
for ( String dep : schema.getDependencies() )
{
attr.add( dep );
@@ -141,19 +82,19 @@
public Attributes getAttributes( SyntaxChecker syntaxChecker )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_SYNTAX_CHECKER_OC );
- entry.put( M_OID_AT, syntaxChecker.getSyntaxOid() );
- entry.put( M_FQCN_AT, syntaxChecker.getClass().getName() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
+ entry.put( MetaSchemaConstants.M_OID_AT, syntaxChecker.getSyntaxOid() );
+ entry.put( MetaSchemaConstants.M_FQCN_AT, syntaxChecker.getClass().getName() );
return entry;
}
public Attributes getAttributes( Syntax syntax )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_SYNTAX_OC );
- entry.put( X_HUMAN_READIBLE_AT, getBoolean( syntax.isHumanReadible() ) );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_SYNTAX_OC );
+ entry.put( MetaSchemaConstants.X_HUMAN_READIBLE_AT, getBoolean( syntax.isHumanReadible() ) );
injectCommon( syntax, entry );
return entry;
}
@@ -161,20 +102,20 @@
public Attributes getAttributes( String oid, Normalizer normalizer )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_NORMALIZER_OC );
- entry.put( M_OID_AT, oid );
- entry.put( M_FQCN_AT, normalizer.getClass().getName() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_NORMALIZER_OC );
+ entry.put( MetaSchemaConstants.M_OID_AT, oid );
+ entry.put( MetaSchemaConstants.M_FQCN_AT, normalizer.getClass().getName() );
return entry;
}
public Attributes getAttributes( String oid, Comparator comparator )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_COMPARATOR_OC );
- entry.put( M_OID_AT, oid );
- entry.put( M_FQCN_AT, comparator.getClass().getName() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_COMPARATOR_OC );
+ entry.put( MetaSchemaConstants.M_OID_AT, oid );
+ entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() );
return entry;
}
@@ -187,9 +128,9 @@
*/
public Attributes getAttributes( MatchingRule matchingRule ) throws NamingException
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_MATCHING_RULE_OC );
- entry.put( M_SYNTAX_AT, matchingRule.getSyntax().getOid() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_MATCHING_RULE_OC );
+ entry.put( MetaSchemaConstants.M_SYNTAX_AT, matchingRule.getSyntax().getOid() );
injectCommon( matchingRule, entry );
return entry;
}
@@ -197,32 +138,32 @@
public Attributes getAttributes( MatchingRuleUse matchingRuleUse )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( "" );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
return entry;
}
public Attributes getAttributes( DITStructureRule dITStructureRule )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( "" );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
return entry;
}
public Attributes getAttributes( DITContentRule dITContentRule )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( "" );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
return entry;
}
public Attributes getAttributes( NameForm nameForm )
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( "" );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
return entry;
}
@@ -247,20 +188,20 @@
*/
public Attributes getAttributes( AttributeType attributeType ) throws NamingException
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_ATTRIBUTE_TYPE_OC );
- entry.put( M_SYNTAX_AT, attributeType.getSyntax().getOid() );
- entry.put( M_COLLECTIVE_AT, getBoolean( attributeType.isCollective() ) );
- entry.put( M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isCanUserModify() ) );
- entry.put( M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValue() ) );
- entry.put( M_USAGE_AT, attributeType.getUsage().toString() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
+ entry.put( MetaSchemaConstants.M_SYNTAX_AT, attributeType.getSyntax().getOid() );
+ entry.put( MetaSchemaConstants.M_COLLECTIVE_AT, getBoolean( attributeType.isCollective() ) );
+ entry.put( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT, getBoolean( ! attributeType.isCanUserModify() ) );
+ entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValue() ) );
+ entry.put( MetaSchemaConstants.M_USAGE_AT, attributeType.getUsage().toString() );
injectCommon( attributeType, entry );
AttributeType superior = attributeType.getSuperior();
if ( superior == null )
{
- entry.put( M_SUP_ATTRIBUTE_TYPE_AT, "top" );
+ entry.put( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT, "top" );
}
else
{
@@ -270,7 +211,7 @@
{
sup = superior.getOid();
}
- entry.put( M_SUP_ATTRIBUTE_TYPE_AT, sup );
+ entry.put( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT, sup );
}
if ( attributeType.getEquality() != null )
@@ -282,7 +223,7 @@
equality = attributeType.getEquality().getOid();
}
- entry.put( M_EQUALITY_AT, equality );
+ entry.put( MetaSchemaConstants.M_EQUALITY_AT, equality );
}
if ( attributeType.getSubstr() != null )
@@ -294,7 +235,7 @@
substr = attributeType.getSubstr().getOid();
}
- entry.put( M_SUBSTR_AT, substr );
+ entry.put( MetaSchemaConstants.M_SUBSTR_AT, substr );
}
if ( attributeType.getOrdering() != null )
@@ -306,7 +247,7 @@
ordering = attributeType.getOrdering().getOid();
}
- entry.put( M_ORDERING_AT, ordering );
+ entry.put( MetaSchemaConstants.M_ORDERING_AT, ordering );
}
return entry;
@@ -334,16 +275,16 @@
*/
public Attributes getAttributes( ObjectClass objectClass ) throws NamingException
{
- BasicAttributes entry = new BasicAttributes( OBJECT_CLASS_AT, "top", true );
- entry.get( OBJECT_CLASS_AT ).add( META_OBJECT_CLASS_OC );
- entry.put( M_TYPE_OBJECT_CLASS_AT, objectClass.getType().toString() );
+ BasicAttributes entry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "top", true );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_OBJECT_CLASS_OC );
+ entry.put( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT, objectClass.getType().toString() );
injectCommon( objectClass, entry );
// handle the superior objectClasses
if ( objectClass.getSuperClasses() != null && objectClass.getSuperClasses().length != 0 )
{
- Attribute attr = new BasicAttribute( M_SUP_OBJECT_CLASS_AT );
+ Attribute attr = new BasicAttribute( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
for ( ObjectClass superClass: objectClass.getSuperClasses() )
{
attr.add( getNameOrNumericoid( superClass ) );
@@ -354,7 +295,7 @@
// add the must list
if ( objectClass.getMustList() != null && objectClass.getMustList().length != 0 )
{
- Attribute attr = new BasicAttribute( M_MUST_AT );
+ Attribute attr = new BasicAttribute( MetaSchemaConstants.M_MUST_AT );
for ( AttributeType mustAttribute: objectClass.getMustList() )
{
attr.add( getNameOrNumericoid( mustAttribute ) );
@@ -365,7 +306,7 @@
// add the may list
if ( objectClass.getMayList() != null && objectClass.getMayList().length != 0 )
{
- Attribute attr = new BasicAttribute( M_MAY_AT );
+ Attribute attr = new BasicAttribute( MetaSchemaConstants.M_MAY_AT );
for ( AttributeType mayAttribute: objectClass.getMayList() )
{
attr.add( getNameOrNumericoid( mayAttribute ) );
@@ -392,12 +333,12 @@
private final void injectCommon( SchemaObject object, Attributes entry )
{
injectNames( object.getNames(), entry );
- entry.put( M_OBSOLETE_AT, getBoolean( object.isObsolete() ) );
- entry.put( M_OID_AT, object.getOid() );
+ entry.put( MetaSchemaConstants.M_OBSOLETE_AT, getBoolean( object.isObsolete() ) );
+ entry.put( MetaSchemaConstants.M_OID_AT, object.getOid() );
if ( object.getDescription() != null )
{
- entry.put( M_DESC_AT, object.getDescription() );
+ entry.put( MetaSchemaConstants.M_DESC_AT, object.getDescription() );
}
}
@@ -409,7 +350,7 @@
return;
}
- Attribute attr = new BasicAttribute( M_NAME_AT );
+ Attribute attr = new BasicAttribute( MetaSchemaConstants.M_NAME_AT );
for ( String name: names )
{
attr.add( name );
Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Tue Dec 19 14:48:43 2006
@@ -37,6 +37,9 @@
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
+import org.apache.directory.server.constants.CoreSchemaConstants;
+import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.partition.impl.btree.Index;
import org.apache.directory.server.core.partition.impl.btree.IndexNotFoundException;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore;
@@ -83,8 +86,6 @@
*/
public class BootstrapPlugin extends AbstractMojo
{
- private static final String M_DISABLED_AT = "m-disabled";
-
/**
* The package to put the db file entry listing info as well as the partition.
*
@@ -175,15 +176,15 @@
try
{
- LdapDN dn = new LdapDN( "ou=schema" );
+ LdapDN dn = new LdapDN( CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
if ( ! hasEntry( dn ) )
{
Attributes entry = new LockableAttributesImpl();
- entry.put( "objectClass", "top" );
- entry.get( "objectClass" ).add( "organizationalUnit" );
- entry.put( "ou", "schema" );
+ entry.put( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "organizationalUnit" );
+ entry.put( CoreSchemaConstants.OU_AT, "schema" );
store.add( dn, entry );
}
@@ -274,11 +275,11 @@
String schemaName = attributeTypeRegistry.getSchemaName( at.getOid() );
getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( at ) );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=attributeTypes" );
+ dn.add( CoreSchemaConstants.OU_AT + "=attributeTypes" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( at );
- dn.add( "m-oid=" + at.getOid() );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + at.getOid() );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -301,11 +302,11 @@
String schemaName = objectClassRegistry.getSchemaName( oc.getOid() );
getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( oc ) );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=objectClasses" );
+ dn.add( CoreSchemaConstants.OU_AT + "=objectClasses" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( oc );
- dn.add( "m-oid=" + oc.getOid() );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + oc.getOid() );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -328,11 +329,11 @@
String schemaName = matchingRuleRegistry.getSchemaName( mr.getOid() );
getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( mr ) );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=matchingRules" );
+ dn.add( CoreSchemaConstants.OU_AT + "=matchingRules" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( mr );
- dn.add( "m-oid=" + mr.getOid() );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + mr.getOid() );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -355,11 +356,11 @@
String schemaName = comparatorRegistry.getSchemaName( oid );
getLog().info( "\t\t o [" + schemaName + "] - " + oid );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=comparators" );
+ dn.add( CoreSchemaConstants.OU_AT + "=comparators" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( oid, comparatorRegistry.lookup( oid ) );
- dn.add( "m-oid=" + oid );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + oid );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -382,11 +383,11 @@
String schemaName = normalizerRegistry.getSchemaName( oid );
getLog().info( "\t\t o [" + schemaName + "] - " + oid );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=normalizers" );
+ dn.add( CoreSchemaConstants.OU_AT + "=normalizers" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( oid, normalizerRegistry.lookup( oid ) );
- dn.add( "m-oid=" + oid );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + oid );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -409,11 +410,11 @@
String schemaName = syntaxRegistry.getSchemaName( syntax.getOid() );
getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( syntax ) );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=syntaxes" );
+ dn.add( CoreSchemaConstants.OU_AT + "=syntaxes" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( syntax );
- dn.add( "m-oid=" + syntax.getOid() );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + syntax.getOid() );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -436,11 +437,11 @@
String schemaName = syntaxCheckerRegistry.getSchemaName( syntaxChecker.getSyntaxOid() );
getLog().info( "\t\t o [" + schemaName + "] - " + syntaxChecker.getSyntaxOid() );
LdapDN dn = checkCreateSchema( schemaName );
- dn.add( "ou=syntaxCheckers" );
+ dn.add( CoreSchemaConstants.OU_AT + "=syntaxCheckers" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
checkCreateContainer( dn );
Attributes entry = attributesFactory.getAttributes( syntaxChecker );
- dn.add( "m-oid=" + syntaxChecker.getSyntaxOid() );
+ dn.add( MetaSchemaConstants.M_OID_AT + "=" + syntaxChecker.getSyntaxOid() );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
store.add( dn, entry );
}
@@ -462,7 +463,7 @@
storeConfig.setEnableOptimizer( false );
storeConfig.setName( "schema" );
storeConfig.setOidRegistry( registries.getOidRegistry() );
- storeConfig.setSuffixDn( "ou=schema" );
+ storeConfig.setSuffixDn( CoreSchemaConstants.OU_AT + "=schema" );
storeConfig.setSyncOnWrite( false );
storeConfig.setWorkingDirectory( workingDirectory );
@@ -474,8 +475,8 @@
}
storeConfig.setIndexedAttributes( indexSet );
- BasicAttributes rootEntry = new BasicAttributes( "objectClass", "organizationalUnit", true );
- rootEntry.put( "ou", "schema" );
+ BasicAttributes rootEntry = new BasicAttributes( SystemSchemaConstants.OBJECT_CLASS_AT, "organizationalUnit", true );
+ rootEntry.put( CoreSchemaConstants.OU_AT, "schema" );
storeConfig.setContextEntry( rootEntry );
try
@@ -572,9 +573,9 @@
}
Attributes entry = new LockableAttributesImpl();
- entry.put( "objectClass", "top" );
- entry.get( "objectClass" ).add( "organizationalUnit" );
- entry.put( "ou", dn.getRdn().getValue() );
+ entry.put( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "organizationalUnit" );
+ entry.put( CoreSchemaConstants.OU_AT, dn.getRdn().getValue() );
store.add( dn, entry );
}
@@ -582,7 +583,8 @@
private LdapDN checkCreateSchema( String schemaName ) throws NamingException
{
Schema schema = ( Schema ) schemas.get( schemaName );
- LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "="
+ + schemaName + "," + CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
if ( hasEntry( dn ) )
@@ -598,10 +600,11 @@
private void disableSchema( String schemaName ) throws NamingException
{
- LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
+ LdapDN dn = new LdapDN( SystemSchemaConstants.CN_AT + "=" + schemaName
+ + "," + CoreSchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE,
- new LockableAttributeImpl( M_DISABLED_AT, "TRUE" ) );
+ new LockableAttributeImpl( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ) );
ModificationItem[] mods = new ModificationItem[] { mod };
store.modify( dn, mods );
}
Added: directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/CoreSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/CoreSchemaConstants.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/CoreSchemaConstants.java (added)
+++ directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/CoreSchemaConstants.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,34 @@
+/*
+ * 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.server.constants;
+
+/**
+ * Core schema constants used throughout the server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface CoreSchemaConstants
+{
+
+ public static final String OU_AT = "ou";
+
+}
Added: directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/MetaSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/MetaSchemaConstants.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/MetaSchemaConstants.java (added)
+++ directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/MetaSchemaConstants.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,64 @@
+/*
+ * 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.server.constants;
+
+
+/**
+ * Apache meta schema specific constants used throughout the server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface MetaSchemaConstants
+{
+ public static final Object META_SCHEMA_OC = "metaSchema";
+ public static final String META_OBJECT_CLASS_OC = "metaObjectClass";
+ public static final String META_ATTRIBUTE_TYPE_OC = "metaAttributeType";
+ public static final String META_MATCHING_RULE_OC = "metaMatchingRule";
+ public static final String META_NORMALIZER_OC = "metaNormalizer";
+ public static final String META_SYNTAX_OC = "metaSyntax";
+ public static final String META_SYNTAX_CHECKER_OC = "metaSyntaxChecker";
+ public static final String META_COMPARATOR_OC = "metaComparator";
+
+ public static final String M_SUP_OBJECT_CLASS_AT = "m-supObjectClass";
+ public static final String M_BYTECODE_AT = "m-bytecode";
+ public static final String M_FQCN_AT = "m-fqcn";
+ public static final String M_DEPENDENCIES_AT = "m-dependencies";
+ public static final String M_DISABLED_AT = "m-disabled";
+ public static final String M_OWNER_AT = "m-owner";
+ public static final String M_DESCRIPTION_AT = "m-description";
+ public static final String M_OBSOLETE_AT = "m-obsolete";
+ public static final String M_NAME_AT = "m-name";
+ public static final String M_OID_AT = "m-oid";
+ public static final String M_USAGE_AT = "m-usage";
+ public static final String M_NO_USER_MODIFICATION_AT = "m-noUserModification";
+ public static final String M_SINGLE_VALUE_AT = "m-singleValue";
+ public static final String M_COLLECTIVE_AT = "m-collective";
+ public static final String M_SUBSTR_AT = "m-substr";
+ public static final String M_SUP_ATTRIBUTE_TYPE_AT = "m-supAttributeType";
+ public static final String M_ORDERING_AT = "m-ordering";
+ public static final String M_EQUALITY_AT = "m-equality";
+ public static final String M_SYNTAX_AT = "m-syntax";
+ public static final String M_DESC_AT = "m-description";
+ public static final String M_MUST_AT = "m-must";
+ public static final String M_MAY_AT = "m-may";
+ public static final String M_TYPE_OBJECT_CLASS_AT = "m-typeObjectClass";
+ public static final String X_HUMAN_READIBLE_AT = "x-humanReadible";
+}
Added: directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java (added)
+++ directory/branches/trunks/schema/apacheds/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java Tue Dec 19 14:48:43 2006
@@ -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.server.constants;
+
+
+/**
+ * Constants for the System schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SystemSchemaConstants
+{
+
+ public static final String CN_AT = "cn";
+ public static final String OBJECT_CLASS_AT = "objectClass";
+
+}
Added: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java (added)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Tue Dec 19 14:48:43 2006
@@ -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.server.core.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+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;
+
+
+/**
+ * An AttributeType implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+class AttributeTypeImpl extends AbstractAttributeType implements MutableSchemaObject
+{
+ private static final long serialVersionUID = 1L;
+
+ private final Registries registries;
+
+ private String syntaxOid;
+ private String equalityOid;
+ private String substrOid;
+ private String orderingOid;
+ private String superiorOid;
+
+
+ public AttributeTypeImpl( String oid, Registries registries )
+ {
+ super( oid );
+ this.registries = registries;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getEquality()
+ */
+ public MatchingRule getEquality() throws NamingException
+ {
+ if ( equalityOid == null )
+ {
+ return null;
+ }
+
+ return registries.getMatchingRuleRegistry().lookup( equalityOid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getOrdering()
+ */
+ public MatchingRule getOrdering() throws NamingException
+ {
+ if ( orderingOid == null )
+ {
+ return null;
+ }
+
+ return registries.getMatchingRuleRegistry().lookup( orderingOid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSubstr()
+ */
+ public MatchingRule getSubstr() throws NamingException
+ {
+ if ( substrOid == null )
+ {
+ return null;
+ }
+
+ return registries.getMatchingRuleRegistry().lookup( substrOid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSuperior()
+ */
+ public AttributeType getSuperior() throws NamingException
+ {
+ if ( superiorOid == null )
+ {
+ return null;
+ }
+
+ return registries.getAttributeTypeRegistry().lookup( superiorOid );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.shared.ldap.schema.AttributeType#getSyntax()
+ */
+ public Syntax getSyntax() throws NamingException
+ {
+ if ( syntaxOid == null )
+ {
+ return null;
+ }
+
+ return registries.getSyntaxRegistry().lookup( syntaxOid );
+ }
+
+
+ public void setSyntaxOid( String syntaxOid )
+ {
+ this.syntaxOid = syntaxOid;
+ }
+
+
+ public void setSuperiorOid( String superiorOid )
+ {
+ this.superiorOid = superiorOid;
+ }
+
+
+ public void setEqualityOid( String equalityOid )
+ {
+ this.equalityOid = equalityOid;
+ }
+
+
+ public void setSubstrOid( String substrOid )
+ {
+ this.substrOid = substrOid;
+ }
+
+
+ public void setOrderingOid( String orderingOid )
+ {
+ this.orderingOid = orderingOid;
+ }
+
+
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+
+
+ public void setCollective( boolean collective )
+ {
+ super.setCollective( collective );
+ }
+
+
+ public void setCanUserModify( boolean canUserModify )
+ {
+ super.setCanUserModify( canUserModify );
+ }
+
+
+ public void setLength( int length )
+ {
+ super.setLength( length );
+ }
+
+
+ public void setSingleValue( boolean singleValue )
+ {
+ super.setSingleValue( singleValue );
+ }
+
+
+ public void setUsage( UsageEnum usage )
+ {
+ super.setUsage( usage );
+ }
+}
Added: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleImpl.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleImpl.java (added)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/MatchingRuleImpl.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,93 @@
+/*
+ * 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.server.core.schema;
+
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.ComparatorRegistry;
+import org.apache.directory.server.schema.registries.NormalizerRegistry;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.server.schema.registries.SyntaxRegistry;
+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;
+
+class MatchingRuleImpl extends AbstractMatchingRule implements MutableSchemaObject
+{
+ private static final long serialVersionUID = 1L;
+ private final SyntaxRegistry syntaxRegistry;
+ private final ComparatorRegistry comparatorRegistry;
+ private final NormalizerRegistry normalizerRegistry;
+ private final String syntaxOid;
+
+ /**
+ * Creates a MatchingRule using the minimal set of required information.
+ *
+ * @param oid the object identifier for this matching rule
+ */
+ protected MatchingRuleImpl( String oid, String syntaxOid, Registries registries )
+ {
+ super( oid );
+ this.syntaxOid = syntaxOid;
+ syntaxRegistry = registries.getSyntaxRegistry();
+ normalizerRegistry = registries.getNormalizerRegistry();
+ comparatorRegistry = registries.getComparatorRegistry();
+ }
+
+
+ public Syntax getSyntax() throws NamingException
+ {
+ return syntaxRegistry.lookup( syntaxOid );
+ }
+
+
+ public Comparator getComparator() throws NamingException
+ {
+ return comparatorRegistry.lookup( oid );
+ }
+
+
+ public Normalizer getNormalizer() throws NamingException
+ {
+ return normalizerRegistry.lookup( oid );
+ }
+
+
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ public void setNames( String[] names )
+ {
+ super.setNames( names );
+ }
+
+
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+}
\ No newline at end of file
Added: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java (added)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/ObjectClassImpl.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,185 @@
+/*
+ * 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.server.core.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.Registries;
+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;
+
+
+/**
+ * An ObjectClass implementation used by the server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+class ObjectClassImpl extends AbstractSchemaObject implements MutableSchemaObject, ObjectClass
+{
+ private static final long serialVersionUID = 1L;
+ private final ObjectClass[] EMPTY_OC_ARRAY = new ObjectClass[0];
+ private final String[] EMPTY_STR_ARRAY = new String[0];
+ private final AttributeType[] EMPTY_AT_ARRAY = new AttributeType[0];
+
+ private final Registries registries;
+
+ private ObjectClassTypeEnum objectClassTypeEnum;
+ private ObjectClass[] superClasses;
+ private AttributeType[] mayList = EMPTY_AT_ARRAY;
+ private AttributeType[] mustList = EMPTY_AT_ARRAY;
+ private String[] superClassOids;
+ private String[] mayListOids;
+ private String[] mustListOids;
+
+
+ protected ObjectClassImpl( String oid, Registries registries )
+ {
+ super( oid );
+ this.registries = registries;
+ }
+
+
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ public void setNames( String[] name )
+ {
+ super.setNames( names );
+ }
+
+
+ public void setObsolete( boolean obsolete )
+ {
+ super.setObsolete( obsolete );
+ }
+
+
+ public AttributeType[] getMayList() throws NamingException
+ {
+ if ( this.mayListOids == null )
+ {
+ return EMPTY_AT_ARRAY;
+ }
+
+ for ( int ii = 0; ii < mayListOids.length; ii++ )
+ {
+ mayList[ii] = registries.getAttributeTypeRegistry().lookup( mayListOids[ii] );
+ }
+
+ return mayList;
+ }
+
+
+ public void setMayListOids( String[] mayListOids )
+ {
+ if ( mayListOids == null )
+ {
+ this.mayListOids = EMPTY_STR_ARRAY;
+ this.mayList = EMPTY_AT_ARRAY;
+ }
+ else
+ {
+ this.mayListOids = mayListOids;
+ this.mayList = new AttributeType[mayListOids.length];
+ }
+ }
+
+
+ public AttributeType[] getMustList() throws NamingException
+ {
+ if ( this.mustListOids == null )
+ {
+ return EMPTY_AT_ARRAY;
+ }
+
+ for ( int ii = 0; ii < mustListOids.length; ii++ )
+ {
+ mustList[ii] = registries.getAttributeTypeRegistry().lookup( mustListOids[ii] );
+ }
+
+ return mustList;
+ }
+
+
+ public void setMustListOids( String[] mayListOids )
+ {
+ if ( mustListOids == null )
+ {
+ this.mustListOids = EMPTY_STR_ARRAY;
+ this.mustList = EMPTY_AT_ARRAY;
+ }
+ else
+ {
+ this.mustListOids = mayListOids;
+ this.mustList = new AttributeType[mayListOids.length];
+ }
+ }
+
+
+ public ObjectClass[] getSuperClasses() throws NamingException
+ {
+ if ( superClassOids == null )
+ {
+ return EMPTY_OC_ARRAY;
+ }
+
+ for ( int ii = 0; ii < superClassOids.length; ii++ )
+ {
+ superClasses[ii] = registries.getObjectClassRegistry().lookup( superClassOids[ii] );
+ }
+
+ return superClasses;
+ }
+
+
+ void setSuperClassOids( String[] superClassOids )
+ {
+ if ( superClassOids == null || superClassOids.length == 0 )
+ {
+ this.superClassOids = EMPTY_STR_ARRAY;
+ this.superClasses = EMPTY_OC_ARRAY;
+ }
+ else
+ {
+ this.superClassOids = superClassOids;
+ this.superClasses = new ObjectClass[superClassOids.length];
+ }
+ }
+
+
+ public ObjectClassTypeEnum getType()
+ {
+ return objectClassTypeEnum;
+ }
+
+
+ void setType( ObjectClassTypeEnum objectClassTypeEnum )
+ {
+ this.objectClassTypeEnum = objectClassTypeEnum;
+ }
+}
Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java (original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java Tue Dec 19 14:48:43 2006
@@ -56,8 +56,11 @@
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
@@ -107,7 +110,7 @@
{
throw new NotImplementedException();
}
-
+
public Map<String,Schema> getSchemas() throws NamingException
{
@@ -122,7 +125,7 @@
return schemas;
}
-
+
public Set<String> getSchemaNames() throws NamingException
{
@@ -145,6 +148,7 @@
ExprNode filter = new SimpleNode( oidRegistry.getOid( "objectClass" ), "metaSchema", SimpleNode.EQUALITY );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+
return partition.search( base, new HashMap(), filter, searchControls );
}
@@ -167,6 +171,7 @@
{
HashMap<String,Schema> notLoaded = new HashMap<String,Schema>();
Iterator<Schema> list = schemas.iterator();
+
while ( list.hasNext() )
{
Schema schema = list.next();
@@ -189,6 +194,7 @@
{
return;
}
+
loadComparators( schema, registries.getComparatorRegistry() );
loadNormalizers( schema, registries.getNormalizerRegistry() );
@@ -208,6 +214,7 @@
loadDitStructureRules( schema, registries.getDitStructureRuleRegistry() );
+
notifyListenerOrRegistries( schema, registries );
}
@@ -252,6 +259,8 @@
while ( list.hasMore() )
{
SearchResult result = ( SearchResult ) list.next();
+ ObjectClass oc = factory.getObjectClass( result.getAttributes() );
+ registry.register( schema.getSchemaName(), oc );
}
}
@@ -270,6 +279,8 @@
while ( list.hasMore() )
{
SearchResult result = ( SearchResult ) list.next();
+ AttributeType at = factory.getAttributeType( result.getAttributes() );
+ registry.register( schema.getSchemaName(), at );
}
}
@@ -288,6 +299,9 @@
while ( list.hasMore() )
{
SearchResult result = ( SearchResult ) list.next();
+ MatchingRule mrule = factory.getMatchingRule( result.getAttributes() );
+ registry.register( schema.getSchemaName(), mrule );
+
}
}
Modified: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java (original)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java Tue Dec 19 14:48:43 2006
@@ -21,24 +21,24 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
+import org.apache.directory.server.constants.MetaSchemaConstants;
+import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
-import org.apache.directory.shared.ldap.schema.AbstractSyntax;
-import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.*;
import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
-
/**
* Showing how it's done ...
*
@@ -49,8 +49,7 @@
{
/** Used for looking up the setRegistries(Registries) method */
private final static Class[] parameterTypes = new Class[] { Registries.class };
-
- private static final String[] NONE = new String[0];
+ private static final String[] EMPTY = new String[0];
/** Used for dependency injection of Registries via setter into schema objects */
private final Registries registries;
@@ -69,7 +68,7 @@
{
String name;
String owner;
- String[] dependencies = NONE;
+ String[] dependencies = EMPTY;
boolean isDisabled = false;
if ( entry == null )
@@ -77,34 +76,35 @@
throw new NullPointerException( "entry cannot be null" );
}
- if ( entry.get( "cn" ) == null )
+ if ( entry.get( SystemSchemaConstants.CN_AT ) == null )
{
throw new NullPointerException( "entry must have a valid cn attribute" );
}
- name = ( String ) entry.get( "cn" ).get();
+ name = ( String ) entry.get( SystemSchemaConstants.CN_AT ).get();
- if ( entry.get( "m-owner" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_OWNER_AT ) == null )
{
- throw new NullPointerException( "entry must have a valid m-owner attribute" );
+ throw new NullPointerException( "entry must have a valid "
+ + MetaSchemaConstants.M_OWNER_AT + " attribute" );
}
- owner = ( String ) entry.get( "m-owner" ).get();
+ owner = ( String ) entry.get( MetaSchemaConstants.M_OWNER_AT ).get();
- if ( entry.get( "m-disabled" ) != null )
+ if ( entry.get( MetaSchemaConstants.M_DISABLED_AT ) != null )
{
- String value = ( String ) entry.get( "m-disabled" ).get();
+ String value = ( String ) entry.get( MetaSchemaConstants.M_DISABLED_AT ).get();
value = value.toUpperCase();
isDisabled = value.equals( "TRUE" );
}
- if ( entry.get( "m-dependencies" ) != null )
+ if ( entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ) != null )
{
Set<String> depsSet = new HashSet<String>();
- Attribute depsAttr = entry.get( "m-dependencies" );
+ Attribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT );
for ( int ii = 0; ii < depsAttr.size(); ii++ )
{
depsSet.add( ( String ) depsAttr.get( ii ) );
}
- dependencies = depsSet.toArray( NONE );
+ dependencies = depsSet.toArray( EMPTY );
}
return new AbstractSchema( name, owner, dependencies, isDisabled ){};
@@ -125,16 +125,17 @@
throw new NullPointerException( "entry cannot be null" );
}
- if ( entry.get( "m-fqcn" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_FQCN_AT ) == null )
{
- throw new NullPointerException( "entry must have a valid m-fqcn attribute" );
+ throw new NullPointerException( "entry must have a valid "
+ + MetaSchemaConstants.M_FQCN_AT + " attribute" );
}
- String className = ( String ) entry.get( "m-fqcn" ).get();
+ String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
SyntaxChecker syntaxChecker = null;
Class clazz = null;
- if ( entry.get( "m-bytecode" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_BYTECODE_AT ) == null )
{
try
{
@@ -213,16 +214,17 @@
throw new NullPointerException( "entry cannot be null" );
}
- if ( entry.get( "m-fqcn" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_FQCN_AT ) == null )
{
- throw new NullPointerException( "entry must have a valid m-fqcn attribute" );
+ throw new NullPointerException( "entry must have a valid "
+ + MetaSchemaConstants.M_FQCN_AT + " attribute" );
}
- String className = ( String ) entry.get( "m-fqcn" ).get();
+ String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
Comparator comparator = null;
Class clazz = null;
- if ( entry.get( "m-bytecode" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_BYTECODE_AT ) == null )
{
try
{
@@ -301,16 +303,17 @@
throw new NullPointerException( "entry cannot be null" );
}
- if ( entry.get( "m-fqcn" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_FQCN_AT ) == null )
{
- throw new NullPointerException( "entry must have a valid m-fqcn attribute" );
+ throw new NullPointerException( "entry must have a valid "
+ + MetaSchemaConstants.M_FQCN_AT + " attribute" );
}
- String className = ( String ) entry.get( "m-fqcn" ).get();
+ String className = ( String ) entry.get( MetaSchemaConstants.M_FQCN_AT ).get();
Normalizer normalizer = null;
Class clazz = null;
- if ( entry.get( "m-bytecode" ) == null )
+ if ( entry.get( MetaSchemaConstants.M_BYTECODE_AT ) == null )
{
try
{
@@ -438,48 +441,165 @@
public Syntax getSyntax( Attributes entry ) throws NamingException
{
- String oid = ( String ) entry.get( "m-oid" ).get();
- boolean isHumanReadible = false;
- String description = null;
+ String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+ SyntaxImpl syntax = new SyntaxImpl( oid, registries.getSyntaxCheckerRegistry() );
- if ( entry.get( "x-humanReadible" ) != null )
+ if ( entry.get( MetaSchemaConstants.X_HUMAN_READIBLE_AT ) != null )
{
- String val = ( String ) entry.get( "x-humanReadible" ).get();
- isHumanReadible = val.toUpperCase().equals( "TRUE" );
+ String val = ( String ) entry.get( MetaSchemaConstants.X_HUMAN_READIBLE_AT ).get();
+ syntax.setHumanReadible( val.toUpperCase().equals( "TRUE" ) );
}
- if ( entry.get( "m-description" ) != null )
+ if ( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ) != null )
{
- description = ( String ) entry.get( "m-description" ).get();
- return new SyntaxImpl( oid, description, isHumanReadible, registries.getSyntaxCheckerRegistry() );
+ syntax.setDescription( ( String ) entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).get() );
}
- return new SyntaxImpl( oid, isHumanReadible, registries.getSyntaxCheckerRegistry() );
+
+ return syntax;
+ }
+
+
+ public MatchingRule getMatchingRule( Attributes entry ) throws NamingException
+ {
+ String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+ String syntaxOid = ( String ) entry.get( MetaSchemaConstants.M_SYNTAX_AT ).get();
+ MatchingRuleImpl mr = new MatchingRuleImpl( oid, syntaxOid, registries );
+ setSchemaObjectProperties( mr, entry );
+ return mr;
}
- class SyntaxImpl extends AbstractSyntax
+ private String[] getStrings( Attribute attr ) throws NamingException
{
- private static final long serialVersionUID = 1L;
- private final SyntaxCheckerRegistry registry;
-
+ if ( attr == null )
+ {
+ return EMPTY;
+ }
- protected SyntaxImpl( String oid, boolean isHumanReadible, SyntaxCheckerRegistry registry )
+ String[] strings = new String[attr.size()];
+ for ( int ii = 0; ii < strings.length; ii++ )
{
- super( oid, isHumanReadible );
- this.registry = registry;
+ strings[ii] = ( String ) attr.get( ii );
}
-
+ return strings;
+ }
+
+
+ public ObjectClass getObjectClass( Attributes entry ) throws NamingException
+ {
+ String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+ ObjectClassImpl oc = new ObjectClassImpl( oid, registries );
+
+ if ( entry.get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ) != null )
+ {
+ oc.setSuperClassOids( getStrings( entry.get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ) ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_MAY_AT ) != null )
+ {
+ oc.setMayListOids( getStrings( entry.get( MetaSchemaConstants.M_MAY_AT ) ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_MUST_AT ) != null )
+ {
+ oc.setMustListOids( getStrings( entry.get( MetaSchemaConstants.M_MUST_AT ) ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ) != null )
+ {
+ String type = ( String ) entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ).get();
+ oc.setType( ObjectClassTypeEnum.getClassType( type ) );
+ }
+ else
+ {
+ oc.setType( ObjectClassTypeEnum.STRUCTURAL );
+ }
+
+ setSchemaObjectProperties( oc, entry );
+
+ return oc;
+ }
+
+
+ public AttributeType getAttributeType( Attributes entry ) throws NamingException
+ {
+ String oid = ( String ) entry.get( MetaSchemaConstants.M_OID_AT ).get();
+ AttributeTypeImpl at = new AttributeTypeImpl( oid, registries );
- protected SyntaxImpl( String oid, String description, boolean isHumanReadible, SyntaxCheckerRegistry registry )
+ if ( entry.get( MetaSchemaConstants.M_SYNTAX_AT ) != null )
{
- super( oid, description, isHumanReadible );
- this.registry = registry;
+ at.setSyntaxOid( ( String ) entry.get( MetaSchemaConstants.M_SYNTAX_AT ).get() );
}
+
+ if ( entry.get( MetaSchemaConstants.M_EQUALITY_AT ) != null )
+ {
+ at.setEqualityOid( ( String ) entry.get( MetaSchemaConstants.M_EQUALITY_AT ).get() );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_ORDERING_AT ) != null )
+ {
+ at.setOrderingOid( ( String ) entry.get( MetaSchemaConstants.M_ORDERING_AT ).get() );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_SUBSTR_AT ) != null )
+ {
+ at.setSubstrOid( ( String ) entry.get( MetaSchemaConstants.M_SUBSTR_AT ).get() );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ) != null )
+ {
+ at.setSuperiorOid( ( String ) entry.get( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT ).get() );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ) != null )
+ {
+ String val = ( String ) entry.get( MetaSchemaConstants.M_COLLECTIVE_AT ).get();
+ at.setCollective( val.equalsIgnoreCase( "TRUE" ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ) != null )
+ {
+ String val = ( String ) entry.get( MetaSchemaConstants.M_SINGLE_VALUE_AT ).get();
+ at.setSingleValue( val.equalsIgnoreCase( "TRUE" ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ) != null )
+ {
+ String val = ( String ) entry.get( MetaSchemaConstants.M_NO_USER_MODIFICATION_AT ).get();
+ at.setCanUserModify( val.equalsIgnoreCase( "TRUE" ) );
+ }
+
+ if ( entry.get( MetaSchemaConstants.M_USAGE_AT ) != null )
+ {
+ at.setUsage( UsageEnum.getUsage( ( String ) entry.get( MetaSchemaConstants.M_USAGE_AT ).get() ) );
+ }
+
+ return at;
+ }
+
+ private void setSchemaObjectProperties( MutableSchemaObject mso, Attributes entry ) throws NamingException
+ {
+ if ( entry.get( MetaSchemaConstants.M_OBSOLETE_AT ) != null )
+ {
+ String val = ( String ) entry.get( MetaSchemaConstants.M_OBSOLETE_AT ).get();
+ mso.setObsolete( val.equalsIgnoreCase( "TRUE" ) );
+ }
- public SyntaxChecker getSyntaxChecker() throws NamingException
+ if ( entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ) != null )
+ {
+ mso.setDescription( ( String ) entry.get( MetaSchemaConstants.M_DESCRIPTION_AT ).get() );
+ }
+
+ Attribute names = entry.get( MetaSchemaConstants.M_NAME_AT );
+ if ( names != null )
{
- return registry.lookup( oid );
+ List<String> values = new ArrayList<String>();
+ for ( int ii = 0; ii < names.size(); ii++ )
+ {
+ values.add( ( String ) names.get( ii ) );
+ }
+ mso.setNames( values.toArray( EMPTY ) );
}
}
}
Added: directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java (added)
+++ directory/branches/trunks/schema/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SyntaxImpl.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,59 @@
+/*
+ * 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.server.core.schema;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
+import org.apache.directory.shared.ldap.schema.AbstractSyntax;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
+
+
+class SyntaxImpl extends AbstractSyntax
+{
+ private static final long serialVersionUID = 1L;
+ private final SyntaxCheckerRegistry registry;
+
+
+ protected SyntaxImpl( String oid, SyntaxCheckerRegistry registry )
+ {
+ super( oid );
+ this.registry = registry;
+ }
+
+
+ public SyntaxChecker getSyntaxChecker() throws NamingException
+ {
+ return registry.lookup( oid );
+ }
+
+
+ public void setDescription( String description )
+ {
+ super.setDescription( description );
+ }
+
+
+ public void setHumanReadible( boolean humanReadible )
+ {
+ super.setHumanReadible( humanReadible );
+ }
+}
\ No newline at end of file
Propchange: directory/branches/trunks/schema/apacheds/mitosis/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec 19 14:48:43 2006
@@ -1,4 +1,4 @@
-
+*.iml
target
.classpath
.project
Propchange: directory/branches/trunks/schema/daemon/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec 19 14:48:43 2006
@@ -1 +1,2 @@
workspace
+*.iml
Modified: directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java (original)
+++ directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java Tue Dec 19 14:48:43 2006
@@ -62,7 +62,7 @@
* @param oid
* the IANA OID number for the attributeType
*/
- protected AbstractAttributeType(String oid)
+ protected AbstractAttributeType( String oid )
{
super( oid );
}
Modified: directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractMatchingRule.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractMatchingRule.java?view=diff&rev=488843&r1=488842&r2=488843
==============================================================================
--- directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractMatchingRule.java (original)
+++ directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractMatchingRule.java Tue Dec 19 14:48:43 2006
@@ -36,10 +36,9 @@
/**
* Creates a MatchingRule using the minimal set of required information.
*
- * @param oid
- * the object identifier for this matching rule
+ * @param oid the object identifier for this matching rule
*/
- protected AbstractMatchingRule(String oid)
+ protected AbstractMatchingRule( String oid )
{
super( oid );
}
Added: directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MutableSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MutableSchemaObject.java?view=auto&rev=488843
==============================================================================
--- directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MutableSchemaObject.java (added)
+++ directory/branches/trunks/schema/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MutableSchemaObject.java Tue Dec 19 14:48:43 2006
@@ -0,0 +1,33 @@
+/*
+ * 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.shared.ldap.schema;
+
+/**
+ * A mutable version of the SchemaObject interface.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface MutableSchemaObject extends SchemaObject
+{
+ void setObsolete( boolean obsolete );
+ void setDescription( String description );
+ void setNames( String[] name );
+}