cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r328453 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon: components/persistence/ portal/application/ portal/aspect/impl/ portal/coplet/ portal/coplet/status/ portal/layout/ portal/persistence/ portal/persistence/castor/ portal/pluto...
Date Tue, 25 Oct 2005 19:09:36 GMT
Author: cziegeler
Date: Tue Oct 25 12:08:53 2005
New Revision: 328453

URL: http://svn.apache.org/viewcvs?rev=328453&view=rev
Log:
Fix castor marshalling bug with duplicate ids; add debug statements and create interface for
customizable persistence converter

Added:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java  
(with props)
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/ConverterException.java
      - copied, changed from r328375, cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/ConverterException.java
Removed:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/application/
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/aspect/impl/
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/status/
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/ConverterException.java
Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/CastorSourceConverter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletbasedata.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletdata.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletinstancedata.xml
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/portal-castor.roles
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/services/PropertyManagerServiceImpl.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/serialization/IncludingHTMLSerializer.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSource.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSourceFactory.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletBaseData.java Tue
Oct 25 12:08:53 2005
@@ -71,4 +71,12 @@
 	public void setCopletAdapterName(String name) {
 		this.copletAdapterName = name;
 	}
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "CopletBaseData (" + this.hashCode() +
+               "), id=" + this.getId() + ", coplet-adapter=" + this.getCopletAdapterName();
+    }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletData.java Tue Oct
25 12:08:53 2005
@@ -194,4 +194,12 @@
         }
         this.allowedRoles = buffer.toString();
     }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "CopletData (" + this.hashCode() +
+               "), id=" + this.getId() + ", coplet-base-data=" + this.getCopletBaseData().getId();
+    }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
Tue Oct 25 12:08:53 2005
@@ -230,4 +230,12 @@
         }
         this.size = size;
     }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "CopletInstanceData (" + this.hashCode() +
+               "), id=" + this.getId() + ", coplet-data=" + this.getCopletData().getId();
+    }
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/layout/AbstractLayout.java Tue
Oct 25 12:08:53 2005
@@ -146,5 +146,4 @@
         return "Layout (" + this.getClass() + '.' + this.hashCode() +
                "), name=" + this.name + ", id=" + (this.getId() == null ? "" : this.getId());
     }
-
 }

Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java?rev=328453&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java Tue
Oct 25 12:08:53 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005 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.persistence;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+
+/**
+ * This is a component that converts a profile (= object tree) to a persistence
+ * format.
+ *
+ * @version $Id$
+ */
+public interface Converter {
+
+    /** The role to lookup this component. */
+    public static final String ROLE = Converter.class.getName();
+
+    /**
+     * Load an object from the given input stream. 
+     * @param stream      The input stream with the data.
+     * @param profileType {@link org.apache.cocoon.portal.profile.ProfileLS}
+     * @param references  A map of references referenced from the profile.
+     * @param parameters  An optional map of parameters for the conversion.
+     * @return The loaded object.
+     * @throws ConverterException
+     */
+    Object getObject(InputStream stream,
+                     String      profileType,
+                     Map         references,
+                     Map         parameters)
+    throws ConverterException;
+
+    /**
+     * Save an object to a given stream.
+     * @param stream The output stream.
+     * @param profileType {@link org.apache.cocoon.portal.profile.ProfileLS}
+     * @param object The object to save.
+     * @param parameters  An optional map of parameters for the conversion.
+     * @throws ConverterException
+     */
+    void storeObject(OutputStream stream,
+                     String       profileType,
+                     Object       object,
+                     Map          parameters)
+    throws ConverterException;
+}

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/Converter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/ConverterException.java
(from r328375, cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/ConverterException.java)
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/ConverterException.java?p2=cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/ConverterException.java&p1=cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/ConverterException.java&r1=328375&r2=328453&rev=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/ConverterException.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/ConverterException.java
Tue Oct 25 12:08:53 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.portal.persistence.castor;
+package org.apache.cocoon.portal.persistence;
 
 import org.apache.avalon.framework.CascadingException;
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/CastorSourceConverter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/CastorSourceConverter.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/CastorSourceConverter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/CastorSourceConverter.java
Tue Oct 25 12:08:53 2005
@@ -34,7 +34,8 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.cocoon.portal.profile.ProfileLS;
+import org.apache.cocoon.portal.persistence.Converter;
+import org.apache.cocoon.portal.persistence.ConverterException;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.exolab.castor.mapping.Mapping;
@@ -58,10 +59,7 @@
  */
 public class CastorSourceConverter
     extends AbstractLogEnabled
-    implements Serviceable, Configurable, Initializable, ThreadSafe {
-
-    /** The role to lookup this component. */
-    public static final String ROLE = CastorSourceConverter.class.getName();
+    implements Serviceable, Configurable, Initializable, ThreadSafe, Converter {
 
     protected Map mappingSources = new HashMap();
     protected ServiceManager manager;
@@ -72,10 +70,17 @@
     /** This object resolves the references between the different profile files. */
     protected ReferenceResolver idResolver = new ReferenceResolver();
 
-    public Object getObject(InputStream stream, Map parameters) throws ConverterException
{
+    /**
+     * @see org.apache.cocoon.portal.persistence.Converter#getObject(java.io.InputStream,
java.lang.String, java.util.Map, java.util.Map)
+     */
+    public Object getObject(InputStream stream,
+                            String      mappingName,
+                            Map         references,
+                            Map         parameters)
+    throws ConverterException {
         try {
-            this.idResolver.setObjectMap((Map)parameters.get(ProfileLS.PARAMETER_OBJECTMAP));
-            Unmarshaller unmarshaller = (Unmarshaller)((Object[])this.mappings.get(parameters.get(ProfileLS.PARAMETER_PROFILETYPE)))[1];
+            this.idResolver.setObjectMap(references);
+            Unmarshaller unmarshaller = (Unmarshaller)((Object[])this.mappings.get(mappingName))[1];
             Object result = unmarshaller.unmarshal(new InputSource(stream));
             stream.close();
             return result;
@@ -86,15 +91,24 @@
         }
     }
 
-	public void storeObject(OutputStream stream, Map parameters, Object object) throws ConverterException
{
+	/**
+	 * @see org.apache.cocoon.portal.persistence.Converter#storeObject(java.io.OutputStream,
java.lang.String, java.lang.Object, java.util.Map)
+	 */
+	public void storeObject(OutputStream stream,
+                            String       mappingName,
+                            Object       object,
+                            Map          parameters)
+    throws ConverterException {
         Writer writer = new OutputStreamWriter(stream);
 		try {
 			Marshaller marshaller = new Marshaller( writer );
-			marshaller.setMapping((Mapping)((Object[])this.mappings.get(parameters.get(ProfileLS.PARAMETER_PROFILETYPE)))[0]);
+			marshaller.setMapping((Mapping)((Object[])this.mappings.get(mappingName))[0]);
             boolean suppressXSIType = this.defaultSuppressXSIType;
-            Boolean value = (Boolean)parameters.get("suppressXSIType");
-            if (value != null) {
-                suppressXSIType = value.booleanValue();
+            if ( parameters != null ) {
+                Boolean value = (Boolean)parameters.get("suppressXSIType");
+                if (value != null) {
+                    suppressXSIType = value.booleanValue();
+                }
             }
             marshaller.setSuppressXSIType(suppressXSIType);
 			marshaller.marshal(object);

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletbasedata.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletbasedata.xml?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletbasedata.xml
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletbasedata.xml
Tue Oct 25 12:08:53 2005
@@ -28,7 +28,7 @@
     </field>
   </class>
 
-  <class name="org.apache.cocoon.portal.coplet.CopletBaseData" identity="id">
+  <class name="org.apache.cocoon.portal.coplet.CopletBaseData">
     <map-to xml="coplet-base-data" />
 
     <field name="id" type="java.lang.String" set-method="%1" get-method="getId">

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletdata.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletdata.xml?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletdata.xml
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletdata.xml
Tue Oct 25 12:08:53 2005
@@ -33,7 +33,7 @@
     </field>
   </class>
 
-  <class name="org.apache.cocoon.portal.coplet.CopletData" identity="id">
+  <class name="org.apache.cocoon.portal.coplet.CopletData">
     <map-to xml="coplet-data" />
     
     <field name="id" type="java.lang.String" set-method="%1" get-method="getId">

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletinstancedata.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletinstancedata.xml?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletinstancedata.xml
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/copletinstancedata.xml
Tue Oct 25 12:08:53 2005
@@ -52,7 +52,7 @@
     </field>
   </class>
 
-  <class name="org.apache.cocoon.portal.coplet.CopletInstanceData" identity="id">
+  <class name="org.apache.cocoon.portal.coplet.CopletInstanceData">
     <map-to xml="coplet-instance-data"/>
 
     <field name="id" type="java.lang.String" set-method="%1" get-method="getId">

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/portal-castor.roles
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/portal-castor.roles?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/portal-castor.roles
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/persistence/castor/portal-castor.roles
Tue Oct 25 12:08:53 2005
@@ -20,7 +20,7 @@
       | Castor Converter
       |
       +-->
-    <role name="org.apache.cocoon.portal.persistence.castor.CastorSourceConverter"
+    <role name="org.apache.cocoon.portal.persistence.Converter"
           default-class="org.apache.cocoon.portal.persistence.castor.CastorSourceConverter"
           shorthand="castor-converter"/>
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/services/PropertyManagerServiceImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/services/PropertyManagerServiceImpl.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/services/PropertyManagerServiceImpl.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/pluto/services/PropertyManagerServiceImpl.java
Tue Oct 25 12:08:53 2005
@@ -36,47 +36,18 @@
 public class PropertyManagerServiceImpl implements PropertyManagerService {
 
 	/**
-	 * Sets the given property map defined by the portlet window in its response.  
-	 * <br>
-	 * The purpose of this method is to provide the portal framework
-	 * with a new map of properties set by the portlet. The map can be empty, but not NULL
-	 * <br>
-	 * This method can be called multiple times during one request by the portlet container
-	 * 
-	 * @param window the portlet window of this property
-	 * @param request the servlet request
-	 * @param response the servlet response
-	 * @param properties the String/String array map containing the
-	 *                  properties to be set.
-	 **/
+	 * @see org.apache.pluto.services.property.PropertyManagerService#setResponseProperties(org.apache.pluto.om.window.PortletWindow,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.util.Map)
+	 */
 	public void setResponseProperties(PortletWindow window, 
-		HttpServletRequest request, 
-		HttpServletResponse response, 
-		Map properties) {
-
+                                      HttpServletRequest request, 
+                                      HttpServletResponse response,
+                                      Map properties) {
 		// do nothing
 	}
 
 	/**
-	 * Returns all properties for the given portlet window 
-	 * defined in the portal as String/String array map.
-	 * They will be made available to the portlet through the
-	 * portlet request.
-	 * <br>
-	 * The purpose of this method is to allow the portal framework
-	 * to create a map of properties and make it available to the portlet container.
-	 * <br>
-	 * This method can be called multiple times during one request by the portlet container
-	 * <br>
-	 * The return value cannot be null.
-	 *
-	 * @param window the portlet window of this property
-	 * @param request the servlet request
-	 * 
-	 * @return		a <code>Map</code> containing
-	 *                  all properties. If there are no properties of
-	 *                  that name returns an empty <code>Map</code>.    
-	 **/
+	 * @see org.apache.pluto.services.property.PropertyManagerService#getRequestProperties(org.apache.pluto.om.window.PortletWindow,
javax.servlet.http.HttpServletRequest)
+	 */
 	public Map getRequestProperties(PortletWindow window, HttpServletRequest request) {
 		return Collections.EMPTY_MAP;
 	}

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
Tue Oct 25 12:08:53 2005
@@ -355,7 +355,6 @@
         try {
             loader = (ProfileLS)this.manager.lookup( ProfileLS.ROLE );
             final ProfileImpl profile = new ProfileImpl(layoutKey);
-            this.storeUserProfile(layoutKey, profile);
 
             // first "load" the global data
             profile.setCopletBaseDatas( this.getGlobalBaseDatas(loader, info, layoutKey)
);
@@ -378,6 +377,7 @@
                 }
             }
 
+            this.storeUserProfile(layoutKey, profile);
             return profile;
         } catch (ServiceException se) {
             throw new ProfileException("Unable to get component profilels.", se);

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
Tue Oct 25 12:08:53 2005
@@ -29,7 +29,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.portal.persistence.castor.CastorSourceConverter;
+import org.apache.cocoon.portal.persistence.Converter;
 import org.apache.cocoon.portal.profile.ProfileLS;
 import org.apache.cocoon.util.NetUtils;
 import org.apache.cocoon.xml.dom.DOMUtil;
@@ -130,13 +130,16 @@
         final String uri = this.getURI( keyMap );
 
 		Source source = null;
-		CastorSourceConverter converter = null;
+		Converter converter = null;
         SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
 		try {
 			source = resolver.resolveURI(uri);
-            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
+            converter = (Converter) this.manager.lookup(Converter.ROLE);
 
-			return converter.getObject(source.getInputStream(), parameters);
+			return converter.getObject(source.getInputStream(),
+                                       (String)parameters.get(PARAMETER_PROFILETYPE),
+                                       (Map)parameters.get(PARAMETER_OBJECTMAP),
+                                       null);
 		} finally {
             if ( resolver != null ) {
                 resolver.release(source);
@@ -156,14 +159,17 @@
 
         // first test: modifiable source?
         SourceResolver resolver = null;
-        CastorSourceConverter converter = null;
+        Converter converter = null;
         Source source = null;
         try {
             resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
             source = resolver.resolveURI(uri);
             if ( source instanceof ModifiableSource ) {
-                converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
-                converter.storeObject( ((ModifiableSource)source).getOutputStream(), parameters,
profile);
+                converter = (Converter) this.manager.lookup(Converter.ROLE);
+                converter.storeObject( ((ModifiableSource)source).getOutputStream(),
+                                        (String)parameters.get(PARAMETER_PROFILETYPE),
+                                        profile,
+                                        parameters);
                 return;
             }
         } finally {
@@ -181,10 +187,13 @@
 		SAXParser parser = null;
 		try {
             resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
+            converter = (Converter) this.manager.lookup(Converter.ROLE);
 
             ByteArrayOutputStream writer = new ByteArrayOutputStream();
-            converter.storeObject(writer, parameters, profile);
+            converter.storeObject(writer,
+                                  (String)parameters.get(PARAMETER_PROFILETYPE),
+                                  profile,
+                                  parameters);
 
             buffer.append("&content=");
             try {

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/serialization/IncludingHTMLSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/serialization/IncludingHTMLSerializer.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/serialization/IncludingHTMLSerializer.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/serialization/IncludingHTMLSerializer.java
Tue Oct 25 12:08:53 2005
@@ -40,16 +40,16 @@
     extends HTMLSerializer {
 	
     public static final ThreadLocal portlets = new ThreadLocal();
-    
+
     public static final String NAMESPACE = "http://apache.org/cocoon/portal/include";
-    
+
     protected LinkedList orderedPortletList = new LinkedList();
-    
+
     protected static final char token = '~';
-    
+
     protected static final char[] tokens = new char[] {token, token};
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
      */
     public void recycle() {
@@ -62,7 +62,7 @@
     }
 
     /**
-     * Add a portlet
+     * Add a portlet.
      */
     public static void addPortlet(String name, String content) {
         Map map = (Map) portlets.get();
@@ -72,8 +72,8 @@
         }
         map.put(name, content);
     }
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
      */
     public void endElement(String uri, String loc, String raw)
@@ -83,7 +83,7 @@
         }
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String,
org.xml.sax.Attributes)
      */
     public void startElement(String uri, String loc, String raw, Attributes a)
@@ -105,7 +105,7 @@
         }
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapOutputComponent#setOutputStream(java.io.OutputStream)
      */
     public void setOutputStream(OutputStream stream) throws IOException {
@@ -114,14 +114,14 @@
 
 }
 class ReplacingOutputStream extends OutputStream {
-    
+
     /** Stream */
     protected final OutputStream stream;
-    
+
     protected boolean inKey;
-    
+
     protected final LinkedList orderedValues;
-    
+
     /**
      * Constructor
      */
@@ -130,22 +130,22 @@
         this.orderedValues = values;
         this.inKey = false;
     }
-    
-    /* (non-Javadoc)
+
+    /**
      * @see java.io.OutputStream#close()
      */
     public void close() throws IOException {
         this.stream.close();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see java.io.OutputStream#flush()
      */
     public void flush() throws IOException {
         this.stream.flush();
     }
 
-    /* (non-Javadoc)
+    /* *
      * @see java.io.OutputStream#write(byte[], int, int)
      */
     public void write(byte[] b, int off, int len) throws IOException {
@@ -196,14 +196,14 @@
         } while (!end);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see java.io.OutputStream#write(byte[])
      */
     public void write(byte[] b) throws IOException {
         this.write(b, 0, b.length);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see java.io.OutputStream#write(int)
      */
     public void write(int b) throws IOException {
@@ -231,4 +231,3 @@
         }        
     }
 }
-

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSource.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSource.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSource.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSource.java Tue
Oct 25 12:08:53 2005
@@ -48,30 +48,30 @@
     implements Source, XMLizable, Serviceable, Contextualizable {
 
     protected ServiceManager manager;
-    
+
     protected Context context;
-    
+
     protected String uri;
     protected String copletControllerName;
     protected CopletInstanceData copletInstanceData;
-    
+
     /** The used protocol */
     protected String scheme;
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
     public void contextualize(Context context) throws ContextException {
         this.context = context;
     }
-    
+
     public CopletSource(String location, String protocol,
                          CopletInstanceData coplet) {
         this.uri = location;
@@ -79,7 +79,7 @@
         this.copletInstanceData = coplet;
         this.copletControllerName = this.copletInstanceData.getCopletData().getCopletBaseData().getCopletAdapterName();
     }
-    
+
 	/**
 	 * @see org.apache.excalibur.source.Source#getInputStream()
 	 */
@@ -188,5 +188,4 @@
     public String getScheme() {
         return this.scheme;
     }
-
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSourceFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSourceFactory.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSourceFactory.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/source/CopletSourceFactory.java
Tue Oct 25 12:08:53 2005
@@ -44,30 +44,30 @@
 
     protected ServiceManager manager;
     protected Context context;
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.manager = serviceManager;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
     public void contextualize(Context context) throws ContextException {
         this.context = context;
     }
-    
+
 	/**
 	 * @see org.apache.excalibur.source.SourceFactory#getSource(String, Map)
 	 */
 	public Source getSource(String location, Map parameters)
-		throws MalformedURLException, IOException {
-        
+    throws MalformedURLException, IOException {
+
         String uri = location;
         String protocol = null;
-        
+
         // remove the protocol
         int position = location.indexOf(':') + 1;
         if (position != 0) {
@@ -102,5 +102,4 @@
     public void release(Source source) {
         // nothing to do 
     }
-
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java?rev=328453&r1=328452&r2=328453&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/copletManagement/generation/XMLProfileGenerator.java
Tue Oct 25 12:08:53 2005
@@ -27,8 +27,9 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.flow.FlowHelper;
 import org.apache.cocoon.generation.ServiceableGenerator;
-import org.apache.cocoon.portal.persistence.castor.CastorSourceConverter;
-import org.apache.cocoon.portal.persistence.castor.ConverterException;
+import org.apache.cocoon.portal.persistence.Converter;
+import org.apache.cocoon.portal.persistence.ConverterException;
+import org.apache.cocoon.portal.profile.ProfileLS;
 import org.apache.commons.jxpath.DynamicPropertyHandler;
 import org.apache.commons.jxpath.JXPathBeanInfo;
 import org.apache.commons.jxpath.JXPathIntrospector;
@@ -50,7 +51,7 @@
     public void generate()
     throws IOException, SAXException, ProcessingException {
         SAXParser parser = null;
-        CastorSourceConverter converter = null;
+        Converter converter = null;
         final Object context = FlowHelper.getContextObject(this.objectModel);
         Map myMap = new HashMap();
         if (context instanceof Map) {
@@ -60,11 +61,14 @@
         }
         try {
         	Object layout = myMap.get("layout");
-        	converter = (CastorSourceConverter) this.manager.lookup(org.apache.cocoon.portal.persistence.castor.CastorSourceConverter.ROLE);
+        	converter = (Converter) this.manager.lookup(Converter.ROLE);
         	ByteArrayOutputStream os = new java.io.ByteArrayOutputStream();
         	HashMap para = new HashMap();
         	para.put("profiletype", "layout");
-        	converter.storeObject(os, para, layout);
+        	converter.storeObject(os, 
+                                  (String)para.get(ProfileLS.PARAMETER_PROFILETYPE),
+                                  layout,
+                                  null);
         	String xml = new String();
         	xml = os.toString();
             final InputSource inputSource = new InputSource(new StringReader(xml));



Mime
View raw message