You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/09/08 17:33:55 UTC

svn commit: r279575 - in /portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator: ContentServerAdapter.java RenderingJob.java Worker.java WorkerMonitor.java

Author: taylor
Date: Thu Sep  8 08:33:51 2005
New Revision: 279575

URL: http://svn.apache.org/viewcvs?rev=279575&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-360 - Springize Aggregation

refactored spring assembly of aggregation components
made work manager a component, with configurable workers parameters
made the header resource factory a component
dependency injected new components associations into render and aggregator
abstracted out content manager coupling from aggregator via an adapter (JS2-24)

started on a new 'experimental' aggregator: AsyncPageAggregatorImpl
This aggregator is under development and will be changing over the next week quite a bit
It is NOT hooked into the pipeline




Added:
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentServerAdapter.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/RenderingJob.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/Worker.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/WorkerMonitor.java

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentServerAdapter.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentServerAdapter.java?rev=279575&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentServerAdapter.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/ContentServerAdapter.java Thu Sep  8 08:33:51 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator;
+
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * <p>
+ * The Content Server Adapter encapsulates all aggregated related
+ * activities related to aggregation, lessening the coupling of the
+ * aggregator to the content server, which can be disabled.
+ * </p>
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface ContentServerAdapter 
+{
+    /**
+     * Pre page aggregation event, prepares the content paths for the 
+     * given decorators of the current page being aggregated. Preparing 
+     * content paths is the process of putting in the correct decorator
+     * paths so that the content server can correctly find the decorator
+     * resources.  
+     * 
+     * @param context Jetspeed portal per request context.
+     * @param page The current page being aggregated.
+     */
+    void prepareContentPaths(RequestContext context, ContentPage page);
+    
+    /**
+     * Adds stylesheets into the response header for a decoration 
+     * using the Header Resource component.
+     * Styles can be gathered from both page and portlet decorators.
+     * 
+     * @param context Jetspeed portal per request context.
+     * @param decoratorName Name of the decorator holding the style.  
+     * @param decoratorType Type of decorator, either portlet or page.
+     */
+    void addStyle(RequestContext context, String decoratorName, String decoratorType);
+    
+}

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/RenderingJob.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/RenderingJob.java?rev=279575&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/RenderingJob.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/RenderingJob.java Thu Sep  8 08:33:51 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator;
+
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * Worker thread processes jobs and notify its WorkerMonitor when completed.
+ * When no work is available, the worker simply sets itself in a waiting mode
+ * pending reactivation by the WorkerMonitor
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface RenderingJob extends Runnable
+{
+    void execute();
+    
+    PortletWindow getWindow(); 
+        
+}
+

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/Worker.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/Worker.java?rev=279575&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/Worker.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/Worker.java Thu Sep  8 08:33:51 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator;
+
+import java.security.AccessControlContext;
+
+/**
+ * Worker thread processes jobs and notify its WorkerMonitor when completed.
+ * When no work is available, the worker simply sets itself in a waiting mode
+ * pending reactivation by the WorkerMonitor
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface Worker 
+{
+     int getJobCount();
+
+    /**
+     * Reset the processed job counter
+     */
+     void resetJobCount();
+
+    /**
+     * Sets the running status of this Worker. If set to false, the Worker will
+     * stop after processing its current job.
+     */
+     void setRunning(boolean status);
+     
+    /**
+     * Sets the moitor of this worker
+     */
+     void setMonitor(WorkerMonitor monitor);
+     
+    /**
+     * Sets the job to execute in security context
+     */
+     void setJob(Runnable job, AccessControlContext context);
+
+    /**
+     * Sets the job to execute
+     */
+     void setJob(Runnable job);
+
+    /**
+     * Retrieves the job to execute
+     */
+     Runnable getJob();
+     
+     void start();
+}

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/WorkerMonitor.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/WorkerMonitor.java?rev=279575&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/WorkerMonitor.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/WorkerMonitor.java Thu Sep  8 08:33:51 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator;
+
+import org.apache.jetspeed.util.Queue;
+
+/**
+ * The Worker Monitor is a thread manager and monitor for async portlet aggregation
+ * and rendering.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface WorkerMonitor 
+{
+    void start();
+    void stop();
+    void setQueue(Queue queue);
+    Worker getWorker();
+    void process(RenderingJob job);
+    void release(Worker worker);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org