donaldp 2002/08/17 20:53:58
Modified: containerkit/src/java/org/apache/excalibur/containerkit/verifier
AssemblyVerifier.java
Log:
Move to ComponentEntry rather than ComponentMetaData
Revision Changes Path
1.31 +56 -52
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java
Index: AssemblyVerifier.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/AssemblyVerifier.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- AssemblyVerifier.java 18 Aug 2002 03:46:08 -0000 1.30
+++ AssemblyVerifier.java 18 Aug 2002 03:53:58 -0000 1.31
@@ -13,8 +13,8 @@
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.containerkit.factory.ComponentFactory;
-import org.apache.excalibur.containerkit.metadata.ComponentMetaData;
import org.apache.excalibur.containerkit.metadata.DependencyMetaData;
+import org.apache.excalibur.containerkit.kernel.ComponentEntry;
import org.apache.avalon.framework.info.ComponentInfo;
import org.apache.avalon.framework.info.DependencyDescriptor;
import org.apache.avalon.framework.info.ServiceDescriptor;
@@ -61,7 +61,7 @@
* @param components the Components that make up assembly
* @throws VerifyException if an error occurs
*/
- public void verifyAssembly( final ComponentMetaData[] components,
+ public void verifyAssembly( final ComponentEntry[] components,
final ComponentFactory factory )
throws VerifyException
{
@@ -91,10 +91,10 @@
/**
* Verfiy that all Components have the needed dependencies specified correctly.
*
- * @param components the ComponentMetaData objects for the components
+ * @param components the ComponentEntry objects for the components
* @throws VerifyException if an error occurs
*/
- public void verifyValidDependencies( final ComponentMetaData[] components,
+ public void verifyValidDependencies( final ComponentEntry[] components,
final ComponentFactory factory )
throws VerifyException
{
@@ -107,15 +107,15 @@
/**
* Verfiy that there are no circular references between Components.
*
- * @param components the ComponentMetaData objects for the components
+ * @param components the ComponentEntry objects for the components
* @throws VerifyException if an circular dependency error occurs
*/
- protected void verifyNoCircularDependencies( final ComponentMetaData[]
components )
+ protected void verifyNoCircularDependencies( final ComponentEntry[] components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- final ComponentMetaData component = components[ i ];
+ final ComponentEntry component = components[ i ];
final Stack stack = new Stack();
stack.push( component );
@@ -128,25 +128,25 @@
* Verfiy that there are no circular references between Components.
*
* @param component ???
- * @param components the ComponentMetaData objects for the components
+ * @param components the ComponentEntry objects for the components
* @param stack the ???
* @throws VerifyException if an error occurs
*/
- protected void verifyNoCircularDependencies( final ComponentMetaData component,
- final ComponentMetaData[]
components,
+ protected void verifyNoCircularDependencies( final ComponentEntry component,
+ final ComponentEntry[] components,
final Stack stack )
throws VerifyException
{
- final ComponentMetaData[] dependencies = getDependencies( component,
components );
+ final ComponentEntry[] dependencies = getDependencies( component,
components );
for( int i = 0; i < dependencies.length; i++ )
{
- final ComponentMetaData dependency = dependencies[ i ];
+ final ComponentEntry dependency = dependencies[ i ];
if( stack.contains( dependency ) )
{
final String trace = getDependencyTrace( dependency, stack );
final String message =
REZ.getString( "assembly.circular-dependency.error",
- component.getName(),
+ component.getMetaData().getName(),
trace );
throw new VerifyException( message );
}
@@ -165,25 +165,25 @@
* @param stack the Stack
* @return the path of dependency
*/
- protected String getDependencyTrace( final ComponentMetaData component,
+ protected String getDependencyTrace( final ComponentEntry component,
final Stack stack )
{
final StringBuffer sb = new StringBuffer();
sb.append( "[ " );
- final String name = component.getName();
+ final String name = component.getMetaData().getName();
final int size = stack.size();
final int top = size - 1;
for( int i = top; i >= 0; i-- )
{
- final ComponentMetaData other = (ComponentMetaData)stack.get( i );
+ final ComponentEntry other = (ComponentEntry)stack.get( i );
if( top != i )
{
sb.append( ", " );
}
- sb.append( other.getName() );
+ sb.append( other.getMetaData().getName() );
- if( other.getName().equals( name ) )
+ if( other.getMetaData().getName().equals( name ) )
{
break;
}
@@ -204,29 +204,30 @@
* @param components the total set of components in application
* @return the dependencies of component
*/
- protected ComponentMetaData[] getDependencies( final ComponentMetaData
component,
- final ComponentMetaData[]
components )
+ protected ComponentEntry[] getDependencies( final ComponentEntry component,
+ final ComponentEntry[]
components )
{
final ArrayList dependencies = new ArrayList();
- final DependencyMetaData[] deps = component.getDependencies();
+ final DependencyMetaData[] deps =
+ component.getMetaData().getDependencies();
for( int i = 0; i < deps.length; i++ )
{
final String name = deps[ i ].getProviderName();
- final ComponentMetaData other = getComponentMetaData( name, components
);
+ final ComponentEntry other = getComponentEntry( name, components );
dependencies.add( other );
}
- return (ComponentMetaData[])dependencies.toArray( new ComponentMetaData[ 0
] );
+ return (ComponentEntry[])dependencies.toArray( new ComponentEntry[ 0 ] );
}
/**
* Verfiy that the inter-Component dependencies are valid.
*
- * @param components the ComponentMetaData objects for the components
+ * @param components the ComponentEntry objects for the components
* @throws VerifyException if an error occurs
*/
- protected void verifyDependencyReferences( final ComponentMetaData[] components,
+ protected void verifyDependencyReferences( final ComponentEntry[] components,
final ComponentFactory factory )
throws VerifyException
{
@@ -239,17 +240,17 @@
/**
* Verfiy that the inter-Component dependencies are valid for specified
Component.
*
- * @param component the ComponentMetaData object for the component
- * @param others the ComponentMetaData objects for the other components
+ * @param component the ComponentEntry object for the component
+ * @param others the ComponentEntry objects for the other components
* @throws VerifyException if an error occurs
*/
- protected void verifyDependencyReferences( final ComponentMetaData component,
- final ComponentMetaData[] others,
+ protected void verifyDependencyReferences( final ComponentEntry component,
+ final ComponentEntry[] others,
final ComponentFactory factory )
throws VerifyException
{
final ComponentInfo info = getComponentInfo( component, factory );
- final DependencyMetaData[] roles = component.getDependencies();
+ final DependencyMetaData[] roles =
component.getMetaData().getDependencies();
for( int i = 0; i < roles.length; i++ )
{
@@ -259,14 +260,14 @@
info.getDependency( roleName ).getService();
//Get the other component that is providing service
- final ComponentMetaData provider = getComponentMetaData( providerName,
others );
+ final ComponentEntry provider = getComponentEntry( providerName, others
);
if( null == provider )
{
final String message =
REZ.getString( "assembly.missing-dependency.error",
roleName,
providerName,
- component.getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
@@ -280,16 +281,16 @@
REZ.getString( "assembly.dependency-missing-service.error",
providerName,
service,
- component.getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
}
- private ComponentInfo getComponentInfo( final ComponentMetaData component,
final ComponentFactory factory )
+ private ComponentInfo getComponentInfo( final ComponentEntry component, final
ComponentFactory factory )
throws VerifyException
{
- final String impl = component.getImplementationKey();
+ final String impl = component.getMetaData().getImplementationKey();
try
{
return factory.createInfo( impl );
@@ -307,12 +308,12 @@
* @param components the array of components to search
* @return the Component if found, else null
*/
- protected ComponentMetaData getComponentMetaData( final String name,
- final ComponentMetaData[]
components )
+ protected ComponentEntry getComponentEntry( final String name,
+ final ComponentEntry[]
components )
{
for( int i = 0; i < components.length; i++ )
{
- if( components[ i ].getName().equals( name ) )
+ if( components[ i ].getMetaData().getName().equals( name ) )
{
return components[ i ];
}
@@ -327,12 +328,12 @@
* @param components the Components Profile
* @throws VerifyException if an error occurs
*/
- protected void verifyValidNames( final ComponentMetaData[] components )
+ protected void verifyValidNames( final ComponentEntry[] components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- final String name = components[ i ].getName();
+ final String name = components[ i ].getMetaData().getName();
if( !isValidName( name ) )
{
final String message =
@@ -372,12 +373,12 @@
* @param components the Components
* @throws VerifyException if an error occurs
*/
- protected void checkNamesUnique( final ComponentMetaData[] components )
+ protected void checkNamesUnique( final ComponentEntry[] components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- final String name = components[ i ].getName();
+ final String name = components[ i ].getMetaData().getName();
verifyUniqueName( components, name, i );
}
}
@@ -390,14 +391,15 @@
* @param index the index of component in array (so we can skip it)
* @throws VerifyException if names are not unique
*/
- private void verifyUniqueName( final ComponentMetaData[] components,
+ private void verifyUniqueName( final ComponentEntry[] components,
final String name,
final int index )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- final String other = components[ i ].getName();
+ final String other =
+ components[ i ].getMetaData().getName();
if( index != i && other.equals( name ) )
{
final String message =
@@ -408,19 +410,20 @@
}
/**
- * Retrieve a list of DependencyMetaData objects for ComponentMetaData
+ * Retrieve a list of DependencyMetaData objects for ComponentEntry
* and verify that there is a 1 to 1 map with dependencies specified
* in ComponentInfo.
*
- * @param component the ComponentMetaData describing the component
+ * @param component the ComponentEntry describing the component
* @throws VerifyException if an error occurs
*/
- protected void verifyDependenciesMap( final ComponentMetaData component,
+ protected void verifyDependenciesMap( final ComponentEntry component,
final ComponentFactory factory )
throws VerifyException
{
//Make sure all role entries specified in config file are valid
- final DependencyMetaData[] dependencySet = component.getDependencies();
+ final DependencyMetaData[] dependencySet =
+ component.getMetaData().getDependencies();
for( int i = 0; i < dependencySet.length; i++ )
{
@@ -436,7 +439,7 @@
REZ.getString( "assembly.unknown-dependency.error",
roleName,
roleName,
- component.getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
@@ -447,7 +450,8 @@
for( int i = 0; i < dependencies.length; i++ )
{
final DependencyDescriptor dependency = dependencies[ i ];
- final DependencyMetaData role = component.getDependency(
dependency.getRole() );
+ final DependencyMetaData role =
+ component.getMetaData().getDependency( dependency.getRole() );
//If there is no Role then the user has failed
//to specify a needed dependency.
@@ -456,7 +460,7 @@
final String message =
REZ.getString( "assembly.unspecified-dependency.error",
dependency.getRole(),
- component.getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>