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 2004/09/29 06:09:58 UTC
svn commit: rev 47453 - incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema
Author: akarasulu
Date: Tue Sep 28 21:09:58 2004
New Revision: 47453
Added:
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java
- copied, changed from rev 47436, incubator/directory/eve/trunk/backend/sandbox/schema-api/src/java/org/apache/ldap/server/schema/objectclass/ObjectClassImpl.java
Modified:
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
Log:
Commit changes ...
o added an ObjectClass implementation
o changed ObjectClass interfaces to use a List although arrays would have
been fine - at the end of the day we still waste the same amount of energy
because the backing store is an ArrayList anyway
o fixed places that were expecting an array rather than a List
Notes ...
o might want to change the DefaultXxxxxx classes here into BaseXxxxxx
or AbstractXxxxxx
o also lets watch and see if the switch to using Lists verses arrays are worth
it to us
Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java (original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultAttributeType.java Tue Sep 28 21:09:58 2004
@@ -71,7 +71,7 @@
// Accessor Methods for Specification Properties
// ------------------------------------------------------------------------
-
+
public String getOid()
{
return oid;
@@ -178,85 +178,85 @@
// ------------------------------------------------------------------------
- public void setOid( String oid )
+ void setOid( String oid )
{
this.oid = oid;
}
- public void setSuperior( AttributeType superior )
+ void setSuperior( AttributeType superior )
{
this.superior = superior;
}
- public void setNameList( ArrayList nameList )
+ void setNameList( ArrayList nameList )
{
this.nameList = nameList;
}
- public void setDesc( String desc )
+ void setDesc( String desc )
{
this.desc = desc;
}
- public void setEquality( MatchingRule equality )
+ void setEquality( MatchingRule equality )
{
this.equality = equality;
}
- public void setSubstr( MatchingRule substr )
+ void setSubstr( MatchingRule substr )
{
this.substr = substr;
}
- public void setOrdering( MatchingRule ordering )
+ void setOrdering( MatchingRule ordering )
{
this.ordering = ordering;
}
- public void setSyntax( Syntax syntax )
+ void setSyntax( Syntax syntax )
{
this.syntax = syntax;
}
- public void setSingleValue( boolean singleValue )
+ void setSingleValue( boolean singleValue )
{
isSingleValue = singleValue;
}
- public void setCollective( boolean collective )
+ void setCollective( boolean collective )
{
isCollective = collective;
}
- public void setCanUserModify( boolean canUserModify )
+ void setCanUserModify( boolean canUserModify )
{
this.canUserModify = canUserModify;
}
- public void setObsolete( boolean obsolete )
+ void setObsolete( boolean obsolete )
{
isObsolete = obsolete;
}
- public void setUsage( UsageEnum usage )
+ void setUsage( UsageEnum usage )
{
this.usage = usage;
}
- public void setLength( int length )
+ void setLength( int length )
{
this.length = length;
}
Copied: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java (from rev 47436, incubator/directory/eve/trunk/backend/sandbox/schema-api/src/java/org/apache/ldap/server/schema/objectclass/ObjectClassImpl.java)
==============================================================================
--- incubator/directory/eve/trunk/backend/sandbox/schema-api/src/java/org/apache/ldap/server/schema/objectclass/ObjectClassImpl.java (original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DefaultObjectClass.java Tue Sep 28 21:09:58 2004
@@ -1,245 +1,37 @@
-/*
- * Apache License
- * Version 2.0, January 2004
- * http://www.apache.org/licenses/
- *
- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- *
- * 1. Definitions.
- *
- * "License" shall mean the terms and conditions for use, reproduction,
- * and distribution as defined by Sections 1 through 9 of this document.
- *
- * "Licensor" shall mean the copyright owner or entity authorized by
- * the copyright owner that is granting the License.
- *
- * "Legal Entity" shall mean the union of the acting entity and all
- * other entities that control, are controlled by, or are under common
- * control with that entity. For the purposes of this definition,
- * "control" means (i) the power, direct or indirect, to cause the
- * direction or management of such entity, whether by contract or
- * otherwise, or (ii) ownership of fifty percent (50%) or more of the
- * outstanding shares, or (iii) beneficial ownership of such entity.
- *
- * "You" (or "Your") shall mean an individual or Legal Entity
- * exercising permissions granted by this License.
- *
- * "Source" form shall mean the preferred form for making modifications,
- * including but not limited to software source code, documentation
- * source, and configuration files.
- *
- * "Object" form shall mean any form resulting from mechanical
- * transformation or translation of a Source form, including but
- * not limited to compiled object code, generated documentation,
- * and conversions to other media types.
- *
- * "Work" shall mean the work of authorship, whether in Source or
- * Object form, made available under the License, as indicated by a
- * copyright notice that is included in or attached to the work
- * (an example is provided in the Appendix below).
- *
- * "Derivative Works" shall mean any work, whether in Source or Object
- * form, that is based on (or derived from) the Work and for which the
- * editorial revisions, annotations, elaborations, or other modifications
- * represent, as a whole, an original work of authorship. For the purposes
- * of this License, Derivative Works shall not include works that remain
- * separable from, or merely link (or bind by name) to the interfaces of,
- * the Work and Derivative Works thereof.
- *
- * "Contribution" shall mean any work of authorship, including
- * the original version of the Work and any modifications or additions
- * to that Work or Derivative Works thereof, that is intentionally
- * submitted to Licensor for inclusion in the Work by the copyright owner
- * or by an individual or Legal Entity authorized to submit on behalf of
- * the copyright owner. For the purposes of this definition, "submitted"
- * means any form of electronic, verbal, or written communication sent
- * to the Licensor or its representatives, including but not limited to
- * communication on electronic mailing lists, source code control systems,
- * and issue tracking systems that are managed by, or on behalf of, the
- * Licensor for the purpose of discussing and improving the Work, but
- * excluding communication that is conspicuously marked or otherwise
- * designated in writing by the copyright owner as "Not a Contribution."
- *
- * "Contributor" shall mean Licensor and any individual or Legal Entity
- * on behalf of whom a Contribution has been received by Licensor and
- * subsequently incorporated within the Work.
- *
- * 2. Grant of Copyright License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * copyright license to reproduce, prepare Derivative Works of,
- * publicly display, publicly perform, sublicense, and distribute the
- * Work and such Derivative Works in Source or Object form.
- *
- * 3. Grant of Patent License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * (except as stated in this section) patent license to make, have made,
- * use, offer to sell, sell, import, and otherwise transfer the Work,
- * where such license applies only to those patent claims licensable
- * by such Contributor that are necessarily infringed by their
- * Contribution(s) alone or by combination of their Contribution(s)
- * with the Work to which such Contribution(s) was submitted. If You
- * institute patent litigation against any entity (including a
- * cross-claim or counterclaim in a lawsuit) alleging that the Work
- * or a Contribution incorporated within the Work constitutes direct
- * or contributory patent infringement, then any patent licenses
- * granted to You under this License for that Work shall terminate
- * as of the date such litigation is filed.
- *
- * 4. Redistribution. You may reproduce and distribute copies of the
- * Work or Derivative Works thereof in any medium, with or without
- * modifications, and in Source or Object form, provided that You
- * meet the following conditions:
- *
- * (a) You must give any other recipients of the Work or
- * Derivative Works a copy of this License; and
- *
- * (b) You must cause any modified files to carry prominent notices
- * stating that You changed the files; and
- *
- * (c) You must retain, in the Source form of any Derivative Works
- * that You distribute, all copyright, patent, trademark, and
- * attribution notices from the Source form of the Work,
- * excluding those notices that do not pertain to any part of
- * the Derivative Works; and
- *
- * (d) If the Work includes a "NOTICE" text file as part of its
- * distribution, then any Derivative Works that You distribute must
- * include a readable copy of the attribution notices contained
- * within such NOTICE file, excluding those notices that do not
- * pertain to any part of the Derivative Works, in at least one
- * of the following places: within a NOTICE text file distributed
- * as part of the Derivative Works; within the Source form or
- * documentation, if provided along with the Derivative Works; or,
- * within a display generated by the Derivative Works, if and
- * wherever such third-party notices normally appear. The contents
- * of the NOTICE file are for informational purposes only and
- * do not modify the License. You may add Your own attribution
- * notices within Derivative Works that You distribute, alongside
- * or as an addendum to the NOTICE text from the Work, provided
- * that such additional attribution notices cannot be construed
- * as modifying the License.
- *
- * You may add Your own copyright statement to Your modifications and
- * may provide additional or different license terms and conditions
- * for use, reproduction, or distribution of Your modifications, or
- * for any such Derivative Works as a whole, provided Your use,
- * reproduction, and distribution of the Work otherwise complies with
- * the conditions stated in this License.
- *
- * 5. Submission of Contributions. Unless You explicitly state otherwise,
- * any Contribution intentionally submitted for inclusion in the Work
- * by You to the Licensor shall be under the terms and conditions of
- * this License, without any additional terms or conditions.
- * Notwithstanding the above, nothing herein shall supersede or modify
- * the terms of any separate license agreement you may have executed
- * with Licensor regarding such Contributions.
- *
- * 6. Trademarks. This License does not grant permission to use the trade
- * names, trademarks, service marks, or product names of the Licensor,
- * except as required for reasonable and customary use in describing the
- * origin of the Work and reproducing the content of the NOTICE file.
- *
- * 7. Disclaimer of Warranty. Unless required by applicable law or
- * agreed to in writing, Licensor provides the Work (and each
- * Contributor provides its Contributions) on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied, including, without limitation, any warranties or conditions
- * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- * PARTICULAR PURPOSE. You are solely responsible for determining the
- * appropriateness of using or redistributing the Work and assume any
- * risks associated with Your exercise of permissions under this License.
- *
- * 8. Limitation of Liability. In no event and under no legal theory,
- * whether in tort (including negligence), contract, or otherwise,
- * unless required by applicable law (such as deliberate and grossly
- * negligent acts) or agreed to in writing, shall any Contributor be
- * liable to You for damages, including any direct, indirect, special,
- * incidental, or consequential damages of any character arising as a
- * result of this License or out of the use or inability to use the
- * Work (including but not limited to damages for loss of goodwill,
- * work stoppage, computer failure or malfunction, or any and all
- * other commercial damages or losses), even if such Contributor
- * has been advised of the possibility of such damages.
- *
- * 9. Accepting Warranty or Additional Liability. While redistributing
- * the Work or Derivative Works thereof, You may choose to offer,
- * and charge a fee for, acceptance of support, warranty, indemnity,
- * or other liability obligations and/or rights consistent with this
- * License. However, in accepting such obligations, You may act only
- * on Your own behalf and on Your sole responsibility, not on behalf
- * of any other Contributor, and only if You agree to indemnify,
- * defend, and hold each Contributor harmless for any liability
- * incurred by, or claims asserted against, such Contributor by reason
- * of your accepting any such warranty or additional liability.
- *
- * END OF TERMS AND CONDITIONS
- *
- * APPENDIX: How to apply the Apache License to your work.
- *
- * To apply the Apache License to your work, attach the following
- * boilerplate notice, with the fields enclosed by brackets "[]"
- * replaced with your own identifying information. (Don't include
- * the brackets!) The text should be enclosed in the appropriate
- * comment syntax for the file format. We also recommend that a
- * file or class name and description of purpose be included on the
- * same "printed page" as the copyright notice for easier
- * identification within third-party archives.
- *
- * Copyright [yyyy] [name of copyright owner]
- *
- * Licensed 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.
- *
- */
-
/*
- * $Id: ObjectClassImpl.java,v 1.3 2003/09/30 01:02:37 akarasulu Exp $
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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
*
- * -- (c) LDAPd Group --
- * -- Please refer to the LICENSE.txt file in the root directory of --
- * -- any LDAPd project for copyright and distribution information. --
+ * 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.ldap.server.schema.objectclass ;
-
+package org.apache.ldap.common.schema;
-import java.util.ArrayList ;
-import java.util.Collection ;
-import javax.naming.NamingException ;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
-import org.apache.avalon.framework.configuration.Configuration ;
-import org.apache.avalon.framework.configuration.ConfigurationException ;
-
-import org.apache.ldap.server.schema.OidRegistry ;
-import org.apache.ldap.server.schema.attribute.AttributeTypeManager ;
+import java.io.Serializable;
/**
- * @todo Add the Builder
- *
* Objectclass specification bean used to store the schema information for an
- * objectclass definition. This class is generated by the schema parser and
- * populated in part by it during the schema file load phase. Other properties
- * of the bean are filled in afterwords in other phases during the
- * initialization of the schema manager.
+ * objectclass definition.
*
- * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
- * @author $Author: akarasulu $
- * @version $Revision: 1.3 $
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
*/
-public class ObjectClassImpl implements ObjectClass
+public class DefaultObjectClass implements ObjectClass, Serializable
{
// ------------------------------------------------------------------------
@@ -247,318 +39,218 @@
// ------------------------------------------------------------------------
/** */
- private ClassTypeEnum m_type = ClassTypeEnum.ABSTRACT ;
+ private ObjectClassTypeEnum type = ObjectClassTypeEnum.ABSTRACT;
+ /** */
+ private final String oid;
/** */
- private final String m_oid ;
+ private boolean isObsolete;
/** */
- private String m_desc ;
+ private String desc;
/** */
- private ArrayList m_mayList = new ArrayList() ;
+ private ArrayList mayList;
/** */
- private ArrayList m_mustList = new ArrayList() ;
+ private ArrayList mustList;
/** */
- private String m_name ;
+ private String name;
/** */
- private ArrayList m_superClasses = new ArrayList() ;
- /** Directly references other child ObjectClassSpecs */
- private ArrayList m_children = new ArrayList() ;
+ private ArrayList superClasses;
+ // ------------------------------------------------------------------------
+ // C O N S T R U C T O R S
+ // ------------------------------------------------------------------------
+
+
/**
* Creates an ObjectClassImpl instance with an OID.
*
- * @param a_oid the unique object identifier for this objectClass
+ * @param oid the unique object identifier for this objectClass
*/
- ObjectClassImpl( String a_oid )
+ DefaultObjectClass( String oid )
{
- m_oid = a_oid ;
+ this.oid = oid;
}
- /**
- * TODO Document me!
- *
- * @param a_desc TODO
- */
- void setDesc( String a_desc )
+ // ------------------------------------------------------------------------
+ // ObjectClass Methods
+ // ------------------------------------------------------------------------
+
+
+ public List getSuperClasses()
{
- m_desc = a_desc ;
+ if ( superClasses == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ return Collections.unmodifiableList( superClasses );
}
-
- /**
- * TODO Document me!
- *
- * @param a_mayList TODO
- */
- void setMayList( ArrayList a_mayList )
+
+ public ObjectClassTypeEnum getType()
{
- m_mayList = a_mayList ;
+ return type;
}
- /**
- * TODO Document me!
- *
- * @param a_mustList TODO
- */
- void setMustList( ArrayList a_mustList )
+ public List getMustList()
{
- m_mustList = a_mustList ;
+ if ( mustList == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ return Collections.unmodifiableList( mustList );
}
- /**
- * TODO Document me!
- *
- * @param a_name TODO
- */
- void setName( String a_name )
+ public List getMayList()
{
- m_name = a_name ;
+ if ( mayList == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ return Collections.unmodifiableList( mayList );
}
- /**
- * TODO Document me!
- *
- * @param a_superClasses TODO
- */
- void setSuperClasses( ArrayList a_superClasses )
+ public String getOid()
{
- m_superClasses = a_superClasses ;
+ return oid;
}
- /**
- * TODO Document me!
- *
- * @param a_type TODO
- */
- void setType( ClassTypeEnum a_type )
+ public String getName()
{
- m_type = a_type ;
+ return name;
}
- /**
- *
- * TODO Document me!
- *
- * @return TODO
- */
- public String getDesc()
+ public String getDescription()
{
- return m_desc ;
+ return desc;
}
- /**
- *
- * TODO Document me!
- *
- * @return TODO
- */
- public Collection getSuperClasses()
+ public boolean isObsolete()
{
- return m_superClasses ;
+ return isObsolete;
}
+ // ------------------------------------------------------------------------
+ // Package Friendly Mutators
+ // ------------------------------------------------------------------------
+
+
/**
- *
- * TODO Document me!
+ * Sets whether or not this is an obsoleted ObjectClass.
*
- * @return TODO
+ * @param isObsolete whether or not this is an obsoleted ObjectClass
*/
- public ClassTypeEnum getType()
+ void setObsolete( boolean isObsolete )
{
- return m_type ;
+ this.isObsolete = isObsolete;
}
/**
- *
- * TODO Document me!
+ * Sets the description for this objectClass.
*
- * @return TODO
+ * @param desc the description for this objectClass
*/
- public Collection getMustList()
+ void setDescription( String desc )
{
- return m_mustList ;
+ this.desc = desc;
}
/**
- *
- * TODO Document me!
+ * Adds a list of AttributeTypes that may be present within this
+ * ObjectClass.
*
- * @return TODO
+ * @param mayList more AttributeTypes to add to the optional attribute list
*/
- public Collection getMayList()
+ void addToMayList( List mayList )
{
- return m_mayList ;
+ if ( this.mayList == null )
+ {
+ this.mayList = new ArrayList();
+ }
+
+ this.mayList.addAll( mayList );
}
/**
- *
- * TODO Document me!
+ * Adds a list of AttributeTypes that must be present within this
+ * ObjectClass.
*
- * @return TODO
+ * @param mustList more AttributeTypes to add to the mandatory list
*/
- public String getOid()
+ void addToMustList( ArrayList mustList )
{
- return m_oid ;
+ if ( this.mustList == null )
+ {
+ this.mustList = new ArrayList();
+ }
+
+ this.mustList.addAll( mustList );
}
/**
- *
- * TODO Document me!
+ * Sets the name of this ObjectClass.
*
- * @return TODO
+ * @param name the name to set for this ObjectClass
*/
- public String getName()
+ void setName( String name )
{
- return m_name ;
+ this.name = name;
}
/**
- *
- * Document me!
+ * Adds ObjectClass to the list of super classes for this ObjectClass.
*
- * @see java.lang.Object#toString()
+ * @param superClasses the list of super classes to add to this ObjectClass
*/
- public String toString()
+ void addSuperClasses( List superClasses )
{
- return ( String ) m_name ;
+ if ( this.superClasses == null )
+ {
+ this.superClasses = new ArrayList();
+ }
+
+ this.superClasses.addAll( superClasses );
}
-
-
+
+
/**
- * Generates the objectClass description according to the description
- * syntax.
- *
- * @return the objectClass description
+ * Sets the classType for this ObjectClass.
+ *
+ * @param type the new class type enumeration for this ObjectClass
*/
- public String getObjectClassDescription()
+ void setType( ObjectClassTypeEnum type )
{
- return "null" ;
+ this.type = type;
}
-
-
+
+
+ // ------------------------------------------------------------------------
+ // Object Overrides
+ // ------------------------------------------------------------------------
+
+
/**
- * Builds objectClass specification beans from configurations and
- * attributes.
+ * Prints the name of this objectClass.
+ *
+ * @see java.lang.Object#toString()
*/
- public static class Builder
+ public String toString()
{
- /**
- * Creates an intance of the ObjectClass bean for a configuration.
- *
- * @param a_config the configuration for the objectClass
- * @param a_objectClassMgr the objectClass manager
- * @param a_attrTypeMgr an attribute type manager
- * @param a_registry the OID registry
- * @return the objectClass for the configuration
- * @throws ConfigurationException if there is a configuration problem
- */
- public static ObjectClassImpl create( Configuration a_config,
- ObjectClassManager a_objectClassMgr,
- AttributeTypeManager a_attrTypeMgr, OidRegistry a_registry )
- throws ConfigurationException
- {
- ObjectClassImpl l_objectClass = new ObjectClassImpl( a_config
- .getChild( "oid" ).getValue() ) ;
-
- l_objectClass.setDesc( a_config
- .getChild( "description" ).getValue( null ) ) ;
-
- l_objectClass.setType( ClassTypeEnum.getClassType( a_config
- .getChild( "type" ).getValue() ) ) ;
-
- l_objectClass.setName( a_config.getChild( "name" ).getValue() ) ;
-
- a_registry.register( l_objectClass.getName(), l_objectClass
- .getOid() ) ;
-
- /*
- * Resolve the superior references to their ObjectClass beans. The
- * superior definitions must be defined before descendants can
- * refer to them. Also not that because of the registry line above
- * we can rely on the registry to resolve names to oids.
- */
- Configuration [] l_sups = a_config
- .getChild( "superiors" ).getChildren() ;
- ArrayList l_list = new ArrayList() ;
- for ( int ii = 0; ii < l_sups.length; ii++ )
- {
- String l_superior = l_sups[ii].getValue() ;
-
- try
- {
- l_superior = a_registry.getOid( l_superior ) ;
- l_list.add( a_objectClassMgr.lookup( l_superior ) ) ;
- }
- catch ( NamingException e )
- {
- throw new ConfigurationException(
- "Failed to resolve and/or lookup superior objectClass '"
- + l_superior + "'", e ) ;
- }
- }
- l_objectClass.setSuperClasses( l_list ) ;
-
- /*
- * Resolve the required attributes to their AttributeType beans.
- */
- Configuration [] l_must = a_config
- .getChild( "must" ).getChildren() ;
- l_list = new ArrayList() ;
- for ( int ii = 0; ii < l_must.length; ii++ )
- {
- String l_attr = l_must[ii].getValue() ;
-
- try
- {
- l_attr = a_registry.getOid( l_attr ) ;
- l_list.add( a_attrTypeMgr.lookup( l_attr ) ) ;
- }
- catch ( NamingException e )
- {
- throw new ConfigurationException(
- "Failed to resolve and/or lookup must attributeType '"
- + l_attr + "'", e ) ;
- }
- }
- l_objectClass.setMustList( l_list ) ;
-
- /*
- * Resolve the required attributes to their AttributeType beans.
- */
- Configuration [] l_may = a_config.getChild( "may" ).getChildren() ;
- l_list = new ArrayList() ;
- for ( int ii = 0; ii < l_may.length; ii++ )
- {
- String l_attr = l_may[ii].getValue() ;
-
- try
- {
- l_attr = a_registry.getOid( l_attr ) ;
- l_list.add( a_attrTypeMgr.lookup( l_attr ) ) ;
- }
- catch ( NamingException e )
- {
- throw new ConfigurationException(
- "Failed to resolve and/or lookup may attributeType '"
- + l_attr + "'", e ) ;
- }
- }
- l_objectClass.setMayList( l_list ) ;
-
- return l_objectClass ;
- }
+ return ( String ) name;
}
}
Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java (original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/DescriptionUtils.java Tue Sep 28 21:09:58 2004
@@ -16,6 +16,8 @@
*/
package org.apache.ldap.common.schema;
+import java.util.List;
+
/**
* Utility class used to generate schema object specifications. Some of the
@@ -477,14 +479,14 @@
buf.append( '\n' );
}
- ObjectClass [] sups = objectClass.getSuperClasses();
- if ( sups != null && sups.length > 0 )
+ List sups = objectClass.getSuperClasses();
+ if ( sups != null && sups.size() > 0 )
{
buf.append( "SUP\n" );
- for ( int ii = 0; ii < sups.length; ii++ )
+ for ( int ii = 0; ii < sups.size(); ii++ )
{
buf.append( '\t' );
- buf.append( sups[ii].getOid() );
+ buf.append( ( ( ObjectClass ) sups.get( ii ) ).getOid() );
buf.append( '\n' );
}
}
@@ -495,26 +497,26 @@
buf.append( '\n' );
}
- AttributeType [] must = objectClass.getMustList();
- if ( must != null && must.length > 0 )
+ List must = objectClass.getMustList();
+ if ( must != null && must.size() > 0 )
{
buf.append( "MUST\n" );
- for ( int ii = 0; ii < must.length; ii++ )
+ for ( int ii = 0; ii < must.size(); ii++ )
{
buf.append( '\t' );
- buf.append( must[ii].getOid() );
+ buf.append( ( ( AttributeType ) must.get( ii ) ).getOid() );
buf.append( '\n' );
}
}
- AttributeType [] may = objectClass.getMayList();
- if ( may != null && may.length > 0 )
+ List may = objectClass.getMayList();
+ if ( may != null && may.size() > 0 )
{
buf.append( "MAY\n" );
- for ( int ii = 0; ii < may.length; ii++ )
+ for ( int ii = 0; ii < may.size(); ii++ )
{
buf.append( '\t' );
- buf.append( may[ii].getOid() );
+ buf.append( ( ( AttributeType ) may.get( ii ) ).getOid() );
buf.append( '\n' );
}
}
Modified: incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java
==============================================================================
--- incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java (original)
+++ incubator/directory/ldap/trunk/common/src/java/org/apache/ldap/common/schema/ObjectClass.java Tue Sep 28 21:09:58 2004
@@ -16,6 +16,9 @@
*/
package org.apache.ldap.common.schema;
+import java.util.Collection;
+import java.util.List;
+
/**
* An objectClass definition.
@@ -96,7 +99,7 @@
*
* @return the superclasses
*/
- ObjectClass [] getSuperClasses();
+ List getSuperClasses();
/**
* Gets the type of this ObjectClass as a type safe enum.
@@ -112,7 +115,7 @@
* @return the AttributeTypes of attributes that must be within entries of
* this ObjectClass
*/
- AttributeType [] getMustList();
+ List getMustList();
/**
* Gets the AttributeTypes whose attributes may be present within an entry
@@ -121,5 +124,5 @@
* @return the AttributeTypes of attributes that may be within entries of
* this ObjectClass
*/
- AttributeType [] getMayList();
+ List getMayList();
}