cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r420816 - in /cocoon/trunk/core/cocoon-core/src/main: java/org/apache/cocoon/processing/ java/org/apache/cocoon/processing/impl/ resources/org/apache/cocoon/
Date Tue, 11 Jul 2006 12:23:34 GMT
Author: cziegeler
Date: Tue Jul 11 05:23:34 2006
New Revision: 420816

URL: http://svn.apache.org/viewvc?rev=420816&view=rev
Log:
Add new processing info provider component

Added:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
  (with props)
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
  (with props)
Modified:
    cocoon/trunk/core/cocoon-core/src/main/resources/org/apache/cocoon/cocoon.roles

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java?rev=420816&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
Tue Jul 11 05:23:34 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2006 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.cocoon.processing;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * This component can be used to retrieve information about the current
+ * process.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public interface ProcessInfoProvider {
+
+    HttpServletRequest getRequest();
+
+    HttpServletResponse getResponse();
+
+    ServletContext getServletContext();
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/ProcessInfoProvider.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java?rev=420816&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
Tue Jul 11 05:23:34 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 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.cocoon.processing.impl;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.Constants;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.http.HttpEnvironment;
+import org.apache.cocoon.processing.ProcessInfoProvider;
+
+/**
+ * Default implementation of the process info provider.
+ *
+ * For a simpler implementation we currently use Avalon functionality.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public class ProcessInfoProviderImpl
+    implements ProcessInfoProvider, ThreadSafe, Contextualizable {
+
+    protected Context context;
+
+    protected ServletContext servletContext;
+
+    /**
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context context) throws ContextException {
+        this.context = context;
+        this.servletContext = (ServletContext) this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getRequest()
+     */
+    public HttpServletRequest getRequest() {
+        return (HttpServletRequest) ContextHelper.getObjectModel(this.context).get(HttpEnvironment.HTTP_REQUEST_OBJECT);
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getResponse()
+     */
+    public HttpServletResponse getResponse() {
+        return (HttpServletResponse) ContextHelper.getObjectModel(this.context).get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getServletContext()
+     */
+    public ServletContext getServletContext() {
+        return this.servletContext;
+    }
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/processing/impl/ProcessInfoProviderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/core/cocoon-core/src/main/resources/org/apache/cocoon/cocoon.roles
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/resources/org/apache/cocoon/cocoon.roles?rev=420816&r1=420815&r2=420816&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/resources/org/apache/cocoon/cocoon.roles (original)
+++ cocoon/trunk/core/cocoon-core/src/main/resources/org/apache/cocoon/cocoon.roles Tue Jul
11 05:23:34 2006
@@ -45,6 +45,10 @@
         shorthand="source-resolver"
         default-class="org.apache.cocoon.components.source.CocoonSourceResolver"/>
 
+  <role name="org.apache.cocoon.processing.ProcessInfoProvider"
+        shorthand="process-info-provider"
+        default-class="org.apache.cocoon.processing.impl.ProcessInfoProviderImpl"/>
+
   <!-- The entity resolver used by most parsers -->
   <role name="org.apache.excalibur.xml.EntityResolver"
         shorthand="entity-resolver"



Mime
View raw message