taylor 2004/01/13 17:47:27
Modified: portal maven.xml
portal/src/java/org/apache/jetspeed/aggregator
Aggregator.java
portal/src/java/org/apache/jetspeed/container/invoker
LocalPortletInvoker.java
LocalPortletInvokerFactory.java
ServletPortletInvoker.java
ServletPortletInvokerFactory.java
portal/src/java/org/apache/jetspeed/engine Engine.java
JetspeedEngine.java JetspeedEngineConstants.java
portal/src/webapp/WEB-INF/conf jetspeed.properties
Added: portal/src/java/org/apache/jetspeed
PortalReservedParameters.java
portal/src/java/org/apache/jetspeed/aggregator
PortletAggregator.java PortletValve.java
portal/src/webapp/WEB-INF/conf/pipelines
jetspeed-pipeline.xml portlet-pipeline.xml
Removed: portal/src/webapp/WEB-INF/conf jetspeed-pipeline.xml
Log:
Jetspeed-2 now supports one or more pipelines.
Pipelines can be selected in the request by setting the "pipeline" request parameter
in the request.
There are now two pipelines:
1. jetspeed-pipeline : the default pipeline which builds an entire portal page
2. portlet-pipeline : builds a portlet only, with no decorators or layout
Pipelines can be added to the system by dropping them into the
WEB-INF/conf/pipelines directory
Revision Changes Path
1.28 +1 -1 jakarta-jetspeed-2/portal/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/maven.xml,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- maven.xml 12 Jan 2004 06:38:46 -0000 1.27
+++ maven.xml 14 Jan 2004 01:47:27 -0000 1.28
@@ -4,7 +4,7 @@
xmlns:reactor="reactor">
<!-- Target of maven test:single test -->
-<property name='testcase' value='org.apache.jetspeed.profiler.TestProfiler'/>
+<property name='testcase' value='org.apache.jetspeed.pipeline.TestPipeline'/>
<!--
<goal name="jaxb:portlet"
1.1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/PortalReservedParameters.java
Index: PortalReservedParameters.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed;
/**
* PortalReservedParameters. The constants here define HTTP request parameters
* reserved for use by the Jetspeed Portal.
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: PortalReservedParameters.java,v 1.1 2004/01/14 01:47:27 taylor Exp $
*/
public final class PortalReservedParameters
{
public final static String PORTLET = "portlet";
public final static String PAGE = "page";
public final static String PIPELINE = "pipeline";
}
1.4 +2 -1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Aggregator.java
Index: Aggregator.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Aggregator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Aggregator.java 31 Dec 2003 09:46:35 -0000 1.3
+++ Aggregator.java 14 Jan 2004 01:47:27 -0000 1.4
@@ -66,6 +66,7 @@
public interface Aggregator extends CommonService
{
public String SERVICE_NAME = "Aggregator";
+ public String PORTLET_SERVICE_NAME = "PortletAggregator";
/**
* Builds the portlet set defined in the context into a portlet tree.
1.1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletAggregator.java
Index: PortletAggregator.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.aggregator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fulcrum.InitializationException;
import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.cps.BaseCommonService;
import org.apache.jetspeed.cps.CommonPortletServices;
import org.apache.jetspeed.exception.JetspeedException;
import org.apache.jetspeed.om.page.Fragment;
import org.apache.jetspeed.om.page.psml.FragmentImpl;
import org.apache.jetspeed.request.RequestContext;
/**
* PortletAggregator is used to produce the content of a single portlet.
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: PortletAggregator.java,v 1.1 2004/01/14 01:47:27 taylor Exp $
*/
public class PortletAggregator extends BaseCommonService implements Aggregator
{
private final static Log log = LogFactory.getLog(PortletAggregator.class);
/* (non-Javadoc)
* @see org.apache.fulcrum.Service#init()
*/
public void init() throws InitializationException
{
if (isInitialized())
{
return;
}
setInit(true);
}
/* (non-Javadoc)
* @see
org.apache.jetspeed.aggregator.Aggregator#build(org.apache.jetspeed.request.RequestContext)
*/
public void build(RequestContext context) throws JetspeedException
{
PortletRenderer renderer =
(PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
Fragment fragment = new FragmentImpl(); // TODO: fragment factory
fragment.setType(Fragment.PORTLET);
fragment.setName(context.getRequestParameter(PortalReservedParameters.PORTLET));
renderer.renderNow(fragment, context);
}
}
1.1
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/PortletValve.java
Index: PortletValve.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.aggregator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.cps.CommonPortletServices;
import org.apache.jetspeed.pipeline.PipelineException;
import org.apache.jetspeed.pipeline.valve.AbstractValve;
import org.apache.jetspeed.pipeline.valve.ValveContext;
import org.apache.jetspeed.request.RequestContext;
/**
* PortletValve
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: PortletValve.java,v 1.1 2004/01/14 01:47:27 taylor Exp $
*/
public class PortletValve extends AbstractValve
{
private static final Log log = LogFactory.getLog( PortletValve.class );
public void invoke( RequestContext request, ValveContext context )
throws PipelineException
{
try
{
Aggregator aggregator =
(Aggregator)CommonPortletServices.getPortalService(Aggregator.PORTLET_SERVICE_NAME);
aggregator.build(request);
}
catch (Exception e)
{
throw new PipelineException(e);
}
// Pass control to the next Valve in the Pipeline
context.invokeNext( request );
}
public String toString()
{
return "AggregatorValve";
}
}
1.6 +8 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java
Index: LocalPortletInvoker.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LocalPortletInvoker.java 12 Jan 2004 23:47:01 -0000 1.5
+++ LocalPortletInvoker.java 14 Jan 2004 01:47:27 -0000 1.6
@@ -85,7 +85,13 @@
* Local portlet applications are stored within the Jetspeed Portlet application.
* They are not separate web applications; but are stored under Jetspeed's
* WEB-INF/apps directory.
- *
+ * <h3>Sample Configuration</h3>
+ * <pre>
+ * <code>
+ * factory.invoker.local = org.apache.jetspeed.container.invoker.LocalPortletInvoker
+ * factory.invoker.local.pool.size = 50
+ * </code>
+ * </pre>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
*/
1.3 +10 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java
Index: LocalPortletInvokerFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalPortletInvokerFactory.java 12 Jan 2004 06:42:43 -0000 1.2
+++ LocalPortletInvokerFactory.java 14 Jan 2004 01:47:27 -0000 1.3
@@ -56,7 +56,15 @@
import org.apache.jetspeed.PortalContext;
/**
- * LocalPortletInvokerFactory
+ * LocalPortletInvokerFactory is the factory for creating portlet invokers that
+ * invoke portlets running in 'jetsped local' portlet applications. s
+ * <h3>Sample Configuration</h3>
+ * <pre>
+ * <code>
+ * factory.invoker.local = org.apache.jetspeed.container.invoker.LocalPortletInvoker
+ * factory.invoker.local.pool.size = 50
+ * </code>
+ * </pre>
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
1.11 +11 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java
Index: ServletPortletInvoker.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ServletPortletInvoker.java 12 Jan 2004 23:47:01 -0000 1.10
+++ ServletPortletInvoker.java 14 Jan 2004 01:47:27 -0000 1.11
@@ -85,7 +85,16 @@
* infused into the web (portlet) application. This servlet knows how to delegate
* to portlets and package their response back into a servlet response.
* The context name of the servlet should be configurable. The default context name
is "/container"
- *
+ * ServletPortletInvokerFactory is the factory for creating portlet invokers that
+ * use Jetspeed Container servlet.
+ * <h3>Sample Factory Configuration</h3>
+ * <pre>
+ * <code>
+ * factory.invoker.servlet =
org.apache.jetspeed.container.invoker.ServletPortletInvoker
+ * factory.invoker.servlet.pool.size = 50
+ * factory.invoker.servlet.mapping.name = /container
+ * </code>
+ * </pre>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
*/
1.4 +11 -3
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvokerFactory.java
Index: ServletPortletInvokerFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvokerFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletPortletInvokerFactory.java 12 Jan 2004 23:47:01 -0000 1.3
+++ ServletPortletInvokerFactory.java 14 Jan 2004 01:47:27 -0000 1.4
@@ -56,8 +56,16 @@
import org.apache.jetspeed.PortalContext;
/**
- * ServletPortletInvokerFactory
- *
+ * ServletPortletInvokerFactory is the factory for creating portlet invokers that
+ * use Jetspeed Container servlet.
+ * <h3>Sample Configuration</h3>
+ * <pre>
+ * <code>
+ * factory.invoker.servlet =
org.apache.jetspeed.container.invoker.ServletPortletInvoker
+ * factory.invoker.servlet.pool.size = 50
+ * factory.invoker.servlet.mapping.name = /container
+ * </code>
+ * </pre>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id$
*/
1.2 +9 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/Engine.java
Index: Engine.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/Engine.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Engine.java 28 Jul 2003 23:47:38 -0000 1.1
+++ Engine.java 14 Jan 2004 01:47:27 -0000 1.2
@@ -109,11 +109,18 @@
throws JetspeedException;
/**
- * Gets the engine's request pipeline.
+ * Gets the engine's request default pipeline.
*
* @return Pipeline The engine's request pipeline.
*/
public Pipeline getPipeline();
+
+ /**
+ * Gets the specified engine's request pipeline.
+ *
+ * @return Pipeline A specific request pipeline.
+ */
+ public Pipeline getPipeline(String pipelineName);
/**
* Get the Portal Context associated with running thread of the engine
1.9 +95 -25
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
Index: JetspeedEngine.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- JetspeedEngine.java 8 Dec 2003 18:28:06 -0000 1.8
+++ JetspeedEngine.java 14 Jan 2004 01:47:27 -0000 1.9
@@ -55,6 +55,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.util.HashMap;
import java.util.Properties;
import javax.servlet.ServletConfig;
@@ -65,6 +66,7 @@
import org.apache.commons.logging.impl.Log4jFactory;
import org.apache.jetspeed.JetspeedPortalContext;
import org.apache.jetspeed.PortalContext;
+import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.container.PortletContainerFactory;
import org.apache.jetspeed.container.services.JetspeedContainerServices;
import org.apache.jetspeed.container.services.log.ContainerLogAdaptor;
@@ -94,8 +96,10 @@
{
private PortalContext context;
private ServletConfig config = null;
- private Pipeline pipeline = null;
-
+ private Pipeline defaultPipeline = null;
+ private Class pipelineClass = null;
+ private HashMap pipelines = new HashMap();
+
private static final Log log = LogFactory.getLog(JetspeedEngine.class);
private static final Log console = LogFactory.getLog(CONSOLE_LOGGER);
/** stores the most recent RequestContext on a per thread basis */
@@ -158,11 +162,11 @@
log.info("Portlet container created sucessfully usin container class: "
+ container.getClass().getName());
//
- // create the pipeline
+ // create the pipelines
//
- log.info("Creating Jetspeed pipline...");
- createPipeline();
- log.info("Jetspeed pipline created sucessfully.");
+ log.info("Creating Jetspeed piplines...");
+ createPipelines();
+ log.info("Jetspeed piplines created sucessfully.");
//
// Make sure JMX is init'd
//
@@ -246,8 +250,18 @@
// requestContextPerThread.put(Thread.currentThread(), context);
try
{
+ String targetPipeline =
context.getRequestParameter(PortalReservedParameters.PIPELINE);
tlRequestContext.set(context);
- pipeline.invoke(context);
+ Pipeline pipeline = defaultPipeline;
+ if (targetPipeline != null)
+ {
+ Pipeline specificPipeline = (Pipeline)pipelines.get(targetPipeline);
+ if (specificPipeline != null)
+ {
+ pipeline = specificPipeline;
+ }
+ }
+ pipeline.invoke(context);
}
catch (Throwable t)
{
@@ -318,53 +332,109 @@
}
- private void createPipeline() throws CPSInitializationException
+ /**
+ * Creates the Jetspeed pipelines for request processing.
+ *
+ * @throws CPSInitializationException
+ */
+ private void createPipelines() throws CPSInitializationException
{
- String clazz =
this.getContext().getConfiguration().getString(PIPELINE_CLASS, null);
- String descriptorName =
this.getContext().getConfiguration().getString(PIPELINE_DESCRIPTOR, null);
-
- if (null == clazz || null == descriptorName)
+ String className =
this.getContext().getConfiguration().getString(PIPELINE_CLASS, null);
+ String defaultPipelineName =
this.getContext().getConfiguration().getString(PIPELINE_DEFAULT, "jetspeed-pipeline");
+
+ if (null == className)
{
- throw new CPSInitializationException("Failed to initialize pipeline,
missing params");
+ throw new CPSInitializationException("Failed to initialize pipeline,
missing configuration entry: " + PIPELINE_CLASS);
}
-
- Pipeline pipeline;
- PipelineDescriptor descriptor;
-
try
{
- pipeline = (Pipeline) Class.forName(clazz).newInstance();
+ pipelineClass = Class.forName(className);
}
catch (Exception e)
{
throw new CPSInitializationException("Failed to initialize pipeline,
couldnt create pipeline class");
}
+
+ String pipelinesDir =
this.getContext().getConfiguration().getString(PIPELINE_DIRECTORY,
"/WEB-INF/conf/pipelines/");
+ File directory = new File(getRealPath(pipelinesDir));
+ if (directory == null || !directory.exists())
+ {
+ throw new CPSInitializationException("Failed to initialize pipeline,
could not find pipeline directory");
+ }
+
+ File[] pipelineDescriptors = directory.listFiles();
+ for (int ix = 0; ix < pipelineDescriptors.length; ix++)
+ {
+ if (pipelineDescriptors[ix].isDirectory())
+ {
+ continue;
+ }
+ Pipeline pipeline = createPipeline(pipelineDescriptors[ix]);
+ String name = pipelineDescriptors[ix].getName();
+
+ int index = name.lastIndexOf(".");
+ if (index > 0)
+ {
+ name = name.substring(0, index);
+ }
+ if (name.equalsIgnoreCase(defaultPipelineName))
+ {
+ defaultPipeline = pipeline;
+ }
+ pipelines.put(name, pipeline);
+ }
+ }
+
+ /**
+ * Creates a pipeline from a pipeline descriptor file.
+ *
+ * @param file the descriptor file describing the pipeline.
+ * @return The new pipeline.
+ * @throws CPSInitializationException
+ */
+ private Pipeline createPipeline(File file) throws CPSInitializationException
+ {
+ Pipeline pipeline;
+ PipelineDescriptor descriptor;
+
try
{
- XmlReader reader = new XmlReader(PipelineDescriptor.class);
- File file = new File(getRealPath(descriptorName));
+ pipeline = (Pipeline)pipelineClass.newInstance();
+ XmlReader reader = new XmlReader(PipelineDescriptor.class);
descriptor = (PipelineDescriptor) reader.parse(new
FileInputStream(file));
}
catch (Exception e)
{
throw new CPSInitializationException("Failed to read pipeline
descriptor from deployment");
}
- pipeline.setDescriptor(descriptor);
+
try
{
+ pipeline.setDescriptor(descriptor);
pipeline.initialize();
}
catch (Exception e)
{
throw new CPSInitializationException("Failed to initialize pipeline: ",
e);
}
-
- this.pipeline = pipeline;
+
+ return pipeline;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.engine.Engine#getPipeline(java.lang.String)
+ */
+ public Pipeline getPipeline(String pipelineName)
+ {
+ return (Pipeline)this.pipelines.get(pipelineName);
}
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.engine.Engine#getPipeline()
+ */
public Pipeline getPipeline()
{
- return this.pipeline;
+ return this.defaultPipeline;
}
/**
* @see org.apache.jetspeed.engine.Engine#getCurrentRequestContext()
1.4 +3 -2
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngineConstants.java
Index: JetspeedEngineConstants.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/engine/JetspeedEngineConstants.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedEngineConstants.java 31 Dec 2003 09:46:35 -0000 1.3
+++ JetspeedEngineConstants.java 14 Jan 2004 01:47:27 -0000 1.4
@@ -122,7 +122,8 @@
public static final String WEBAPP_ROOT_KEY = "webappRoot";
public static final String PIPELINE_CLASS = "pipeline.class";
- public static final String PIPELINE_DESCRIPTOR = "pipeline.descriptor";
+ public static final String PIPELINE_DEFAULT = "pipeline.default";
+ public static final String PIPELINE_DIRECTORY = "pipeline.directory";
/**
* This specifies the factory to use the Jetspeed java.util.prefs.Preferences
1.26 +8 -4
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties
Index: jetspeed.properties
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/jetspeed.properties,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jetspeed.properties 12 Jan 2004 23:47:01 -0000 1.25
+++ jetspeed.properties 14 Jan 2004 01:47:27 -0000 1.26
@@ -50,7 +50,8 @@
# P I P E L I N E
# -------------------------------------------------------------------
pipeline.class = org.apache.jetspeed.pipeline.JetspeedPipeline
-pipeline.descriptor = /WEB-INF/conf/jetspeed-pipeline.xml
+pipeline.directory = /WEB-INF/conf/pipelines/
+pipeline.descriptor = jetspeed-pipeline
# -------------------------------------------------------------------
# I N F O R M A T I O N P RO V I D E R
@@ -68,12 +69,14 @@
factory.container.response = org.apache.jetspeed.container.ContainerResponse
factory.container.request = org.apache.jetspeed.container.ContainerRequest
-# invokers
+# Servlet Invoker
factory.invoker.servlet =
org.apache.jetspeed.container.invoker.ServletPortletInvoker
factory.invoker.servlet.pool.size = 50
+factory.invoker.servlet.mapping.name = /container
+
+# Local Invoker
factory.invoker.local = org.apache.jetspeed.container.invoker.LocalPortletInvoker
factory.invoker.local.pool.size = 50
-factory.invoker.servlet.mapping.name = /container
## Pluto Factory
plutofactory.javax.portlet.ActionRequest =
org.apache.pluto.factory.impl.ActionRequestFactoryImpl
@@ -109,6 +112,7 @@
services.Aggregator.classname=org.apache.jetspeed.aggregator.PageAggregator
services.Aggregator.strategy.default=parallel
services.PortletRenderer.classname=org.apache.jetspeed.aggregator.impl.PortletRendererImpl
+services.PortletAggregator.classname=org.apache.jetspeed.aggregator.PortletAggregator
# -------------------------------------------------------------------
# I D G E N E R A T O R
1.1
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/pipelines/jetspeed-pipeline.xml
Index: jetspeed-pipeline.xml
===================================================================
<pipelineDescriptor>
<name>JetspeedPipeline</name>
<valveDescriptors>
<valveDescriptor>
<className>org.apache.jetspeed.localization.impl.LocalizationValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.capability.impl.CapabilityValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.container.ContainerValve</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.security.impl.SecurityValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.profiler.impl.ProfilerValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.pipeline.valve.impl.VerySimpleLayoutValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.aggregator.AggregatorValve</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.pipeline.valve.impl.CleanupValveImpl</className>
</valveDescriptor>
</valveDescriptors>
</pipelineDescriptor>
1.1
jakarta-jetspeed-2/portal/src/webapp/WEB-INF/conf/pipelines/portlet-pipeline.xml
Index: portlet-pipeline.xml
===================================================================
<pipelineDescriptor>
<name>PortletPipeline</name>
<valveDescriptors>
<valveDescriptor>
<className>org.apache.jetspeed.localization.impl.LocalizationValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.capability.impl.CapabilityValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.security.impl.SecurityValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl</className>
</valveDescriptor>
<valveDescriptor>
<className>org.apache.jetspeed.aggregator.PortletValve</className>
</valveDescriptor>
</valveDescriptors>
</pipelineDescriptor>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]