cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r414203 - in /cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal: layout/renderer/aspect/impl/XSLTAspect.java transformation/ProxyTransformer.java util/InputModuleHelper.java
Date Wed, 14 Jun 2006 11:34:25 GMT
Author: cziegeler
Date: Wed Jun 14 04:34:25 2006
New Revision: 414203

URL: http://svn.apache.org/viewvc?rev=414203&view=rev
Log:
Add support for input modules in start uri for application coplet.

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/transformation/ProxyTransformer.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java?rev=414203&r1=414202&r2=414203&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
Wed Jun 14 04:34:25 2006
@@ -166,6 +166,7 @@
     throws SAXException {
         // FIXME Get the stylesheet either from a layout attribute or another aspect
         try {
+            // FIXME - object model is not passed
             String stylesheet = config.stylesheet.resolve(null);
             return stylesheet;
         } catch (PatternException pe) {

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/transformation/ProxyTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/transformation/ProxyTransformer.java?rev=414203&r1=414202&r2=414203&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/transformation/ProxyTransformer.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/transformation/ProxyTransformer.java
Wed Jun 14 04:34:25 2006
@@ -41,6 +41,7 @@
 import org.apache.cocoon.portal.coplet.CopletData;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.util.HtmlDomParser;
+import org.apache.cocoon.portal.util.InputModuleHelper;
 import org.apache.cocoon.transformation.AbstractTransformer;
 import org.apache.cocoon.util.NetUtils;
 import org.apache.cocoon.xml.XMLUtils;
@@ -114,12 +115,16 @@
     /** The portal service. */
     protected PortalService portalService;
 
+    /** Helper for resolving input modules. */
+    protected InputModuleHelper imHelper;
+
     /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
         this.portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+        this.imHelper = new InputModuleHelper(manager);
     }
 
     /**
@@ -131,6 +136,10 @@
             this.portalService = null;
             this.manager = null;
         }
+        if ( this.imHelper != null ) {
+            this.imHelper.dispose();
+            this.imHelper = null;
+        }
     }
 
     /**
@@ -156,14 +165,13 @@
 
         final CopletData copletData = this.copletInstanceData.getCopletData();
 
-        final String startURI = (String)copletData.getAttribute(START_URI);
-
         this.link = (String) this.copletInstanceData.getTemporaryAttribute(LINK);
 
         this.documentBase = (String) this.copletInstanceData.getAttribute(DOCUMENT_BASE);
 
         if (this.link == null) {
-            this.link = startURI;
+            final String startURI = (String)copletData.getAttribute(START_URI);
+            this.link = this.imHelper.resolve(startURI);
         }
 
         if (documentBase == null) {

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java?rev=414203&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
Wed Jun 14 04:34:25 2006
@@ -0,0 +1,77 @@
+/*
+ * 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.portal.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
+import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
+import org.apache.cocoon.sitemap.PatternException;
+
+/**
+ * @version $Id$ 
+ */
+public class InputModuleHelper {
+
+    /** Service manager. */
+    protected final ServiceManager manager;
+
+    protected final Map processedPatterns = new HashMap();
+
+    public InputModuleHelper(ServiceManager serviceManager) {
+        this.manager = serviceManager;
+    }
+
+    public void dispose() {
+        final Iterator i = this.processedPatterns.values().iterator();
+        while ( i.hasNext() ) {
+            final VariableResolver resolver = (VariableResolver)i.next();
+            ContainerUtil.dispose(resolver);
+        }
+        this.processedPatterns.clear();
+    }
+
+    public String resolve(String value) throws ProcessingException {
+        VariableResolver resolver = null;
+        try {
+            resolver = VariableResolverFactory.getResolver( value, this.manager );
+            // FIXME - object model is not passed
+            return resolver.resolve(null);
+        } catch (PatternException e) {
+            throw new ProcessingException("Error parsing pattern: " + value, e);
+        } finally {
+            ContainerUtil.dispose(resolver);
+        }
+    }
+
+    public VariableResolver getVariableResolver(String value) throws ProcessingException
{
+        VariableResolver resolver = (VariableResolver)this.processedPatterns.get(value);
+        if ( resolver == null ) {
+            try {
+                resolver = VariableResolverFactory.getResolver( value, this.manager );
+                this.processedPatterns.put(value, resolver);
+            } catch (PatternException e) {
+                throw new ProcessingException("Error parsing pattern: " + value, e);
+            }
+        }
+        return resolver;
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/util/InputModuleHelper.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message