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 2003/12/14 22:25:34 UTC
svn commit: rev 1425 - incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema
Author: akarasulu
Date: Sun Dec 14 13:25:33 2003
New Revision: 1425
Modified:
incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/DescriptionUtils.java
incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/NameForm.java
incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/ObjectClass.java
incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/StructureRule.java
incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/Syntax.java
Log:
completed all getDescriptions()
Modified: incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/DescriptionUtils.java
==============================================================================
--- incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/DescriptionUtils.java (original)
+++ incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/DescriptionUtils.java Sun Dec 14 13:25:33 2003
@@ -50,9 +50,6 @@
package org.apache.eve.schema ;
-import org.apache.commons.lang.NotImplementedException ;
-
-
/**
* Utility class used to generate schema object specifications.
*
@@ -85,11 +82,10 @@
* @param a_type the attributeType to generate a description for
* @return the AttributeTypeDescription Syntax for the attributeType in a
* pretty formated string
- * @todo Implement me!
*/
public String getDescription( AttributeType a_type )
{
- StringBuffer l_buf = new StringBuffer( "(\n" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
l_buf.append( a_type.getOid() ).append( '\n' ) ;
l_buf.append( "NAME " ) ;
@@ -145,7 +141,7 @@
}
l_buf.append( "USAGE " ) ;
- l_buf.append( a_type.getUsage().getName() ).append( '\n' ) ;
+ l_buf.append( a_type.getUsage().getName() ).append( " ) " ) ;
return l_buf.toString() ;
}
@@ -170,12 +166,73 @@
* @param a_crule the DIT content rule specification
* @return the specification according to the DITContentRuleDescription
* syntax
- * @todo Implement me!
*/
public String getDescription( ContentRule a_crule )
{
- throw new NotImplementedException(
- "DITContentRuleDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_crule.getOid() ).append( '\n' ) ;
+
+ l_buf.append( "NAME " ) ;
+ l_buf.append( a_crule.getName() ).append( '\n' ) ;
+
+ if ( a_crule.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_crule.getDescription() ).append( '\n' ) ;
+ }
+
+ if ( a_crule.isObsolete() )
+ {
+ l_buf.append( "OBSOLETE" ).append( '\n' ) ;
+ }
+
+ // print out all the auxillary object class oids
+ ObjectClass [] l_aux = a_crule.getAuxObjectClasses() ;
+ if ( l_aux != null && l_aux.length > 0 )
+ {
+ l_buf.append( "AUX\n" ) ;
+ for ( int ii = 0; ii < l_aux.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_aux[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ AttributeType [] l_must = a_crule.getMustNames() ;
+ if ( l_must != null && l_must.length > 0 )
+ {
+ l_buf.append( "MUST\n" ) ;
+ for ( int ii = 0; ii < l_must.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_must[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ AttributeType [] l_may = a_crule.getMayNames() ;
+ if ( l_may != null && l_may.length > 0 )
+ {
+ l_buf.append( "MAY\n" ) ;
+ for ( int ii = 0; ii < l_may.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_may[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ AttributeType [] l_not = a_crule.getNotNames() ;
+ if ( l_not != null && l_not.length > 0 )
+ {
+ l_buf.append( "NOT\n" ) ;
+ for ( int ii = 0; ii < l_not.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_not[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ l_buf.append( " )" ) ;
+ return l_buf.toString() ;
}
@@ -193,12 +250,29 @@
* </pre>
* @param a_mrule the MatchingRule to generate the description for
* @return the MatchingRuleDescription string
- * @todo Implement me!
*/
public String getDescription( MatchingRule a_mrule )
{
- throw new NotImplementedException(
- "MatchingRuleDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_mrule.getOid() ).append( '\n' ) ;
+
+ l_buf.append( "NAME " ) ;
+ l_buf.append( a_mrule.getName() ).append( '\n' ) ;
+
+ if ( a_mrule.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_mrule.getDescription() ).append( '\n' ) ;
+ }
+
+ if ( a_mrule.isObsolete() )
+ {
+ l_buf.append( "OBSOLETE" ).append( '\n' ) ;
+ }
+
+ l_buf.append( "SYNTAX " ).append( a_mrule.getSyntax().getOid() ) ;
+ l_buf.append( " ) " ) ;
+ return l_buf.toString() ;
}
@@ -218,11 +292,50 @@
*</pre>
* @param a_nameForm the NameForm to generate the description for
* @return the NameFormDescription string
- * @todo Implement me!
*/
public String getDescription( NameForm a_nameForm )
{
- throw new NotImplementedException( "NameFormDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_nameForm.getOid() ).append( '\n' ) ;
+
+ l_buf.append( "NAME " ) ;
+ l_buf.append( a_nameForm.getName() ).append( '\n' ) ;
+
+ if ( a_nameForm.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_nameForm.getDescription() ).append( '\n' ) ;
+ }
+
+ if ( a_nameForm.isObsolete() )
+ {
+ l_buf.append( "OBSOLETE" ).append( '\n' ) ;
+ }
+
+ l_buf.append( "OC " ) ;
+ l_buf.append( a_nameForm.getObjectClass().getOid() ).append( '\n' ) ;
+
+ l_buf.append( "MUST\n" ) ;
+ AttributeType[] l_must = a_nameForm.getMustUse() ;
+ for ( int ii = 0; ii < l_must.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_must[ii].getOid() ).append( '\n' ) ;
+ }
+
+ AttributeType[] l_may = a_nameForm.getMaytUse() ;
+ if ( l_may != null && l_may.length > 0 )
+ {
+ l_buf.append( "MAY\n" ) ;
+ for ( int ii = 0; ii < l_must.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_may[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ l_buf.append( " )" ) ;
+ return l_buf.toString() ;
}
@@ -247,7 +360,63 @@
*/
public String getDescription( ObjectClass a_objectClass )
{
- throw new NotImplementedException( "ObjectClassDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_objectClass.getOid() ).append( '\n' ) ;
+
+ l_buf.append( "NAME " ) ;
+ l_buf.append( a_objectClass.getName() ).append( '\n' ) ;
+
+ if ( a_objectClass.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_objectClass.getDescription() ).append( '\n' ) ;
+ }
+
+ if ( a_objectClass.isObsolete() )
+ {
+ l_buf.append( "OBSOLETE" ).append( '\n' ) ;
+ }
+
+ ObjectClass [] l_sups = a_objectClass.getSuperClasses() ;
+ if ( l_sups != null && l_sups.length > 0 )
+ {
+ l_buf.append( "SUP\n" ) ;
+ for ( int ii = 0; ii < l_sups.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_sups[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ if ( a_objectClass.getType() != null )
+ {
+ l_buf.append( a_objectClass.getType().getName() ).append( '\n' ) ;
+ }
+
+ AttributeType [] l_must = a_objectClass.getMustList() ;
+ if ( l_must != null && l_must.length > 0 )
+ {
+ l_buf.append( "MUST\n" ) ;
+ for ( int ii = 0; ii < l_must.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_must[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ AttributeType [] l_may = a_objectClass.getMayList() ;
+ if ( l_may != null && l_may.length > 0 )
+ {
+ l_buf.append( "MAY\n" ) ;
+ for ( int ii = 0; ii < l_may.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_may[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ l_buf.append( " )" ) ;
+ return l_buf.toString() ;
}
@@ -269,7 +438,39 @@
*/
public String getDescription( StructureRule a_srule )
{
- throw new NotImplementedException( "ObjectClassDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_srule.getOid() ).append( '\n' ) ;
+
+ l_buf.append( "NAME " ) ;
+ l_buf.append( a_srule.getName() ).append( '\n' ) ;
+
+ if ( a_srule.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_srule.getDescription() ).append( '\n' ) ;
+ }
+
+ if ( a_srule.isObsolete() )
+ {
+ l_buf.append( "OBSOLETE" ).append( '\n' ) ;
+ }
+
+ l_buf.append( "FORM " ) ;
+ l_buf.append( a_srule.getNameForm().getOid() ).append( '\n' ) ;
+
+ StructureRule [] l_sups = a_srule.getSuperClasses() ;
+ if ( l_sups != null && l_sups.length > 0 )
+ {
+ l_buf.append( "SUP\n" ) ;
+ for ( int ii = 0; ii < l_sups.length; ii++ )
+ {
+ l_buf.append( '\t' ) ;
+ l_buf.append( l_sups[ii].getOid() ).append( '\n' ) ;
+ }
+ }
+
+ l_buf.append( " )" ) ;
+ return l_buf.toString() ;
}
@@ -280,14 +481,23 @@
* SyntaxDescription = "(" whsp
* numericoid whsp
* [ "DESC" qdstring ]
- * whsp ")"
- * "(" whsp numericoid whsp [ "DESC" qdstring ] whsp ")"
+ * whsp ")"
* </pre>
* @param a_syntax the Syntax to generate a description for
* @return the description in the SyntaxDescription syntax
*/
public String getDescription( Syntax a_syntax )
{
- throw new NotImplementedException( "SyntaxDescription Syntax" ) ;
+ StringBuffer l_buf = new StringBuffer( "( " ) ;
+ l_buf.append( a_syntax.getOid() ).append( '\n' ) ;
+
+ if ( a_syntax.getDescription() != null )
+ {
+ l_buf.append( "DESC " ) ;
+ l_buf.append( a_syntax.getDescription() ).append( '\n' ) ;
+ }
+
+ l_buf.append( " )" ) ;
+ return l_buf.toString() ;
}
}
Modified: incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/NameForm.java
==============================================================================
--- incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/NameForm.java (original)
+++ incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/NameForm.java Sun Dec 14 13:25:33 2003
@@ -101,10 +101,20 @@
ObjectClass getObjectClass() ;
/**
+ * Gets all the AttributeTypes of the attributes this NameForm specifies as
+ * having to be used in the given objectClass for naming: as part of the
+ * Rdn.
+ *
+ * @return the AttributeTypes of the must use attributes
+ */
+ AttributeType [] getMustUse() ;
+
+ /**
* Gets all the AttributeTypes of the attribute this NameForm specifies as
- * useable in the given objectClass for naming: as part of the Rdn.
+ * being useable without requirement in the given objectClass for naming:
+ * as part of the Rdn.
*
- * @return the AttributeTypes of the attributes
+ * @return the AttributeTypes of the may use attributes
*/
- AttributeType [] getNames() ;
+ AttributeType [] getMaytUse() ;
}
Modified: incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/ObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/ObjectClass.java (original)
+++ incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/ObjectClass.java Sun Dec 14 13:25:33 2003
@@ -83,6 +83,13 @@
String getName() ;
/**
+ * Gets whether or not this NameForm is obsolete.
+ *
+ * @return true if obsolete, false if not.
+ */
+ boolean isObsolete() ;
+
+ /**
* Gets the superclasses of this ObjectClass.
*
* @return the superclasses
Modified: incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/StructureRule.java
==============================================================================
--- incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/StructureRule.java (original)
+++ incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/StructureRule.java Sun Dec 14 13:25:33 2003
@@ -104,18 +104,11 @@
NameForm getNameForm() ;
/**
- * Gets the superior StructureRule of this StructureRule.
- *
- * @return StructureRule superior to this StructureRule
- */
- StructureRule getSuperClass() ;
-
- /**
* Gets a collection of all the superior StructureRules. The difference
* with getSuperClass is this method will resolve the entire superior
* class chain.
*
* @return the chain of StructureRules
*/
- StructureRule [] getSuperClassChain() ;
+ StructureRule [] getSuperClasses() ;
}
Modified: incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/Syntax.java
==============================================================================
--- incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/Syntax.java (original)
+++ incubator/directory/ldap/trunk/eve/backend/schema/api/src/java/org/apache/eve/schema/Syntax.java Sun Dec 14 13:25:33 2003
@@ -79,7 +79,7 @@
*
* @return a description
*/
- String getDesc() ;
+ String getDescription() ;
/**
* Gets a short descriptive name for the Syntax.