You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/11/16 09:09:09 UTC
cvs commit: jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier InfoVerifier.java Resources.properties
donaldp 2002/11/16 00:09:09
Modified: info/src/java/org/apache/avalon/framework/tools/verifier
InfoVerifier.java Resources.properties
Log:
Make sure that components with schema implement Configurable/Parameterizable as appropriate
Revision Changes Path
1.3 +51 -1 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/InfoVerifier.java
Index: InfoVerifier.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/InfoVerifier.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InfoVerifier.java 15 Nov 2002 22:31:14 -0000 1.2
+++ InfoVerifier.java 16 Nov 2002 08:09:08 -0000 1.3
@@ -14,9 +14,12 @@
import org.apache.avalon.framework.info.ComponentInfo;
import org.apache.avalon.framework.info.ContextDescriptor;
import org.apache.avalon.framework.info.ServiceDescriptor;
+import org.apache.avalon.framework.info.SchemaDescriptor;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.parameters.Parameterizable;
/**
* This Class verifies that an implementation is valid wrt the
@@ -117,6 +120,53 @@
verifyDependencyPresence( name, implementationKey, info, implementation );
verifyContextPresence( name, implementationKey, info, implementation );
+ verifySchemaPresence( name, implementationKey, info, implementation );
+ }
+
+ /**
+ * Verify that the if the component is not
+ * Configurable/Parameterizable that it does not declare schema
+ * of that type.
+ *
+ * @param name the name of component
+ * @param implementationKey the implementationKey of component
+ * @param implementation the class implementing component
+ * @throws VerifyException if fails verification check
+ */
+ protected void verifySchemaPresence( final String name,
+ final String implementationKey,
+ final ComponentInfo info,
+ final Class implementation )
+ throws VerifyException
+ {
+ final SchemaDescriptor schema = info.getSchema();
+ final String category = schema.getCategory();
+ if( "".equals( category ) )
+ {
+ return;
+ }
+ else if( "configuration".equals( category ) )
+ {
+ if( !Configurable.class.isAssignableFrom( implementation ) )
+ {
+ final String message =
+ REZ.getString( "metadata.declare-uneeded-configuration-schema.error",
+ name,
+ implementationKey );
+ throw new VerifyException( message );
+ }
+ }
+ else if( "parameters".equals( category ) )
+ {
+ if( !Parameterizable.class.isAssignableFrom( implementation ) )
+ {
+ final String message =
+ REZ.getString( "metadata.declare-uneeded-parameter-schema.error",
+ name,
+ implementationKey );
+ throw new VerifyException( message );
+ }
+ }
}
/**
1.3 +3 -1 jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/Resources.properties
Index: Resources.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/java/org/apache/avalon/framework/tools/verifier/Resources.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources.properties 14 Sep 2002 06:07:17 -0000 1.2
+++ Resources.properties 16 Nov 2002 08:09:08 -0000 1.3
@@ -16,4 +16,6 @@
metadata.bad-service-class.error=Unable to load service class "{1}" for Component named "{0}". (Reason: {2}).
metadata.nodeclare-deps.error=Component named "{0}" of type "{1}" is Composable or Serviceable but does not declare any dependencies.
metadata.declare-uneeded-deps.error=Component named "{0}" of type "{1}" is not Composable or Serviceable but declares dependencies.
-metadata.declare-uneeded-entrys.
\ No newline at end of file
+metadata.declare-uneeded-entrys.error=Component named "{0}" of type "{1}" is not Contextualizable but declares Context Entry dependencies.
+metadata.declare-uneeded-configuration-schema.error=Component named "{0}" of type "{1}" is not Configurable but declares a Configuration schema.
+metadata.declare-uneeded-parameters-schema.error=Component named "{0}" of type "{1}" is not Parameterizable but declares a Parameters schema.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>