You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/02/07 15:03:43 UTC
cvs commit: avalon/merlin/facilities/http/util/src/java/org/apache/avalon/http/util HttpHandler.java
mcconnell 2004/02/07 06:03:42
Modified: merlin/activation/impl/src/test/org/apache/avalon/activation/appliance
AbstractTestCase.java
merlin/composition/api/src/java/org/apache/avalon/composition/model
ModelFactory.java SystemContext.java
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
DefaultContextModel.java DefaultModelFactory.java
DefaultSystemContext.java
DelegatingSystemContext.java
merlin/composition/impl/src/test/org/apache/avalon/composition/model
AbstractTestCase.java
merlin/facilities/http/util/src/java/org/apache/avalon/http/util
HttpHandler.java
Log:
Update system context to expose a runtime factory.
Revision Changes Path
1.14 +4 -4 avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java
Index: AbstractTestCase.java
===================================================================
RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AbstractTestCase.java 6 Feb 2004 15:27:13 -0000 1.13
+++ AbstractTestCase.java 7 Feb 2004 14:03:42 -0000 1.14
@@ -30,7 +30,7 @@
import org.apache.avalon.composition.model.ContainmentModel;
import org.apache.avalon.composition.model.SystemContext;
-import org.apache.avalon.composition.model.impl.DefaultSystemContext;
+import org.apache.avalon.composition.model.util.SystemContextBuilder;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.configuration.Configuration;
@@ -111,14 +111,14 @@
*/
public void setUp( File base, File block ) throws Exception
{
- File local = new File( base, "repository" );
InitialContext context =
new DefaultInitialContext( getMavenRepositoryDirectory() );
long timeout = 3000;
+ File local = new File( base, "repository" );
m_system =
- DefaultSystemContext.createSystemContext(
+ SystemContextBuilder.createSystemContext(
context, base, local, ConsoleLogger.LEVEL_INFO, m_secured, timeout );
m_logger = m_system.getLogger();
@@ -128,7 +128,7 @@
//
ContainmentProfile profile = setUpProfile( block );
- m_model = m_system.getFactory().createContainmentModel( profile );
+ m_model = m_system.getModelFactory().createContainmentModel( profile );
}
protected ContainmentProfile setUpProfile( File file )
1.5 +7 -7 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ModelFactory.java
Index: ModelFactory.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ModelFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ModelFactory.java 24 Jan 2004 23:25:25 -0000 1.4
+++ ModelFactory.java 7 Feb 2004 14:03:42 -0000 1.5
@@ -55,8 +55,8 @@
* @param profile a composition profile
* @return the containment model
*/
- ContainmentContext createContainmentContext( ContainmentProfile profile )
- throws ModelException;
+ //ContainmentContext createContainmentContext( ContainmentProfile profile )
+ // throws ModelException;
/**
* Creation of a new nested containment model. This method is called
@@ -66,8 +66,8 @@
* @param context a potentially foreign containment context
* @return the containment model
*/
- ContainmentModel createContainmentModel( ContainmentContext context )
- throws ModelException;
+ //ContainmentModel createContainmentModel( ContainmentContext context )
+ // throws ModelException;
/**
* Creation of a new nested deployment model. This method is called
@@ -77,7 +77,7 @@
* @param context a potentially foreign deployment context
* @return the deployment model
*/
- ComponentModel createComponentModel( ComponentContext context )
- throws ModelException;
+ //ComponentModel createComponentModel( ComponentContext context )
+ // throws ModelException;
}
1.6 +9 -3 avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/SystemContext.java
Index: SystemContext.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/SystemContext.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SystemContext.java 24 Jan 2004 23:25:25 -0000 1.5
+++ SystemContext.java 7 Feb 2004 14:03:42 -0000 1.6
@@ -20,7 +20,6 @@
import java.io.File;
import org.apache.avalon.logging.provider.LoggingManager;
-import org.apache.avalon.composition.model.ModelFactory;
import org.apache.avalon.repository.Repository;
@@ -41,7 +40,14 @@
*
* @return the factory
*/
- ModelFactory getFactory();
+ ModelFactory getModelFactory();
+
+ /**
+ * Return the runtime factory.
+ *
+ * @return the factory
+ */
+ RuntimeFactory getRuntimeFactory();
/**
* Return the base directory from which relative references
1.8 +1 -2 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java
Index: DefaultContextModel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultContextModel.java 6 Feb 2004 15:27:14 -0000 1.7
+++ DefaultContextModel.java 7 Feb 2004 14:03:42 -0000 1.8
@@ -93,7 +93,6 @@
* @param descriptor the contextualization stage descriptor
* @param directive the contextualization directive
* @param context the deployment context
- * @param componentModel the enclosing component model
*/
public DefaultContextModel(
Logger logger, ContextDescriptor descriptor,
1.6 +3 -3 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java
Index: DefaultModelFactory.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultModelFactory.java 24 Jan 2004 23:25:27 -0000 1.5
+++ DefaultModelFactory.java 7 Feb 2004 14:03:42 -0000 1.6
@@ -182,7 +182,7 @@
* @param profile a containment profile
* @return the containment context
*/
- public ContainmentContext createContainmentContext( ContainmentProfile profile )
+ private ContainmentContext createContainmentContext( ContainmentProfile profile )
throws ModelException
{
if( profile == null )
@@ -230,7 +230,7 @@
* @param context a potentially foreign containment context
* @return the containment model
*/
- public ContainmentModel createContainmentModel( ContainmentContext context )
+ private ContainmentModel createContainmentModel( ContainmentContext context )
throws ModelException
{
return new DefaultContainmentModel( context );
1.14 +23 -111 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java
Index: DefaultSystemContext.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefaultSystemContext.java 3 Feb 2004 04:53:41 -0000 1.13
+++ DefaultSystemContext.java 7 Feb 2004 14:03:42 -0000 1.14
@@ -25,6 +25,7 @@
import org.apache.avalon.logging.data.CategoryDirective;
import org.apache.avalon.composition.model.ModelFactory;
+import org.apache.avalon.composition.model.RuntimeFactory;
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.model.ContainmentModel;
@@ -52,115 +53,16 @@
public class DefaultSystemContext extends DefaultContext
implements SystemContext
{
- //==============================================================
+ //--------------------------------------------------------------
// static
- //==============================================================
+ //--------------------------------------------------------------
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultSystemContext.class );
- /**
- * Convinience function to create a new system context. This function
- * is intended for test purposes only.
- *
- * @param base the base directory from which relative references
- * within a classpath or library directive shall be resolved
- * @param root a repository root directory
- * @param priority logging manager default priority
- * @return a system context
- */
- public static SystemContext createSystemContext(
- InitialContext context, File base, File root,
- int priority, boolean secure, long deploymenttimeout )
- throws Exception
- {
- //
- // ### FIX ME ##
- //
-
- Artifact artifact = Artifact.createArtifact(
- "avalon-logging", "avalon-logkit-impl", "1.0-SNAPSHOT" );
-
- LoggingManager logging =
- createLoggingManager( context, artifact, base, priority );
-
- Logger logger = logging.getLoggerForCategory( "" );
- CacheManager cache = createCacheManager( context, root );
- Repository repository = cache.createRepository();
-
- final File home = new File( base, "home" );
- final File temp = new File( base, "temp" );
-
- return new DefaultSystemContext(
- logging, base, home, temp, repository, "system", false, deploymenttimeout, secure );
- }
-
- private static CacheManager createCacheManager( InitialContext context, File root )
- throws Exception
- {
- String dpml = "http://dpml.net";
- String ibiblio = "http://www.ibiblio.org/maven";
- String[] hosts = new String[]{ dpml, ibiblio };
-
- Factory factory = context.getInitialFactory();
- Map criteria = factory.createDefaultCriteria();
- criteria.put( "avalon.repository.cache", root );
- criteria.put( "avalon.repository.hosts", hosts );
-
- return (CacheManager) factory.create( criteria );
- }
-
- private static LoggingManager createLoggingManager(
- InitialContext context, Artifact artifact, File base, int priority )
- throws Exception
- {
- final String level = getStringPriority( priority );
- Builder builder = context.newBuilder( artifact );
- Factory factory = builder.getFactory();
- Map criteria = factory.createDefaultCriteria();
- File file = new File( base, "conf/logging.xml" );
- criteria.put( "avalon.logging.configuration", file );
- criteria.put( "avalon.logging.basedir", base );
- return (LoggingManager) factory.create( criteria );
- }
-
- private static String getStringPriority( int priority )
- {
- if( priority == ConsoleLogger.LEVEL_DISABLED )
- {
- return "NONE";
- }
- else if( priority == ConsoleLogger.LEVEL_DEBUG )
- {
- return "DEBUG";
- }
- else if( priority == ConsoleLogger.LEVEL_INFO )
- {
- return "INFO";
- }
- else if( priority == ConsoleLogger.LEVEL_WARN )
- {
- return "WARN";
- }
- else if( priority == ConsoleLogger.LEVEL_ERROR )
- {
- return "ERROR";
- }
- else if( priority == ConsoleLogger.LEVEL_FATAL )
- {
- return "FATAL";
- }
- else
- {
- final String error =
- "Unrecognized logging priority: " + priority;
- throw new IllegalArgumentException( error );
- }
- }
-
- //==============================================================
+ //--------------------------------------------------------------
// immutable state
- //==============================================================
+ //--------------------------------------------------------------
private final File m_base;
@@ -184,15 +86,15 @@
private boolean m_secure;
- //==============================================================
+ //--------------------------------------------------------------
// mutable state
- //==============================================================
+ //--------------------------------------------------------------
private boolean m_trace;
- //==============================================================
+ //--------------------------------------------------------------
// constructor
- //==============================================================
+ //--------------------------------------------------------------
/**
* Creation of a new system context.
@@ -245,18 +147,28 @@
m_factory = new DefaultModelFactory( this );
}
- //==============================================================
+ //--------------------------------------------------------------
// SystemContext
- //==============================================================
+ //--------------------------------------------------------------
/**
* Return the model factory.
*
* @return the factory
*/
- public ModelFactory getFactory()
+ public ModelFactory getModelFactory()
{
return m_factory;
+ }
+
+ /**
+ * Return the runtime factory.
+ *
+ * @return the factory
+ */
+ public RuntimeFactory getRuntimeFactory()
+ {
+ throw new UnsupportedOperationException( "getRuntimeFactory" );
}
/**
1.4 +15 -3 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DelegatingSystemContext.java
Index: DelegatingSystemContext.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DelegatingSystemContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DelegatingSystemContext.java 24 Jan 2004 23:25:28 -0000 1.3
+++ DelegatingSystemContext.java 7 Feb 2004 14:03:42 -0000 1.4
@@ -22,6 +22,7 @@
import org.apache.avalon.logging.provider.LoggingManager;
import org.apache.avalon.composition.model.ModelFactory;
+import org.apache.avalon.composition.model.RuntimeFactory;
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.repository.Repository;
import org.apache.avalon.framework.logger.Logger;
@@ -79,10 +80,21 @@
*
* @return the factory
*/
- public ModelFactory getFactory()
+ public ModelFactory getModelFactory()
{
- return m_parent.getFactory();
+ return m_parent.getModelFactory();
}
+
+ /**
+ * Return the runtime factory.
+ *
+ * @return the factory
+ */
+ public RuntimeFactory getRuntimeFactory()
+ {
+ return m_parent.getRuntimeFactory();
+ }
+
/**
* Return the base directory from which relative classloader
1.7 +4 -5 avalon/merlin/composition/impl/src/test/org/apache/avalon/composition/model/AbstractTestCase.java
Index: AbstractTestCase.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/test/org/apache/avalon/composition/model/AbstractTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractTestCase.java 3 Feb 2004 04:53:41 -0000 1.6
+++ AbstractTestCase.java 7 Feb 2004 14:03:42 -0000 1.7
@@ -6,7 +6,7 @@
import org.apache.avalon.repository.Artifact;
-import org.apache.avalon.composition.model.impl.DefaultSystemContext;
+import org.apache.avalon.composition.model.util.SystemContextBuilder;
import org.apache.avalon.repository.provider.InitialContext;
import org.apache.avalon.repository.main.DefaultInitialContext;
@@ -79,11 +79,10 @@
try
{
SystemContext system =
- DefaultSystemContext.createSystemContext(
+ SystemContextBuilder.createSystemContext(
context, base, root, PRIORITY, true, 1000 );
- m_model =
- system.getFactory().createContainmentModel(
- source.toURL() );
+ ModelFactory factory = system.getModelFactory();
+ m_model = factory.createContainmentModel( source.toURL() );
}
catch( Throwable e )
{
1.2 +10 -10 avalon/merlin/facilities/http/util/src/java/org/apache/avalon/http/util/HttpHandler.java
Index: HttpHandler.java
===================================================================
RCS file: /home/cvs/avalon/merlin/facilities/http/util/src/java/org/apache/avalon/http/util/HttpHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpHandler.java 5 Feb 2004 18:59:08 -0000 1.1
+++ HttpHandler.java 7 Feb 2004 14:03:42 -0000 1.2
@@ -111,7 +111,7 @@
* before the response body.
*
* <p>Where possible, set the Content-Length header (with the
- * {@link javax.component.ServletResponse#setContentLength} method),
+ * {@link javax.servlet.ServletResponse#setContentLength} method),
* to allow the component container to use a persistent connection
* to return its response to the client, improving performance.
* The content length is automatically set if the entire response fits
@@ -150,7 +150,7 @@
* could not be handled
*
*
- * @see javax.component.ServletResponse#setContentType
+ * @see javax.servlet.ServletResponse#setContentType
*
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
@@ -255,7 +255,7 @@
* response body.
*
* <p>Where possible, set the Content-Length header (with the
- * {@link javax.component.ServletResponse#setContentLength} method),
+ * {@link javax.servlet.ServletResponse#setContentLength} method),
* to allow the component container to use a persistent connection
* to return its response to the client, improving performance.
* The content length is automatically set if the entire response fits
@@ -284,8 +284,8 @@
* the request
* @exception HandlerException if the request for the POST
* could not be handled
- * @see javax.component.ServletOutputStream
- * @see javax.component.ServletResponse#setContentType
+ * @see javax.servlet.ServletOutputStream
+ * @see javax.servlet.ServletResponse#setContentType
*/
protected void doPost( HttpServletRequest request, HttpServletResponse response )
throws HandlerException, IOException
@@ -411,7 +411,7 @@
}
private Method[] getAllDeclaredMethods(Class c) {
- if (c.getName().equals("javax.component.http.HttpServlet"))
+ if (c.getName().equals("javax.servlet.http.HttpServlet"))
return null;
int j=0;
@@ -579,7 +579,7 @@
* <code>service</code> method and dispatches
* them to the <code>do</code><i>XXX</i> methods defined in
* this class. This method is an HTTP-specific version of the
- * {@link javax.component.Servlet#service} method. There's no
+ * {@link javax.servlet.Servlet#service} method. There's no
* need to override this method.
*
* @param request the {@link HttpServletRequest} object that
@@ -593,7 +593,7 @@
* TRACE request
* @exception HandlerException if the request for the
* TRACE cannot be handled
- * @see javax.component.Servlet#service
+ * @see javax.servlet.Servlet#service
*/
protected void service(HttpServletRequest request, HttpServletResponse response)
throws HandlerException, IOException
@@ -693,7 +693,7 @@
* TRACE cannot be handled
*
*
- * @see javax.component.Servlet#service
+ * @see javax.servlet.Servlet#service
*
*/
public void service(ServletRequest request, ServletResponse response )
@@ -866,7 +866,7 @@
class NoBodyOutputStream extends ServletOutputStream {
private static final String LSTRING_FILE =
- "javax.component.http.LocalStrings";
+ "javax.servlet.http.LocalStrings";
private static ResourceBundle lStrings =
ResourceBundle.getBundle(LSTRING_FILE);
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org