donaldp 2002/08/17 20:51:28
Modified: containerkit/src/java/org/apache/excalibur/containerkit/verifier
MetaDataVerifier.java
Log:
Use ComponentEntry instead of passing in factory
Revision Changes Path
1.12 +24 -50
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/MetaDataVerifier.java
Index: MetaDataVerifier.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/verifier/MetaDataVerifier.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MetaDataVerifier.java 18 Aug 2002 03:46:08 -0000 1.11
+++ MetaDataVerifier.java 18 Aug 2002 03:51:28 -0000 1.12
@@ -19,7 +19,7 @@
import org.apache.avalon.framework.info.ContextDescriptor;
import org.apache.avalon.framework.info.ServiceDescriptor;
import org.apache.avalon.framework.info.ServiceDesignator;
-import org.apache.excalibur.containerkit.factory.ComponentFactory;
+import org.apache.excalibur.containerkit.kernel.ComponentEntry;
/**
* This Class verifies that an implementation is valid wrt the
@@ -83,34 +83,31 @@
* Verfiy that specified components designate classes that implement the
* advertised interfaces. And confrorm to expectations of {@link
ComponentMetaData}.
*
- * @param component the {@link ComponentMetaData} object for the components
+ * @param component the {@link ComponentEntry} object for the components
* @param classLoader the ClassLoader to load component from
* @throws VerifyException if an error occurs
*/
- public void verifyType( final ComponentMetaData component,
- final ClassLoader classLoader,
- final ComponentFactory factory )
+ public void verifyType( final ComponentEntry component,
+ final ClassLoader classLoader )
throws VerifyException
{
final Class clazz = getClass( classLoader, component );
- verifyType( component, clazz, factory );
+ verifyType( component, clazz );
}
/**
* Verfiy that specified components designate classes that implement the
- * advertised interfaces. And confrorm to expectations of {@link
ComponentMetaData}.
+ * advertised interfaces. And confrorm to expectations of {@link
ComponentEntry}.
*
- * @param component the {@link ComponentMetaData} object for the components
+ * @param component the {@link ComponentEntry} object for the components
* @throws VerifyException if an error occurs
*/
- public void verifyType( final ComponentMetaData component,
- final Class clazz,
- final ComponentFactory factory )
+ public void verifyType( final ComponentEntry component,
+ final Class clazz )
throws VerifyException
{
- final String name = component.getName();
- final String impl = component.getImplementationKey();
- final ComponentInfo info = getComponentInfo( impl, factory );
+ final String name = component.getMetaData().getName();
+ final ComponentInfo info = component.getInfo();
final Class[] interfaces =
getServiceClasses( name,
info.getServices(),
@@ -123,37 +120,14 @@
}
/**
- * Retrieve component info from factory and throw a verify
- * exception on error.
- *
- * @param impl the implementationKey
- * @param factory the factory to use
- * @return the ComponentInfo for implementationKey
- * @throws VerifyException if unable to locate info
- */
- private ComponentInfo getComponentInfo( final String impl,
- final ComponentFactory factory )
- throws VerifyException
- {
- try
- {
- return factory.createInfo( impl );
- }
- catch( final Exception e )
- {
- throw new VerifyException( e.getMessage(), e );
- }
- }
-
- /**
* Verify that the if the component is not Contextualizable that it
* does not declare Context Entrys.
*
- * @param component the {@link ComponentMetaData}
+ * @param component the {@link ComponentEntry}
* @param clazz the class implementing component
* @throws VerifyException if fails verification check
*/
- protected void verifyContextPresence( final ComponentMetaData component,
+ protected void verifyContextPresence( final ComponentEntry component,
final ComponentInfo info,
final Class clazz )
throws VerifyException
@@ -167,7 +141,7 @@
{
final String message =
REZ.getString( "metadata.declare-uneeded-entrys.error",
- component.getName(),
+ component.getMetaData().getName(),
getClassname( component ) );
throw new VerifyException( message );
}
@@ -181,15 +155,15 @@
* <p>or</p>
* <p>Is Composable/Serviceable and does declare dependencys</p>
*
- * @param component the {@link ComponentMetaData}
+ * @param component the {@link ComponentEntry}
* @param clazz the class implementing component
* @throws VerifyException if fails verification check
*/
- protected void verifyDependencyPresence( final ComponentMetaData component,
+ protected void verifyDependencyPresence( final ComponentEntry component,
final Class clazz )
throws VerifyException
{
- final int count = component.getDependencies().length;
+ final int count = component.getMetaData().getDependencies().length;
final boolean aquiresServices =
Composable.class.isAssignableFrom( clazz ) ||
Serviceable.class.isAssignableFrom( clazz );
@@ -199,7 +173,7 @@
{
final String message =
REZ.getString( "metadata.declare-uneeded-deps.error",
- component.getName(),
+ component.getMetaData().getName(),
getClassname( component ) );
throw new VerifyException( message );
}
@@ -246,7 +220,7 @@
}
/**
- * Load class object for specified {@link ComponentMetaData}.
+ * Load class object for specified {@link ComponentEntry}.
*
* @param classLoader the ClassLoader to use
* @param component the meta data associate with component
@@ -254,7 +228,7 @@
* @throws VerifyException if unable to aquire class object
*/
private Class getClass( final ClassLoader classLoader,
- final ComponentMetaData component )
+ final ComponentEntry component )
throws VerifyException
{
Class clazz = null;
@@ -266,7 +240,7 @@
{
final String message =
REZ.getString( "assembly.bad-class.error",
- component.getName(),
+ component.getMetaData().getName(),
getClassname( component ),
e.toString() );
throw new VerifyException( message );
@@ -280,8 +254,8 @@
* @param component the component
* @return the classname for component
*/
- private String getClassname( final ComponentMetaData component )
+ private String getClassname( final ComponentEntry component )
{
- return component.getImplementationKey();
+ return component.getMetaData().getImplementationKey();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>