cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r122544 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal: reading transformation
Date Thu, 16 Dec 2004 11:20:39 GMT
Author: cziegeler
Date: Thu Dec 16 03:20:35 2004
New Revision: 122544

URL: http://svn.apache.org/viewcvs?view=rev&rev=122544
Log:
Make transformer configurable
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java?view=diff&rev=122544&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java&r1=122543&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java&r2=122544
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/reading/ProxyReader.java
Thu Dec 16 03:20:35 2004
@@ -64,6 +64,9 @@
      */
     protected Request request;
 
+    /** The prefix */
+    protected String prefix;
+    
     /**
      * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(SourceResolver, Map, String,
Parameters)
      */
@@ -85,7 +88,7 @@
                 this.manager,
                 copletID,
                 portalName);
-
+        this.prefix = par.getParameter("prefix", ProxyTransformer.PROXY_PREFIX);
     }
 
     /**
@@ -104,10 +107,7 @@
      */
     public void generate() throws IOException {
         String link = request.getRequestURI();
-        link =
-            link.substring(
-                link.indexOf(ProxyTransformer.PROXY_PREFIX)
-                    + ProxyTransformer.PROXY_PREFIX.length());
+        link = link.substring(link.indexOf(this.prefix) + this.prefix.length());
 
         String documentBase =
             (String) copletInstanceData.getAttribute(

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java?view=diff&rev=122544&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java&r1=122543&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java&r2=122544
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java
Thu Dec 16 03:20:35 2004
@@ -167,7 +167,7 @@
 
                     // if attribute found that contains a link
                     if (link != null) {
-                        CopletInstanceData cid = this.getCopletInstanceData();          
            
+                        CopletInstanceData cid = this.getCopletInstanceData(attr.getValue("coplet"));
                      
                         LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
         
                         // create event link

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java?view=diff&rev=122544&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java&r1=122543&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java&r2=122544
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/LinkTransformer.java
Thu Dec 16 03:20:35 2004
@@ -30,9 +30,9 @@
 import org.apache.cocoon.portal.Constants;
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.transformation.AbstractTransformer;
+import org.apache.cocoon.xml.AttributesImpl;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * This Transformer deals with tags containing links to external applications that need to
be converted so
@@ -102,27 +102,31 @@
         this.manager = manager;
     }
 
+    /** The prefix */
+    protected String prefix;
+
     /**
      * @see AbstractTransformer#setup(SourceResolver, Map, String, Parameters)
      */
     public void setup(SourceResolver resolver,
-        Map objectModel,
-        String src,
-        Parameters par)
+                      Map objectModel,
+                      String src,
+                      Parameters par)
     throws ProcessingException, SAXException, IOException {
-        copletInstanceData =
+        this.copletInstanceData =
             ProxyTransformer.getInstanceData(
                 this.manager,
                 objectModel,
                 par);
-        copletIdParamString =
+        this.copletIdParamString =
             ProxyTransformer.COPLETID + "=" + copletInstanceData.getId();
 
         Map context = (Map) objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
-        portalNameParamString =
+        this.portalNameParamString =
             ProxyTransformer.PORTALNAME
                 + "="
                 + (String) context.get(Constants.PORTAL_NAME_KEY);
+        this.prefix = par.getParameter("prefix", ProxyTransformer.PROXY_PREFIX);
     }
 
     /**
@@ -131,10 +135,10 @@
      */
     public void recycle() {
         super.recycle();
-        copletInstanceData = null;
-        elementStack.clear();
-        copletIdParamString = null;
-        portalNameParamString = null;
+        this.copletInstanceData = null;
+        this.elementStack.clear();
+        this.copletIdParamString = null;
+        this.portalNameParamString = null;
     }
 
     /**
@@ -337,19 +341,10 @@
         } else {
             eventAttributes = new AttributesImpl(attributes);
         }
+        eventAttributes.addCDATAAttribute(NewEventLinkTransformer.ATTRIBUTE_ATTR, attribute);
+        eventAttributes.addCDATAAttribute(NewEventLinkTransformer.ELEMENT_ATTR, element);
+        eventAttributes.addCDATAAttribute("coplet", this.copletInstanceData.getId());
 
-        eventAttributes.addAttribute(
-            "",
-            NewEventLinkTransformer.ATTRIBUTE_ATTR,
-            NewEventLinkTransformer.ATTRIBUTE_ATTR,
-            "CDATA",
-            attribute);
-        eventAttributes.addAttribute(
-            "",
-            NewEventLinkTransformer.ELEMENT_ATTR,
-            NewEventLinkTransformer.ELEMENT_ATTR,
-            "CDATA",
-            element);
         super.startElement(
             NewEventLinkTransformer.NAMESPACE_URI,
             NewEventLinkTransformer.EVENT_ELEM,
@@ -382,7 +377,7 @@
         }
 
         if (applyPrefixAndPortalParams) {
-            uriBuffer.append(ProxyTransformer.PROXY_PREFIX);
+            uriBuffer.append(this.prefix);
         }
 
         uriBuffer.append(uri);

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java?view=diff&rev=122544&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java&r1=122543&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java&r2=122544
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
Thu Dec 16 03:20:35 2004
@@ -155,7 +155,7 @@
 
         // if attribute found that contains a link
         if (link != null) {
-            CopletInstanceData cid = this.getCopletInstanceData();
+            CopletInstanceData cid = this.getCopletInstanceData(attributes.getValue("coplet"));
             // create event link
             CopletLinkEvent event = new CopletLinkEvent(cid, link);
             String eventLink = this.getPortalService().getComponentManager().getLinkService().getLinkURI(event);

Mime
View raw message