mcconnell 2003/11/25 10:55:15
Modified: repository maven.xml platform.xml project.properties
repository/impl/src/java/org/apache/avalon/repository/impl
DefaultRepositoryCriteria.java
repository/site/xdocs index.xml
repository/site/xdocs/about index.xml
repository/site/xdocs/resources roadmap.xml
repository/site/xdocs/start index.xml
repository/spi/src/java/org/apache/avalon/repository/criteria
AbstractCriteria.java ValidationException.java
Log:
Dpoc updates and improvements to the AbstractCriteria class.
Revision Changes Path
1.10 +2 -3 avalon-sandbox/repository/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/maven.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- maven.xml 23 Nov 2003 20:17:55 -0000 1.9
+++ maven.xml 25 Nov 2003 18:55:15 -0000 1.10
@@ -8,8 +8,8 @@
<ant:property name="pom.organization.identifier" value="ASF"/>
<ant:property name="pom.specificationVersion" value="1.2"/>
-
<ant:property name="maven.docs.src" value="${basedir}/site/xdocs"/>
+ <ant:property file="project.properties"/>
<goal name="avalon:build" description="Build the Repository.">
<maven:reactor basedir="${basedir}"
@@ -140,8 +140,7 @@
<classpath>
<path refid="maven.dependency.classpath"/>
</classpath>
- <link href="${sun.j2se.link}" />
- <link href="${avalon.util.link}" />
+ <link href="http://java.sun.com/j2se/1.4.2/docs/api/" />
</ant:javadoc>
</goal>
1.5 +4 -19 avalon-sandbox/repository/platform.xml
Index: platform.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/platform.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- platform.xml 24 Nov 2003 21:25:42 -0000 1.4
+++ platform.xml 25 Nov 2003 18:55:15 -0000 1.5
@@ -28,28 +28,13 @@
<packageGroups>
<packageGroup>
- <title>API</title>
- <packages>org.apache.avalon.repository</packages>
+ <title>API/SPI</title>
+
<packages>org.apache.avalon.repository,org.apache.avalon.repository.criteria,org.apache.avalon.repository.meta</packages>
</packageGroup>
<packageGroup>
- <title>SPI</title>
-
<packages>org.apache.avalon.repository.criteria,org.apache.avalon.repository.meta</packages>
- </packageGroup>
-
- <packageGroup>
- <title>Reference Implementation</title>
- <packages>org.apache.avalon.repository.impl</packages>
- </packageGroup>
-
- <packageGroup>
- <title>Bootstrap</title>
- <packages>org.apache.avalon.repository.main</packages>
- </packageGroup>
-
- <packageGroup>
- <title>Utilities</title>
- <packages>org.apache.avalon.repository.util</packages>
+ <title>Reference Implementation and Bootstrap</title>
+
<packages>org.apache.avalon.repository.impl,org.apache.avalon.repository.main,org.apache.avalon.repository.util</packages>
</packageGroup>
</packageGroups>
1.7 +1 -1 avalon-sandbox/repository/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/project.properties,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- project.properties 23 Nov 2003 20:17:55 -0000 1.6
+++ project.properties 25 Nov 2003 18:55:15 -0000 1.7
@@ -15,6 +15,6 @@
# file.
#
-sun.j2ee.link = http://java.sun.com/j2ee/1.4/docs/api/
+sun.j2se.link = http://java.sun.com/j2ee/1.4/docs/api/
avalon.util.link = http://avalon.apache.org/merlin/api/
maven.javadoc.links = ${sun.j2se.link},${avalon.util.link}
1.3 +4 -26
avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryCriteria.java
Index: DefaultRepositoryCriteria.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultRepositoryCriteria.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultRepositoryCriteria.java 24 Nov 2003 09:43:31 -0000 1.2
+++ DefaultRepositoryCriteria.java 25 Nov 2003 18:55:15 -0000 1.3
@@ -118,6 +118,8 @@
*/
public DefaultRepositoryCriteria() throws RepositoryException
{
+ super( PARAMS );
+
Properties bootstrap = getDefaultProperties();
//
@@ -196,20 +198,10 @@
}
}
-
//--------------------------------------------------------------
// Criteria
//--------------------------------------------------------------
- /**
- * Return the parameter associated to the criteria.
- * @return the parameters
- */
- public Parameter[] getParameters()
- {
- return PARAMS;
- }
-
public String toString()
{
return "[repository: " + getMap() + "]";
@@ -221,23 +213,9 @@
private Properties getDefaultProperties() throws RepositoryException
{
- Properties bootstrap = new Properties();
try
{
- InputStream input =
- DefaultRepositoryCriteria.class.getResourceAsStream( DEFAULTS );
- if( input == null )
- {
- final String error =
- "Internal error, unable to locate enbedded resource: "
- + DEFAULTS
- + " from the resource: "
- + DefaultRepositoryCriteria.class.getProtectionDomain()
- .getCodeSource().getLocation();
- throw new IllegalStateException( error );
- }
- bootstrap.load( input );
- return bootstrap;
+ return Defaults.getStaticProperties( DefaultRepositoryCriteria.class,
DEFAULTS );
}
catch ( IOException e )
{
1.2 +1 -1 avalon-sandbox/repository/site/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/site/xdocs/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 23 Nov 2003 20:17:55 -0000 1.1
+++ index.xml 25 Nov 2003 18:55:15 -0000 1.2
@@ -63,7 +63,7 @@
</p>
<p>
-The Avalon Repository is a Java <a href="about/api.html">API</a>,
+The Avalon Repository is a Java <a href="about/api/index.html">API</a>,
<a href="about/spi.html">SPI</a>, <a href="about/reference.html">reference
implementation</a> and <a href="about/bootstrap.html">bootstrap platform</a>
that provides support for the dynamic artifact loading, classloader chain
1.2 +1 -1 avalon-sandbox/repository/site/xdocs/about/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/site/xdocs/about/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 23 Nov 2003 20:17:55 -0000 1.1
+++ index.xml 25 Nov 2003 18:55:15 -0000 1.2
@@ -64,7 +64,7 @@
</p>
<p>
-The Avalon Repository is a Java <a href="api.html">API</a>,
+The Avalon Repository is a Java <a href="api/index.html">API</a>,
<a href="spi.html">SPI</a>, <a href="reference.html">reference
implementation</a> and <a href="bootstrap.html">bootstrap platform</a>
that provides support for the dynamic artifact loading, classloader chain
1.2 +2 -1 avalon-sandbox/repository/site/xdocs/resources/roadmap.xml
Index: roadmap.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/site/xdocs/resources/roadmap.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- roadmap.xml 23 Nov 2003 20:17:55 -0000 1.1
+++ roadmap.xml 25 Nov 2003 18:55:15 -0000 1.2
@@ -57,8 +57,9 @@
<body>
<section name="Roadmap">
- <subsection name="Objectives">
+ <subsection name="Future Plans">
+ <p>IN PREPARATION</p>
</subsection>
</section>
1.2 +1 -1 avalon-sandbox/repository/site/xdocs/start/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/repository/site/xdocs/start/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 23 Nov 2003 20:17:56 -0000 1.1
+++ index.xml 25 Nov 2003 18:55:15 -0000 1.2
@@ -62,7 +62,7 @@
<table>
<tr><th>Topic</th><th>Description</th></tr>
<tr>
- <td><a href="kernel/index.html">Installation</a></td>
+ <td><a href="install/index.html">Installation</a></td>
<td>
Instalation instructions for binary installs and CVS based
builds.
1.2 +56 -20
avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/criteria/AbstractCriteria.java
Index: AbstractCriteria.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/criteria/AbstractCriteria.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractCriteria.java 24 Nov 2003 09:11:43 -0000 1.1
+++ AbstractCriteria.java 25 Nov 2003 18:55:15 -0000 1.2
@@ -78,9 +78,34 @@
// state
//--------------------------------------------------------------
+ private final Parameter[] m_params;
+
+ private final String[] m_keys;
+
private final Hashtable m_bindings = new Hashtable();
//--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ /**
+ * Creation of a new criteria instance.
+ * @param params the set of parameters managed by the criteria
+ */
+ public AbstractCriteria( Parameter[] params )
+ {
+ if( null == params )
+ throw new NullPointerException( "params" );
+
+ m_params = params;
+ m_keys = new String[ params.length ];
+ for( int i=0; i<params.length; i++ )
+ {
+ m_keys[i] = params[i].getKey();
+ }
+ }
+
+ //--------------------------------------------------------------
// Criteria
//--------------------------------------------------------------
@@ -88,7 +113,10 @@
* Return the parameter associated to the criteria.
* @return the parameters
*/
- public abstract Parameter[] getParameters();
+ public Parameter[] getParameters()
+ {
+ return m_params;
+ }
/**
* Set a named parameter of the criteria to a value.
@@ -141,15 +169,34 @@
}
//--------------------------------------------------------------
- // private
+ // private and protected
//--------------------------------------------------------------
+ protected String[] getKeys()
+ {
+ return m_keys;
+ }
+
+ protected Parameter getParameter( final String key )
+ {
+ Parameter[] params = getParameters();
+ for( int i=0; i<params.length; i++ )
+ {
+ Parameter parameter = params[i];
+ if( parameter.getKey().equals( key ) ) return parameter;
+ }
+
+ final String error =
+ "Unknown key: [" + key + "].";
+ throw new IllegalArgumentException( error );
+ }
+
/**
* Verify a value relative to the parameter constraints.
* @param value the value to verify
* @exception ValidationException if the value is invalid
*/
- public Object resolveValue( Parameter param, Object value )
+ private Object resolveValue( Parameter param, Object value )
throws ValidationException
{
if( value == null ) return null;
@@ -163,7 +210,9 @@
Constructor constructor = null;
try
{
- constructor = c.getConstructor( new Class[]{ value.getClass() } );
+ constructor =
+ c.getConstructor(
+ new Class[]{ value.getClass() } );
}
catch( NoSuchMethodException nsme )
{
@@ -175,12 +224,13 @@
+ "] is not an instance of type: ["
+ param.getClassname()
+ "].";
- throw new ValidationException( error );
+ throw new IllegalArgumentException( error );
}
try
{
- return constructor.newInstance( new Object[]{ value } );
+ return constructor.newInstance(
+ new Object[]{ value } );
}
catch( Throwable e )
{
@@ -212,19 +262,5 @@
+ param.getClassname();
throw new ValidationException( error, e );
}
- }
-
- public Parameter getParameter( final String key )
- {
- Parameter[] params = getParameters();
- for( int i=0; i<params.length; i++ )
- {
- Parameter parameter = params[i];
- if( parameter.getKey().equals( key ) ) return parameter;
- }
-
- final String error =
- "Unknown key: [" + key + "].";
- throw new IllegalArgumentException( error );
}
}
1.3 +3 -3
avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/criteria/ValidationException.java
Index: ValidationException.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/criteria/ValidationException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ValidationException.java 24 Nov 2003 09:43:31 -0000 1.2
+++ ValidationException.java 25 Nov 2003 18:55:15 -0000 1.3
@@ -50,14 +50,14 @@
package org.apache.avalon.repository.criteria;
-import org.apache.avalon.repository.RepositoryException;
+import org.apache.avalon.repository.RepositoryRuntimeException;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision$
*/
-public class ValidationException extends RepositoryException
+public class ValidationException extends RepositoryRuntimeException
{
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]