donaldp 2002/08/24 02:00:32
Modified: containerkit/src/java/org/apache/excalibur/containerkit/verifier
AssemblyVerifier.java
Log:
Move from ComponentEntry to ComponentProfile
Revision Changes Path
1.34 +55 -56
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.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- AssemblyVerifier.java 24 Aug 2002 08:55:07 -0000 1.33
+++ AssemblyVerifier.java 24 Aug 2002 09:00:32 -0000 1.34
@@ -13,8 +13,7 @@
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.containerkit.metadata.DependencyMetaData;
-import org.apache.excalibur.containerkit.metadata.ComponentMetaData;
-import org.apache.excalibur.containerkit.kernel.ComponentEntry;
+import org.apache.excalibur.containerkit.registry.ComponentProfile;
import org.apache.avalon.framework.info.ComponentInfo;
import org.apache.avalon.framework.info.DependencyDescriptor;
import org.apache.avalon.framework.info.ServiceDescriptor;
@@ -61,7 +60,7 @@
* @param components the Components that make up assembly
* @throws VerifyException if an error occurs
*/
- public void verifyAssembly( final ComponentEntry[] components )
+ public void verifyAssembly( final ComponentProfile[] components )
throws VerifyException
{
String message = null;
@@ -93,7 +92,7 @@
* @param components the ComponentEntry objects for the components
* @throws VerifyException if an error occurs
*/
- public void verifyValidDependencies( final ComponentEntry[] components )
+ public void verifyValidDependencies( final ComponentProfile[] components
)
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
@@ -108,12 +107,12 @@
* @param components the ComponentEntry objects for the components
* @throws VerifyException if an circular dependency error occurs
*/
- protected void verifyNoCircularDependencies( final ComponentEntry[]
components )
+ protected void verifyNoCircularDependencies( final ComponentProfile[]
components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- final ComponentEntry component = components[ i ];
+ final ComponentProfile component = components[ i ];
final Stack stack = new Stack();
stack.push( component );
@@ -130,21 +129,21 @@
* @param stack the ???
* @throws VerifyException if an error occurs
*/
- protected void verifyNoCircularDependencies( final ComponentEntry
component,
- final ComponentEntry[]
components,
+ protected void verifyNoCircularDependencies( final ComponentProfile
component,
+ final ComponentProfile[]
components,
final Stack stack )
throws VerifyException
{
- final ComponentEntry[] dependencies = getDependencies( component,
components );
+ final ComponentProfile[] dependencies = getDependencies( component,
components );
for( int i = 0; i < dependencies.length; i++ )
{
- final ComponentEntry dependency = dependencies[ i ];
+ final ComponentProfile dependency = dependencies[ i ];
if( stack.contains( dependency ) )
{
final String trace = getDependencyTrace( dependency, stack );
final String message =
REZ.getString( "assembly.circular-dependency.error",
-
component.getProfile().getMetaData().getName(),
+ component.getMetaData().getName(),
trace );
throw new VerifyException( message );
}
@@ -163,25 +162,25 @@
* @param stack the Stack
* @return the path of dependency
*/
- protected String getDependencyTrace( final ComponentEntry component,
+ protected String getDependencyTrace( final ComponentProfile component,
final Stack stack )
{
final StringBuffer sb = new StringBuffer();
sb.append( "[ " );
- final String name = component.getProfile().getMetaData().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 ComponentEntry other = (ComponentEntry)stack.get( i );
+ final ComponentProfile other = (ComponentProfile)stack.get( i );
if( top != i )
{
sb.append( ", " );
}
- sb.append( other.getProfile().getMetaData().getName() );
+ sb.append( other.getMetaData().getName() );
- if( other.getProfile().getMetaData().getName().equals( name ) )
+ if( other.getMetaData().getName().equals( name ) )
{
break;
}
@@ -202,30 +201,30 @@
* @param components the total set of components in application
* @return the dependencies of component
*/
- protected ComponentEntry[] getDependencies( final ComponentEntry
component,
- final ComponentEntry[]
components )
+ protected ComponentProfile[] getDependencies( final ComponentProfile
component,
+ final ComponentProfile[]
components )
{
final ArrayList dependencies = new ArrayList();
final DependencyMetaData[] deps =
- component.getProfile().getMetaData().getDependencies();
+ component.getMetaData().getDependencies();
for( int i = 0; i < deps.length; i++ )
{
final String name = deps[ i ].getProviderName();
- final ComponentEntry other = getComponentEntry( name, components
);
+ final ComponentProfile other = getComponentProfile( name,
components );
dependencies.add( other );
}
- return (ComponentEntry[])dependencies.toArray( new ComponentEntry[ 0
] );
+ return (ComponentProfile[])dependencies.toArray( new
ComponentProfile[ 0 ] );
}
/**
* Verfiy that the inter-Component dependencies are valid.
*
- * @param components the ComponentEntry objects for the components
+ * @param components the ComponentProfile objects for the components
* @throws VerifyException if an error occurs
*/
- protected void verifyDependencyReferences( final ComponentEntry[]
components )
+ protected void verifyDependencyReferences( final ComponentProfile[]
components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
@@ -237,16 +236,16 @@
/**
* Verfiy that the inter-Component dependencies are valid for specified
Component.
*
- * @param component the ComponentEntry object for the component
- * @param others the ComponentEntry objects for the other components
+ * @param component the ComponentProfile object for the component
+ * @param others the ComponentProfile objects for the other components
* @throws VerifyException if an error occurs
*/
- protected void verifyDependencyReferences( final ComponentEntry
component,
- final ComponentEntry[] others
)
+ protected void verifyDependencyReferences( final ComponentProfile
component,
+ final ComponentProfile[]
others )
throws VerifyException
{
- final ComponentInfo info = component.getProfile().getInfo();
- final DependencyMetaData[] roles =
component.getProfile().getMetaData().getDependencies();
+ final ComponentInfo info = component.getInfo();
+ final DependencyMetaData[] roles =
component.getMetaData().getDependencies();
for( int i = 0; i < roles.length; i++ )
{
@@ -256,20 +255,20 @@
info.getDependency( roleName ).getService();
//Get the other component that is providing service
- final ComponentEntry provider = getComponentEntry( providerName,
others );
+ final ComponentProfile provider = getComponentProfile(
providerName, others );
if( null == provider )
{
final String message =
REZ.getString( "assembly.missing-dependency.error",
roleName,
providerName,
-
component.getProfile().getMetaData().getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
//make sure that the component offers service
//that user expects it to be providing
- final ComponentInfo providerInfo =
provider.getProfile().getInfo();
+ final ComponentInfo providerInfo = provider.getInfo();
final ServiceDescriptor[] services = providerInfo.getServices();
if( !hasMatchingService( service, services ) )
{
@@ -277,7 +276,7 @@
REZ.getString(
"assembly.dependency-missing-service.error",
providerName,
service,
-
component.getProfile().getMetaData().getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
@@ -290,13 +289,13 @@
* @param components the array of components to search
* @return the Component if found, else null
*/
- protected ComponentEntry getComponentEntry( final String name,
- final ComponentEntry[]
components )
+ protected ComponentProfile getComponentProfile( final String name,
+ final
ComponentProfile[] components )
{
for( int i = 0; i < components.length; i++ )
{
- ComponentEntry componentEntry = components[ i ];
- if( componentEntry.getProfile().getMetaData().getName().equals(
name ) )
+ ComponentProfile ComponentProfile = components[ i ];
+ if( ComponentProfile.getMetaData().getName().equals( name ) )
{
return components[ i ];
}
@@ -311,13 +310,13 @@
* @param components the Components Profile
* @throws VerifyException if an error occurs
*/
- protected void verifyValidNames( final ComponentEntry[] components )
+ protected void verifyValidNames( final ComponentProfile[] components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- ComponentEntry componentEntry = components[ i ];
- final String name =
componentEntry.getProfile().getMetaData().getName();
+ ComponentProfile ComponentProfile = components[ i ];
+ final String name = ComponentProfile.getMetaData().getName();
if( !isValidName( name ) )
{
final String message =
@@ -357,13 +356,13 @@
* @param components the Components
* @throws VerifyException if an error occurs
*/
- protected void checkNamesUnique( final ComponentEntry[] components )
+ protected void checkNamesUnique( final ComponentProfile[] components )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- ComponentEntry componentEntry = components[ i ];
- final String name =
componentEntry.getProfile().getMetaData().getName();
+ ComponentProfile ComponentProfile = components[ i ];
+ final String name = ComponentProfile.getMetaData().getName();
verifyUniqueName( components, name, i );
}
}
@@ -376,16 +375,16 @@
* @param index the index of component in array (so we can skip it)
* @throws VerifyException if names are not unique
*/
- private void verifyUniqueName( final ComponentEntry[] components,
+ private void verifyUniqueName( final ComponentProfile[] components,
final String name,
final int index )
throws VerifyException
{
for( int i = 0; i < components.length; i++ )
{
- ComponentEntry componentEntry = components[ i ];
+ ComponentProfile ComponentProfile = components[ i ];
final String other =
- componentEntry.getProfile().getMetaData().getName();
+ ComponentProfile.getMetaData().getName();
if( index != i && other.equals( name ) )
{
final String message =
@@ -396,24 +395,24 @@
}
/**
- * Retrieve a list of DependencyMetaData objects for ComponentEntry
+ * Retrieve a list of DependencyMetaData objects for ComponentProfile
* and verify that there is a 1 to 1 map with dependencies specified
* in ComponentInfo.
*
- * @param component the ComponentEntry describing the component
+ * @param component the ComponentProfile describing the component
* @throws VerifyException if an error occurs
*/
- protected void verifyDependenciesMap( final ComponentEntry component )
+ protected void verifyDependenciesMap( final ComponentProfile component )
throws VerifyException
{
//Make sure all role entries specified in config file are valid
final DependencyMetaData[] dependencySet =
- component.getProfile().getMetaData().getDependencies();
+ component.getMetaData().getDependencies();
for( int i = 0; i < dependencySet.length; i++ )
{
final String roleName = dependencySet[ i ].getRole();
- final ComponentInfo info = component.getProfile().getInfo();
+ final ComponentInfo info = component.getInfo();
final DependencyDescriptor descriptor = info.getDependency(
roleName );
//If there is no dependency descriptor in ComponentInfo then
@@ -424,19 +423,19 @@
REZ.getString( "assembly.unknown-dependency.error",
roleName,
roleName,
-
component.getProfile().getMetaData().getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
//Make sure all dependencies in ComponentInfo file are satisfied
- final ComponentInfo info = component.getProfile().getInfo();
+ final ComponentInfo info = component.getInfo();
final DependencyDescriptor[] dependencies = info.getDependencies();
for( int i = 0; i < dependencies.length; i++ )
{
final DependencyDescriptor dependency = dependencies[ i ];
final DependencyMetaData role =
- component.getProfile().getMetaData().getDependency(
dependency.getRole() );
+ component.getMetaData().getDependency( dependency.getRole()
);
//If there is no Role then the user has failed
//to specify a needed dependency.
@@ -445,7 +444,7 @@
final String message =
REZ.getString( "assembly.unspecified-dependency.error",
dependency.getRole(),
-
component.getProfile().getMetaData().getName() );
+ component.getMetaData().getName() );
throw new VerifyException( message );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>