crafterm 2002/10/04 07:36:24
Modified: xfc/src/java/org/apache/excalibur/xfc/model RoleRef.java
Model.java
Log:
Modified Model to accept a Role reference object rather than
a Definition (RoleRef's include all Definition's for that Role).
Modified RoleRef to include a constructor that takes multiple
Definition objects to make it easier for ComponentSelector style
role fragments.
Revision Changes Path
1.2 +17 -11
jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/model/RoleRef.java
Index: RoleRef.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/model/RoleRef.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RoleRef.java 2 Oct 2002 17:32:28 -0000 1.1
+++ RoleRef.java 4 Oct 2002 14:36:24 -0000 1.2
@@ -73,7 +73,7 @@
* Creates a new <code>RoleRef</code> instance.
*
* @param role role name
- * @param definition a <code>Definition</code> instance
+ * @param definition a {@link Definition} instance
*/
public RoleRef( final String role, final Definition definition )
{
@@ -82,30 +82,36 @@
}
/**
- * Obtain the role this ref object manages
+ * Creates a new <code>RoleRef</code> instance.
*
- * @return a <code>String</code> value
+ * @param role role name
+ * @param definitions a {@link Definition} array
*/
- public String getRole()
+ public RoleRef( final String role, final Definition[] definitions )
{
- return m_role;
+ m_role = role;
+
+ for ( int i = 0; i < definitions.length; ++i )
+ {
+ m_definitions.add( definitions[i] );
+ }
}
/**
- * Add a Definition object to this ref
+ * Obtain the role this ref object manages
*
- * @param definition a <code>Definition</code> instance
+ * @return a <code>String</code> value
*/
- public void addDefinition( final Definition definition )
+ public String getRole()
{
- m_definitions.add( definition );
+ return m_role;
}
/**
* Obtain a list of all Definition objects that provide the role
* this roleref manages.
*
- * @return a <code>Definition[]</code> array
+ * @return a {@link Definition}[] array
*/
public Definition[] getProviders()
{
1.2 +8 -23
jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/model/Model.java
Index: Model.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/model/Model.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Model.java 2 Oct 2002 17:32:28 -0000 1.1
+++ Model.java 4 Oct 2002 14:36:24 -0000 1.2
@@ -50,7 +50,6 @@
package org.apache.excalibur.xfc.model;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -65,36 +64,22 @@
private final List m_definitions = new ArrayList();
/**
- * Adds a <code>Definition</code> object to the system.
- * A <code>Definition</code> contains information particular to
- * Component definition.
+ * Adds a new {@link RoleRef} object to the system. A
+ * {@link RoleRef} object contains the definition of a particular
+ * role and all {@link Definition}'s that provide it.
*
- * @param definition a <code>Definition</code> instance
+ * @param role a {@link RoleRef} instance
*/
- public void addDefinition( final Definition definition )
+ public void addRoleRef( final RoleRef role )
{
- // add a definition to the system
- String role = definition.getRole();
-
- for ( Iterator i = m_definitions.iterator(); i.hasNext(); )
- {
- RoleRef r = (RoleRef) i.next();
-
- if ( role.equals( r.getRole() ) )
- {
- r.addDefinition( definition );
- return;
- }
- }
-
- m_definitions.add( new RoleRef( role, definition ) );
+ m_definitions.add( role );
}
/**
* Obtain all definitions this Model contains, as an
* array of RoleRef objects.
*
- * @return a <code>RoleRef[]</code> array
+ * @return a {@link RoleRef}[] array
*/
public RoleRef[] getDefinitions()
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>