You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/07/10 15:17:08 UTC
cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/components/persistance CastorSourceConverter.java
cziegeler 2003/07/10 06:17:08
Modified: src/java/org/apache/cocoon/selection ExceptionSelector.java
XPathExceptionSelector.java
JXPathExceptionSelector.java
src/blocks/portal/java/org/apache/cocoon/portal/util
AspectDataFieldHandler.java DeltaApplicable.java
ParameterFieldHandler.java
AttributesFieldHandler.java
CopletDataFieldHandler.java
CopletInstanceDataReferenceFieldHandler.java
ReferenceFieldHandler.java
ConfigurationFieldHandler.java
CopletBaseDataFieldHandler.java
CopletDataReferenceFieldHandler.java MapItem.java
CopletInstanceDataFieldHandler.java
CopletBaseDataReferenceFieldHandler.java
DeltaApplicableReferencesAdjustable.java
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl
DefaultLinkRenderer.java
src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
CopletDataManager.java StaticProfileManager.java
CopletInstanceDataManager.java
AuthenticationProfileManager.java
CopletBaseDataManager.java
src/java/org/apache/cocoon/components/treeprocessor/sitemap
ErrorHandlerHelper.java PipelinesNodeBuilder.java
MountNode.java PipelineNode.java PipelinesNode.java
src/java/org/apache/cocoon/environment/wrapper
EnvironmentWrapper.java
src/samples/org/apache/cocoon/samples/errorhandling
ValidationException.java ExceptionGenerator.java
ApplicationException.java
src/blocks/portal/java/org/apache/cocoon/portal/impl
PortalManagerImpl.java
src/blocks/portal/java/org/apache/cocoon/portal/coplet
CopletData.java CopletBaseData.java
CopletInstanceData.java
src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input
CopletModule.java
src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl
FullScreenCopletEventAspect.java
FrameEventAspect.java
src/java/org/apache/cocoon/environment Environment.java
AbstractEnvironment.java
src/blocks/portal/java/org/apache/cocoon/portal/acting
ObjectModelAction.java
src/blocks/portal/java/org/apache/cocoon/portal/layout/impl
LinkLayout.java
src/java/org/apache/cocoon/components
CocoonComponentManager.java
src/blocks/portal/java/org/apache/cocoon/portal/transformation
CopletTransformer.java EventLinkTransformer.java
src/blocks/portal/java/org/apache/cocoon/portal/event/impl
CopletLinkEvent.java
src/blocks/portal/java/org/apache/cocoon/portal/profile
ProfileManager.java ProfileLS.java
src/blocks/portal/conf portal.xconf
src/blocks/portal/java/org/apache/cocoon/portal
Constants.java
src/blocks/portal/java/org/apache/cocoon/components/persistance
CastorSourceConverter.java
Added: src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
MapProfileLS.java AbstractProfileManager.java
AbstractUserProfileManager.java
src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl
LinkEventAspect.java
Removed: src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
MapSourceAdapter.java
Log:
Start refactoring of portal profile loading
Remove umlaute in author names, fixing bug 21466
Revision Changes Path
1.5 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/selection/ExceptionSelector.java
Index: ExceptionSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/selection/ExceptionSelector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ExceptionSelector.java 7 May 2003 05:09:38 -0000 1.4
+++ ExceptionSelector.java 10 Jul 2003 13:16:55 -0000 1.5
@@ -83,8 +83,8 @@
* Note that both "name" and "unroll" can be specified. In that case, we first try to unroll the exception,
* and if none of the causes has a name, then the "name" attribute is considered.
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @since 2.1
* @version CVS $Id$
1.5 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/selection/XPathExceptionSelector.java
Index: XPathExceptionSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/selection/XPathExceptionSelector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathExceptionSelector.java 8 May 2003 10:13:02 -0000 1.4
+++ XPathExceptionSelector.java 10 Jul 2003 13:16:55 -0000 1.5
@@ -83,8 +83,8 @@
* <li>the test is the xpath expression that will be evaluated against the exception ,</li>
* <li>an xpath expression can be given a name, which is used in the <map:when> tests,</li>
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @since 2.1
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/selection/JXPathExceptionSelector.java
Index: JXPathExceptionSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/selection/JXPathExceptionSelector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JXPathExceptionSelector.java 7 May 2003 05:09:38 -0000 1.2
+++ JXPathExceptionSelector.java 10 Jul 2003 13:16:55 -0000 1.3
@@ -82,7 +82,7 @@
* <li>the test is the xpath expression that will be evaluated against the exception ,</li>
* <li>an xpath expression can be given a name, which is used in the <map:when> tests,</li>
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
* @since 2.1
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AspectDataFieldHandler.java
Index: AspectDataFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AspectDataFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AspectDataFieldHandler.java 13 Jun 2003 14:20:10 -0000 1.2
+++ AspectDataFieldHandler.java 10 Jul 2003 13:16:55 -0000 1.3
@@ -60,7 +60,7 @@
/**
* Field handler for aspects of an Aspectizable object.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicable.java
Index: DeltaApplicable.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeltaApplicable.java 13 Jun 2003 14:20:09 -0000 1.3
+++ DeltaApplicable.java 10 Jul 2003 13:16:55 -0000 1.4
@@ -53,7 +53,7 @@
/**
* Interface for functionality of objects to be updated by a delta object.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ParameterFieldHandler.java
Index: ParameterFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ParameterFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParameterFieldHandler.java 13 Jun 2003 14:20:09 -0000 1.2
+++ ParameterFieldHandler.java 10 Jul 2003 13:16:55 -0000 1.3
@@ -61,7 +61,7 @@
/**
* Field handler for parameters.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AttributesFieldHandler.java
Index: AttributesFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/AttributesFieldHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AttributesFieldHandler.java 13 Jun 2003 14:20:10 -0000 1.3
+++ AttributesFieldHandler.java 10 Jul 2003 13:16:55 -0000 1.4
@@ -65,7 +65,7 @@
* FIXME This is a little bit hacky and should be changed by using
* reflection
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataFieldHandler.java
Index: CopletDataFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletDataFieldHandler.java 13 Jun 2003 14:20:09 -0000 1.2
+++ CopletDataFieldHandler.java 10 Jul 2003 13:16:55 -0000 1.3
@@ -61,7 +61,7 @@
/**
* Field handler for CopletData instances.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataReferenceFieldHandler.java
Index: CopletInstanceDataReferenceFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataReferenceFieldHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CopletInstanceDataReferenceFieldHandler.java 26 May 2003 14:29:52 -0000 1.1
+++ CopletInstanceDataReferenceFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.2
@@ -56,7 +56,7 @@
/**
* Field handler for external CopletInstanceData references.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
Index: ReferenceFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ReferenceFieldHandler.java 13 Jun 2003 14:20:10 -0000 1.2
+++ ReferenceFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -58,7 +58,7 @@
/**
* Field handler superclass for external references.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ConfigurationFieldHandler.java
Index: ConfigurationFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/ConfigurationFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConfigurationFieldHandler.java 13 Jun 2003 14:20:10 -0000 1.2
+++ ConfigurationFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -61,7 +61,7 @@
/**
* Field handler for attributes of a CopletBaseData object.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataFieldHandler.java
Index: CopletBaseDataFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletBaseDataFieldHandler.java 13 Jun 2003 14:20:10 -0000 1.2
+++ CopletBaseDataFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -61,7 +61,7 @@
/**
* Field handler for CopletBaseData instances.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataReferenceFieldHandler.java
Index: CopletDataReferenceFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletDataReferenceFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletDataReferenceFieldHandler.java 13 Jun 2003 14:20:09 -0000 1.2
+++ CopletDataReferenceFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -56,7 +56,7 @@
/**
* Field handler for external CopletData references.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/MapItem.java
Index: MapItem.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/MapItem.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MapItem.java 26 May 2003 14:29:52 -0000 1.1
+++ MapItem.java 10 Jul 2003 13:16:56 -0000 1.2
@@ -54,7 +54,7 @@
/**
* Used by the AspectDataFieldHandler for Castor.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataFieldHandler.java
Index: CopletInstanceDataFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletInstanceDataFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletInstanceDataFieldHandler.java 13 Jun 2003 14:20:09 -0000 1.2
+++ CopletInstanceDataFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -61,7 +61,7 @@
/**
* Field handler for CopletInstanceData instances.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataReferenceFieldHandler.java
Index: CopletBaseDataReferenceFieldHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/CopletBaseDataReferenceFieldHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletBaseDataReferenceFieldHandler.java 13 Jun 2003 14:20:09 -0000 1.2
+++ CopletBaseDataReferenceFieldHandler.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -56,7 +56,7 @@
/**
* Field handler for external CopletBaseData references.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicableReferencesAdjustable.java
Index: DeltaApplicableReferencesAdjustable.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/util/DeltaApplicableReferencesAdjustable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DeltaApplicableReferencesAdjustable.java 13 Jun 2003 14:20:10 -0000 1.2
+++ DeltaApplicableReferencesAdjustable.java 10 Jul 2003 13:16:56 -0000 1.3
@@ -55,7 +55,7 @@
* and where references to contained DeltaApplicable objects can be adjusted
* if no delta has been applied to them.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.2 +10 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java
Index: DefaultLinkRenderer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/impl/DefaultLinkRenderer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultLinkRenderer.java 7 May 2003 06:22:22 -0000 1.1
+++ DefaultLinkRenderer.java 10 Jul 2003 13:16:59 -0000 1.2
@@ -62,6 +62,7 @@
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
*
* @version CVS $Id$
*/
@@ -73,8 +74,14 @@
ProfileManager profileManager = null;
try {
profileManager = (ProfileManager)this.componentManager.lookup(ProfileManager.ROLE);
- final String layoutId = ((LinkLayout)layout).getLayoutId();
- this.processLayout(profileManager.getPortalLayout(layoutId), service, handler);
+ String layoutKey = (String)layout.getAspectData("link-layout-key");
+ String layoutId = (String)layout.getAspectData("link-layout-id");
+ if ( layoutKey == null && layoutId == null){
+ // get default values
+ layoutKey = ((LinkLayout)layout).getLayoutKey();
+ layoutId = ((LinkLayout)layout).getLayoutId();
+ }
+ this.processLayout(profileManager.getPortalLayout(layoutKey, layoutId), service, handler);
} catch (ComponentException ce) {
throw new SAXException("Unable to lookup profile manager.", ce);
} finally {
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java
Index: CopletDataManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletDataManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletDataManager.java 22 May 2003 15:19:42 -0000 1.3
+++ CopletDataManager.java 10 Jul 2003 13:16:59 -0000 1.4
@@ -60,7 +60,7 @@
/**
* Holds instances of CopletData.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.4 +184 -139 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
Index: StaticProfileManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StaticProfileManager.java 3 Jul 2003 08:27:47 -0000 1.3
+++ StaticProfileManager.java 10 Jul 2003 13:16:59 -0000 1.4
@@ -50,7 +50,6 @@
*/
package org.apache.cocoon.portal.profile.impl;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -58,149 +57,188 @@
import java.util.Map;
import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.cocoon.portal.PortalService;
-import org.apache.cocoon.portal.coplet.CopletBaseData;
import org.apache.cocoon.portal.coplet.CopletData;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
-import org.apache.cocoon.portal.layout.AbstractLayout;
import org.apache.cocoon.portal.layout.CompositeLayout;
import org.apache.cocoon.portal.layout.Item;
import org.apache.cocoon.portal.layout.Layout;
-import org.apache.cocoon.portal.layout.impl.CopletLayout;
-import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.portal.layout.LayoutFactory;
+import org.apache.cocoon.portal.profile.ProfileLS;
+import org.apache.commons.collections.SequencedHashMap;
import org.apache.excalibur.source.SourceValidity;
-import org.exolab.castor.mapping.Mapping;
-import org.exolab.castor.xml.Marshaller;
/**
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
*
* @version CVS $Id$
*/
-public class StaticProfileManager
- extends AbstractLogEnabled
- implements Composable, ProfileManager, ThreadSafe {
+public class StaticProfileManager
+ extends AbstractProfileManager
+ implements Configurable {
- protected ComponentManager componentManager;
+ protected String profilesPath;
- private Mapping layoutMapping;
+ protected String defaultLayoutGroup = null;
- private Map layoutStati = new HashMap(100);
-
- /**
- * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
- */
- public void compose(ComponentManager componentManager) throws ComponentException {
- this.componentManager = componentManager;
- }
+ protected static final String LAYOUTKEY_PREFIX =
+ StaticProfileManager.class.getName() + "/Layout/";
/**
- * @see ProfileManager#getPortalLayout(String)
+ * @see org.apache.cocoon.portal.profile.ProfileManager#getPortalLayout(String, String)
*/
- public Layout getPortalLayout(String key) {
+ public Layout getPortalLayout(String layoutKey, String layoutID) {
+ LayoutFactory factory = null;
PortalService service = null;
- MapSourceAdapter adapter = null;
+ ProfileLS adapter = null;
try {
- service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
-
- if ( null == key ) {
- Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
- if ( null != l) {
+ service = (PortalService) this.manager.lookup(PortalService.ROLE);
+
+ if (null == layoutID) {
+ Layout l =
+ (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
+ if (null != l) {
return l;
}
}
- Object[] objects = (Object[]) service.getAttribute(StaticProfileManager.class.getName() + "/Layout");
+ String serviceKey = null;
+ if (layoutKey == null) {
+ layoutKey = defaultLayoutGroup; // Default group to load
+ }
+ serviceKey =
+ LAYOUTKEY_PREFIX + service.getPortalName() + "/" + layoutKey;
+ if (layoutID == null) {
+ // look for the default key
+ // it is set with the id of the root layoutId of a layoutGroup
+ layoutID =
+ (String) service.getAttribute(serviceKey + "defaultKey");
+ }
- Map map = new HashMap();
- map.put("profile", "layout");
- map.put("portalname", service.getPortalName());
+ Object[] objects = (Object[]) service.getAttribute(serviceKey);
+ // check if the layout is already cached and still valid
int valid = SourceValidity.INVALID;
SourceValidity sourceValidity = null;
if (objects != null) {
sourceValidity = (SourceValidity) objects[1];
valid = sourceValidity.isValid();
+ Layout layout = null;
if (valid == SourceValidity.VALID)
- return (Layout) objects[0];
+ layout = (Layout) ((Map) objects[0]).get(layoutID);
+ if (layout != null)
+ return layout;
}
- adapter = (MapSourceAdapter) this.componentManager.lookup(MapSourceAdapter.ROLE);
- Map param = new HashMap();
- param.put("portalname", service.getPortalName());
- SourceValidity newValidity = adapter.getValidity(param, map);
- if (valid == SourceValidity.UNKNWON) {
- if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
- return (Layout) objects[0];
+ adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
+
+ Map parameters = new HashMap();
+ parameters.put("profiletype", "layout");
+
+ Map map = new SequencedHashMap();
+ map.put("base", "context://" + this.profilesPath);
+ map.put("portalname", service.getPortalName());
+ map.put("profile", "layout");
+ map.put("groupKey", layoutKey);
+
+ SourceValidity newValidity = adapter.getValidity(map, parameters);
+ if (valid == SourceValidity.UNKNOWN) {
+ if (sourceValidity.isValid(newValidity)
+ == SourceValidity.VALID) {
+ // XXX what if objects is null ? Could it be ?
+ return (Layout) ((Map) objects[0]).get(layoutID);
+ }
+ }
+
+ // get Layout specified in the map
+ Layout layout = (Layout) adapter.loadProfile(map, parameters);
+ Map layouts = null;
+ if (objects != null) {
+ layouts = (Map) objects[0];
+ } else {
+ layouts = new HashMap();
}
- Layout layout = (Layout) adapter.loadProfile(param, map);
+ // save the root layout as default of an group if no key is given
+ service.setAttribute(serviceKey + "defaultKey", layout.getId());
+ cacheLayouts(layouts, layout);
+
+ factory = (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);
+ factory.prepareLayout(layout);
+
+ // store the new values in the service
if (newValidity != null) {
- objects = new Object[] { layout, newValidity };
- service.setAttribute(StaticProfileManager.class.getName() + "/Layout", objects);
+ objects = new Object[] { layouts, newValidity };
+ service.setAttribute(serviceKey, objects);
+ }
+
+ // is the default layout wanted ?
+ if ((layout.getId().equals(layoutID)) || layoutID == null) {
+ return layout;
}
- // resolve parents
- resolveParents(layout, null);
- return layout;
+
+ // or a layout in the group ?
+ return (Layout) layouts.get(layoutID);
+
} catch (Exception ce) {
// TODO
throw new CascadingRuntimeException("Arg", ce);
} finally {
- this.componentManager.release(service);
- this.componentManager.release(adapter);
+ this.manager.release(service);
+ this.manager.release((Component)adapter);
+ }
+ }
+
+ /**
+ * @param layoutMap
+ * @param layout
+ */
+ private void cacheLayouts(Map layoutMap, Layout layout) {
+ if (layout != null) {
+ if (layout.getId() != null) {
+ String layoutId = layout.getId();
+ layoutMap.put(layoutId, layout);
+ }
+ if (layout instanceof CompositeLayout) {
+ // step through all it's child layouts and cache them too
+ CompositeLayout cl = (CompositeLayout) layout;
+ Iterator i = cl.getItems().iterator();
+ while (i.hasNext()) {
+ Item current = (Item) i.next();
+ this.cacheLayouts(layoutMap, current.getLayout());
+ }
+ }
}
+
}
public CopletInstanceData getCopletInstanceData(String copletID) {
PortalService service = null;
- String key = null;
+ String attribute = null;
try {
- service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
- key = service.getPortalName() + ":" + copletID;
+ service = (PortalService) this.manager.lookup(PortalService.ROLE);
- Map coplets = (Map) service.getAttribute(StaticProfileManager.class.getName() + "/Coplets");
- if (null == coplets) {
- coplets = new HashMap();
- service.setAttribute(StaticProfileManager.class.getName() + "/Coplets", coplets);
- }
-
- CopletInstanceData cid = (CopletInstanceData) coplets.get(key);
- if (null == cid) {
- CopletBaseData base = new CopletBaseData();
- base.setId("URICoplet");
- base.setCopletAdapterName("uri");
- cid = new CopletInstanceData();
- CopletData cd = new CopletData();
- cd.setName(copletID);
- cid.setCopletData(cd);
- cid.setId(copletID); // TODO generate unique copletID
- cid.getCopletData().setCopletBaseData(base);
- cid.getCopletData().setAttribute("uri", copletID);
- cid.getCopletData().setTitle(copletID);
- coplets.put(key, cid);
-
- Marshaller marshaller;
- try {
- marshaller = new Marshaller(new PrintWriter(System.out));
- marshaller.setSuppressXSIType(true);
- marshaller.setMapping(layoutMapping);
- marshaller.marshal(cid);
- } catch (Exception e) {
- //e.printStackTrace();
- }
- }
- return cid;
+ attribute =
+ StaticProfileManager.class.getName()
+ + "/"
+ + service.getPortalName()
+ + "/CopletInstanceData";
+ CopletInstanceDataManager copletInstanceDataManager =
+ (CopletInstanceDataManager) service.getAttribute(attribute);
+
+ return copletInstanceDataManager.getCopletInstanceData(copletID);
} catch (ComponentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- throw new CascadingRuntimeException("CE", e);
+ throw new CascadingRuntimeException(
+ "Unable to lookup portal service.",
+ e);
} finally {
- this.componentManager.release(service);
+ this.manager.release(service);
}
}
@@ -209,82 +247,89 @@
PortalService service = null;
String attribute = null;
try {
- service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
-
- Map allCoplets = (Map) service.getAttribute(StaticProfileManager.class.getName() + "/Coplets");
- if (null != allCoplets) {
+ service = (PortalService) this.manager.lookup(PortalService.ROLE);
- Iterator iter = allCoplets.values().iterator();
- while ( iter.hasNext() ) {
- CopletInstanceData current = (CopletInstanceData)iter.next();
- if ( current.getCopletData().equals(data) ) {
- coplets.add( current );
- }
+ attribute =
+ StaticProfileManager.class.getName()
+ + "/"
+ + service.getPortalName()
+ + "/CopletInstanceData";
+ CopletInstanceDataManager copletInstanceDataManager =
+ (CopletInstanceDataManager) service.getAttribute(attribute);
+
+ Iterator iter =
+ copletInstanceDataManager
+ .getCopletInstanceData()
+ .values()
+ .iterator();
+ while (iter.hasNext()) {
+ CopletInstanceData current = (CopletInstanceData) iter.next();
+ if (current.getCopletData().equals(data)) {
+ coplets.add(current);
}
}
return coplets;
} catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
+ throw new CascadingRuntimeException(
+ "Unable to lookup portal service.",
+ e);
} finally {
- this.componentManager.release(service);
+ this.manager.release(service);
}
}
- public void setDefaultLayout(Layout object) {
+ public void setEntryLayout(Layout object) {
PortalService service = null;
try {
- service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
+ service = (PortalService) this.manager.lookup(PortalService.ROLE);
service.setTemporaryAttribute("DEFAULT_LAYOUT", object);
} catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup service manager.", e);
+ throw new CascadingRuntimeException(
+ "Unable to lookup service manager.",
+ e);
} finally {
- this.componentManager.release(service);
+ this.manager.release(service);
}
}
- private void resolveParents(final Layout layout, final Item item) {
- String id = layout.getId();
- if ( id == null ) {
- id = Integer.toString(layout.hashCode());
- ((AbstractLayout)layout).setId(id);
- }
- if (layout instanceof CompositeLayout) {
-
- final CompositeLayout compositeLayout = (CompositeLayout) layout;
-
- for (int j = 0; j < compositeLayout.getSize(); j++) {
- final Item layoutItem = (Item) compositeLayout.getItem(j);
- layoutItem.setParent(compositeLayout);
- this.resolveParents(layoutItem.getLayout(), layoutItem);
- }
- }
- if (layout instanceof CopletLayout) {
- final CopletLayout cl = (CopletLayout)layout;
- final CopletInstanceData cid = this.getCopletInstanceData(cl.getId());
- cl.setCopletInstanceData(cid);
- }
- layout.setParent(item);
- }
-
public void register(CopletInstanceData coplet) {
}
-
+
public void unregister(CopletInstanceData coplet) {
}
public void register(Layout layout) {
}
-
+
public void unregister(Layout layout) {
}
public void saveUserProfiles() {
}
-
- public void login() {
+
+ public void configure(Configuration configuration)
+ throws ConfigurationException {
+ Configuration child = configuration.getChild("default-layout-group");
+ if (child != null) {
+ // get configured default LayoutGroup
+ defaultLayoutGroup = child.getValue();
+ }
+
+ if (this.defaultLayoutGroup == null) {
+ // if none is configured set it to "portal"
+ this.defaultLayoutGroup = "portal";
+ }
+ child = configuration.getChild("profiles-path");
+ if (child != null) {
+ this.profilesPath = child.getValue();
+ }
+ if ( this.profilesPath == null ) {
+ this.profilesPath = "samples/simple-portal/profiles";
+ }
}
-
- public void logout() {
+
+ public Layout getPortalLayout(String key) {
+ return getPortalLayout(null, key);
}
-
+
}
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletInstanceDataManager.java
Index: CopletInstanceDataManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletInstanceDataManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletInstanceDataManager.java 26 May 2003 14:29:53 -0000 1.3
+++ CopletInstanceDataManager.java 10 Jul 2003 13:16:59 -0000 1.4
@@ -58,7 +58,7 @@
/**
* Holds instances of CopletInstanceData.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.8 +191 -424 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
Index: AuthenticationProfileManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AuthenticationProfileManager.java 3 Jul 2003 08:27:47 -0000 1.7
+++ AuthenticationProfileManager.java 10 Jul 2003 13:16:59 -0000 1.8
@@ -50,36 +50,30 @@
*/
package org.apache.cocoon.portal.profile.impl;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentSelector;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.portal.PortalService;
-import org.apache.cocoon.portal.coplet.CopletData;
import org.apache.cocoon.portal.coplet.CopletFactory;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
-import org.apache.cocoon.portal.layout.CompositeLayout;
-import org.apache.cocoon.portal.layout.Item;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.layout.LayoutFactory;
-import org.apache.cocoon.portal.profile.ProfileManager;
+import org.apache.cocoon.portal.profile.ProfileLS;
import org.apache.cocoon.portal.util.DeltaApplicableReferencesAdjustable;
import org.apache.cocoon.webapps.authentication.AuthenticationManager;
import org.apache.cocoon.webapps.authentication.user.RequestState;
import org.apache.cocoon.webapps.authentication.user.UserHandler;
+import org.apache.commons.collections.SequencedHashMap;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.excalibur.source.SourceNotFoundException;
import org.apache.excalibur.source.SourceValidity;
@@ -87,31 +81,23 @@
/**
* The profile manager using the authentication framework
*
- * FIXME - create abstract base class
- *
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
public class AuthenticationProfileManager
- extends AbstractLogEnabled
- implements Composable, ProfileManager, ThreadSafe {
-
- protected ComponentManager manager;
+ extends AbstractUserProfileManager {
- private Map attributes = new HashMap();
+ protected ReadWriteLock lock = new ReadWriteLock();
- private ReadWriteLock lock = new ReadWriteLock();
+ protected Map attributes = new HashMap();
/**
- * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
+ * Get the current authentication state of the user
+ * @return
*/
- public void compose(ComponentManager componentManager) throws ComponentException {
- this.manager = componentManager;
- }
-
- public RequestState getRequestState() {
+ protected RequestState getRequestState() {
AuthenticationManager authManager = null;
try {
authManager = (AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
@@ -123,248 +109,133 @@
this.manager.release( (Component)authManager );
}
}
-
- public void login() {
- // TODO - we should move most of the stuff from getPortalLayout to here
- // for now we use a hack :)
- this.getPortalLayout(null);
- }
-
- public void logout() {
- PortalService service = null;
- String attribute = null;
- ComponentSelector adapterSelector = null;
- try {
- adapterSelector = (ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
- service = (PortalService)this.manager.lookup(PortalService.ROLE);
-
- String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
-
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(portalPrefix+"/CopletInstanceData");
- Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
- while ( iter.hasNext() ) {
- CopletInstanceData cid = (CopletInstanceData) iter.next();
- CopletAdapter adapter = null;
- try {
- adapter = (CopletAdapter)adapterSelector.select(cid.getCopletData().getCopletBaseData().getCopletAdapterName());
- adapter.logout( cid );
- } finally {
- adapterSelector.release( adapter );
- }
- }
-
- service.removeAttribute(portalPrefix+"/CopletData");
- service.removeAttribute(portalPrefix+"/CopletInstanceData");
- service.removeAttribute(portalPrefix+"/Layout");
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- this.manager.release(adapterSelector);
- }
- }
-
+
/**
- * @see ProfileManager#getPortalLayout(String)
+ * This loads a new profile
*/
- public Layout getPortalLayout(String key) {
- PortalService service = null;
- LayoutFactory factory = null;
- CopletFactory copletFactory = null;
- ComponentSelector adapterSelector = null;
-
+ protected Layout loadProfile(String layoutKey,
+ PortalService service,
+ CopletFactory copletFactory,
+ LayoutFactory layoutFactory,
+ ComponentSelector adapterSelector)
+ throws Exception {
+ final RequestState state = this.getRequestState();
+ final UserHandler handler = state.getHandler();
+ final Configuration config = state.getApplicationConfiguration().getConfiguration("portal").getChild("profiles");
+
+ HashMap parameters = new HashMap();
+ parameters.put("config", config);
+ parameters.put("handler", handler);
+ CopletDataManager copletDataManager = null;
+ Map keyMap;
try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- factory = (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);
- copletFactory = (CopletFactory) this.manager.lookup(CopletFactory.ROLE);
- adapterSelector = (ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
-
- if ( null == key ) {
- Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
- if ( null != l) {
- return l;
- }
- }
-
- String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
- Layout layout = null;
+
+ this.lock.readLock();
- if ( key != null ) {
- // now search for a layout
- Map layoutMap = (Map)service.getAttribute("layout-map");
- if ( layoutMap == null ) {
- layout = (Layout)service.getAttribute(portalPrefix+"/Layout");
- if (layout != null) {
- layoutMap = new HashMap();
- this.cacheLayouts(layoutMap, layout);
- service.setAttribute("layout-map", layoutMap);
- }
- }
- if ( layoutMap != null) {
- layout = (Layout) layoutMap.get( key );
- if ( layout != null) {
- return layout;
- }
- }
- }
-
-
- layout = (Layout)service.getAttribute(portalPrefix+"/Layout");
- if (layout == null) {
- this.lock.readLock();
- HashMap map = new HashMap();
- HashMap keyMap = new HashMap();
- CopletDataManager copletDataManager = null;
- try {
- map.put("portalname", service.getPortalName());
-
- // TODO Change to KeyManager usage
- RequestState state = this.getRequestState();
- UserHandler handler = state.getHandler();
- keyMap.put("user", handler.getUserId());
- keyMap.put("role", handler.getContext().getContextInfo().get("role"));
- keyMap.put("config", state.getApplicationConfiguration().getConfiguration("portal"));
-
- // load coplet base data
- map.put("profile", "copletbasedata");
- map.put("objectmap", null);
- Object[] result = this.getProfile(keyMap, map, portalPrefix+"/CopletBaseData", null);
- CopletBaseDataManager copletBaseDataManager = (CopletBaseDataManager)result[0];
-
- // load coplet data
- map.put("profile", "copletdata");
- map.put("objectmap", copletBaseDataManager.getCopletBaseData());
- copletDataManager = (CopletDataManager)this.getDeltaProfile(keyMap, map, portalPrefix+"/CopletData", service, copletFactory, ((Boolean)result[1]).booleanValue());
-
- } finally {
- this.lock.releaseLocks();
- }
- // load coplet instance data
- map.put("profile", "copletinstancedata");
- map.put("objectmap", copletDataManager.getCopletData());
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)this.getOrCreateProfile(keyMap, map, portalPrefix+"/CopletInstanceData", service, copletFactory);
-
- // load layout
- map.put("profile", "layout");
- map.put("objectmap", copletInstanceDataManager.getCopletInstanceData());
- layout = (Layout)this.getOrCreateProfile(keyMap, map, portalPrefix+"/Layout", service, factory);
-
- // now invoke login on each instance
- Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
- while ( iter.hasNext() ) {
- CopletInstanceData cid = (CopletInstanceData) iter.next();
- CopletAdapter adapter = null;
- try {
- adapter = (CopletAdapter) adapterSelector.select(cid.getCopletData().getCopletBaseData().getCopletAdapterName());
- adapter.login( cid );
- } finally {
- adapterSelector.release( adapter );
- }
- }
- }
-
- return layout;
- } catch (Exception ce) {
- // TODO
- throw new CascadingRuntimeException("Arg", ce);
+ // load coplet base data
+ parameters.put("profiletype", "copletbasedata");
+ parameters.put("objectmap", null);
+
+ Object[] result = this.getProfile(layoutKey, parameters, null, false, service);
+ CopletBaseDataManager copletBaseDataManager = (CopletBaseDataManager)result[0];
+
+ // load coplet data
+ parameters.put("profiletype", "copletdata");
+ parameters.put("objectmap", copletBaseDataManager.getCopletBaseData());
+ copletDataManager = (CopletDataManager)this.getDeltaProfile(layoutKey, parameters, service, copletFactory, ((Boolean)result[1]).booleanValue());
+
} finally {
- this.manager.release(service);
- this.manager.release((Component)factory);
- this.manager.release((Component)copletFactory);
- this.manager.release(adapterSelector);
+ this.lock.releaseLocks();
}
- }
-
- /**
- * @param layoutMap
- * @param layout
- */
- private void cacheLayouts(Map layoutMap, Layout layout) {
- if ( layout != null ) {
- if ( layout.getId() != null ) {
- layoutMap.put( layout.getId(), layout );
- }
- if ( layout instanceof CompositeLayout ) {
- CompositeLayout cl = (CompositeLayout)layout;
- Iterator i = cl.getItems().iterator();
- while ( i.hasNext() ) {
- Item current = (Item)i.next();
- this.cacheLayouts( layoutMap, current.getLayout() );
- }
+ // load coplet instance data
+ parameters.put("profiletype", "copletinstancedata");
+ parameters.put("objectmap", copletDataManager.getCopletData());
+ CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)this.getOrCreateProfile(layoutKey, parameters, service, copletFactory);
+ service.setAttribute("CopletInstanceData:" + layoutKey, copletInstanceDataManager);
+
+ // load layout
+ parameters.put("profiletype", "layout");
+ parameters.put("objectmap", copletInstanceDataManager.getCopletInstanceData());
+ Layout layout = (Layout)this.getOrCreateProfile(layoutKey, parameters, service, layoutFactory);
+ service.setAttribute("Layout:" + layoutKey, layout);
+
+ // now invoke login on each instance
+ Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
+ while ( iter.hasNext() ) {
+ CopletInstanceData cid = (CopletInstanceData) iter.next();
+ CopletAdapter adapter = null;
+ try {
+ adapter = (CopletAdapter) adapterSelector.select(cid.getCopletData().getCopletBaseData().getCopletAdapterName());
+ adapter.login( cid );
+ } finally {
+ adapterSelector.release( adapter );
}
}
+ return layout;
}
-
+
public void saveUserProfiles() {
- MapSourceAdapter adapter = null;
+ final String layoutKey = this.getDefaultLayoutKey();
+ ProfileLS adapter = null;
PortalService service = null;
try {
- adapter = (MapSourceAdapter) this.manager.lookup(MapSourceAdapter.ROLE);
+ adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
service = (PortalService) this.manager.lookup(PortalService.ROLE);
- String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
-
- HashMap map = new HashMap();
- map.put("portalname", service.getPortalName());
- map.put("type", "user");
-
- // TODO Change to KeyManager usage
RequestState state = this.getRequestState();
- UserHandler handler = state.getHandler();
- HashMap key = new HashMap();
- key.put("user", handler.getUserId());
- key.put("role", handler.getContext().getContextInfo().get("role"));
- key.put("config", state.getApplicationConfiguration().getConfiguration("portal"));
+ UserHandler handler = state.getHandler();
+
+ HashMap parameters = new HashMap();
+ parameters.put("type", "user");
+ parameters.put("config", state.getApplicationConfiguration().getConfiguration("portal"));
+ parameters.put("handler", handler);
+ parameters.put("profiletype", "copletinstancedata");
+
+ Map key = this.buildKey(service, parameters, layoutKey, false);
// save coplet instance data
- map.put("profile", "copletinstancedata");
- Object profile = ((Object[])service.getAttribute(portalPrefix+"/CopletInstanceData"))[0];
- adapter.saveProfile(key, map, profile);
+ Object profile = ((Object[])service.getAttribute("CopletInstanceData:" + layoutKey))[0];
+ adapter.saveProfile(key, parameters, profile);
// save coplet instance data
- map.put("profile", "layout");
- profile = ((Object[])service.getAttribute(portalPrefix+"/Layout"))[0];
- adapter.saveProfile(key, map, profile);
+ parameters.put("profiletype", "layout");
+ key = this.buildKey(service, parameters, layoutKey, false);
+ profile = ((Object[])service.getAttribute("Layout:" + layoutKey))[0];
+ adapter.saveProfile(key, parameters, profile);
+
} catch (Exception e) {
// TODO
- throw new CascadingRuntimeException("Arg", e);
+ throw new CascadingRuntimeException("Exception during save profile", e);
} finally {
- this.manager.release(adapter);
+ this.manager.release((Component)adapter);
this.manager.release(service);
}
}
/**
- * Gets a profile.
- * @return result[0] is the profile, result[1] is a Boolean,
- * which signals whether the profile has been loaded or reused.
- */
- private Object[] getProfile(Object key, Map map, String location, Object factory)
- throws Exception {
- return this.getProfile(key, map, location, factory, false);
- }
-
- /**
* Gets a profile and applies possible user and role deltas to it.
*/
- private Object getDeltaProfile(Object key, Map map, String location, PortalService service, Object factory, boolean forcedLoad)
+ protected Object getDeltaProfile(String layoutKey,
+ Map parameters,
+ PortalService service,
+ Object factory,
+ boolean forcedLoad)
throws Exception {
+ Configuration config = (Configuration) parameters.get("config");
+
DeltaApplicableReferencesAdjustable result;
Object object;
-
- // TODO Change to KeyManager usage
- Map keyMap = (Map)key;
- // load global profile
- map.put("type", "global");
- Object global = this.getProfile(key, map, location, factory, forcedLoad)[0];
- result = (DeltaApplicableReferencesAdjustable)this.loadProfile(key, map, factory);
+ parameters.put("type", "global");
+ Object global = this.getProfile(layoutKey, parameters, factory, forcedLoad, service)[0];
+ Object key = this.buildKey(service, parameters, layoutKey, true);
+ result = (DeltaApplicableReferencesAdjustable)this.loadProfile(key, parameters, factory);
// load role delta
- map.put("type", "role");
+ parameters.put("type", "role");
try {
- object = this.getProfile(key, map, location+"-role-"+keyMap.get("role"), factory, forcedLoad)[0];
+ object = this.getProfile(layoutKey, parameters, factory, forcedLoad, service)[0];
if (object != null)
result.applyDelta(object);
} catch (Exception e) {
@@ -373,9 +244,10 @@
}
// load user delta
- map.put("type", "user");
+ parameters.put("type", "user");
try {
- object = this.loadProfile(key, map, factory);
+ key = this.buildKey(service, parameters, layoutKey, true);
+ object = this.loadProfile(key, parameters, factory);
if (object != null)
result.applyDelta(object);
} catch (Exception e) {
@@ -384,12 +256,13 @@
}
if (result == null)
- throw new SourceNotFoundException("Global "+keyMap.get("profile")+" does not exist.");
+ throw new SourceNotFoundException("Global profile does not exist.");
// change references to objects where no delta has been applied
result.adjustReferences(global);
- service.setAttribute(location, result);
+ // FIXME
+ this.attributes.put(key, result);
return result;
}
@@ -397,47 +270,49 @@
/**
* Gets a user profile and creates it by copying the role or the global profile.
*/
- private Object getOrCreateProfile(Object key, Map map, String location, PortalService service, Object factory)
+ protected Object getOrCreateProfile(String layoutKey, Map parameters, PortalService service, Object factory)
throws Exception {
Object result;
- // TODO Change to KeyManager usage
- Map keyMap = (Map)key;
-
// load user profile
- map.put("type", "user");
+ parameters.put("type", "user");
+ Map keyMap = this.buildKey(service, parameters, layoutKey, true);
try {
- result = this.loadProfile(key, map, factory);
+ result = this.loadProfile(keyMap, parameters, factory);
} catch (Exception e1) {
if (!isSourceNotFoundException(e1))
throw e1;
// load role profile
- map.put("type", "role");
+ parameters.put("type", "role");
+ keyMap = this.buildKey(service, parameters, layoutKey, true);
try {
- result = this.loadProfile(key, map, factory);
+ result = this.loadProfile(keyMap, parameters, factory);
} catch (Exception e2) {
if (!isSourceNotFoundException(e2))
throw e2;
// load global profile
- map.put("type", "global");
- result = this.loadProfile(key, map, factory);
+ parameters.put("type", "global");
+ keyMap = this.buildKey(service, parameters, layoutKey, true);
+ result = this.loadProfile(keyMap, parameters, factory);
}
// save profile as user profile
- MapSourceAdapter adapter = null;
+ ProfileLS adapter = null;
try {
- adapter = (MapSourceAdapter) this.manager.lookup(MapSourceAdapter.ROLE);
- map.put("type", "user");
+ adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
+ parameters.put("type", "user");
+ keyMap = this.buildKey(service, parameters, layoutKey, false);
- adapter.saveProfile(key, map, result);
+ //adapter.saveProfile(keyMap, parameters, result);
} finally {
- this.manager.release(adapter);
+ this.manager.release((Component)adapter);
}
}
- service.setAttribute(location, result);
+ // FIXME
+ this.attributes.put(keyMap, result);
return result;
}
@@ -447,13 +322,20 @@
* @return result[0] is the profile, result[1] is a Boolean,
* which signals whether the profile has been loaded or reused.
*/
- private Object[] getProfile(Object key, Map map, String location, Object factory, boolean forcedLoad)
+ protected Object[] getProfile(String layoutKey,
+ Map parameters,
+ Object factory,
+ boolean forcedLoad,
+ PortalService service)
throws Exception {
- MapSourceAdapter adapter = null;
+ final Map key = this.buildKey(service, parameters, layoutKey, true);
+
+ ProfileLS adapter = null;
try {
- adapter = (MapSourceAdapter)this.manager.lookup(MapSourceAdapter.ROLE);
+ adapter = (ProfileLS)this.manager.lookup(ProfileLS.ROLE);
- Object result = this.checkValidity(key, map, location, forcedLoad, adapter);
+ Object result = this.checkValidity(key, parameters, forcedLoad, adapter, service);
+
if (!(result instanceof SourceValidity))
return new Object[]{result, Boolean.FALSE};
SourceValidity newValidity = (SourceValidity)result;
@@ -462,28 +344,33 @@
this.lock.writeLock();
// check validity again in case of another thread has already loaded
- result = this.checkValidity(key, map, location, forcedLoad, adapter);
+ result = this.checkValidity(key, parameters, forcedLoad, adapter, service);
+
if (!(result instanceof SourceValidity))
return new Object[]{result, Boolean.FALSE};
newValidity = (SourceValidity)result;
- Object object = adapter.loadProfile(key, map);
+ Object object = adapter.loadProfile(key, parameters);
this.prepareObject(object, factory);
if (newValidity != null) {
- this.attributes.put(location, new Object[] {object, newValidity});
+ this.attributes.put(key, new Object[] {object, newValidity});
}
return new Object[]{object, Boolean.TRUE};
} finally {
- this.manager.release(adapter);
+ this.manager.release((Component) adapter);
}
}
/**
* If the profile is valid itself is returned, otherwise a newly created SourceValidity object is returned.
*/
- private Object checkValidity(Object key, Map map, String location, boolean forcedLoad, MapSourceAdapter adapter) {
- Object[] objects = (Object[])this.attributes.get(location);
+ protected Object checkValidity(Object key,
+ Map parameters,
+ boolean forcedLoad,
+ ProfileLS adapter,
+ PortalService service) {
+ Object[] objects = (Object[])this.attributes.get(key);
SourceValidity sourceValidity = null;
int valid = SourceValidity.INVALID;
@@ -494,7 +381,7 @@
return objects[0];
}
- SourceValidity newValidity = adapter.getValidity(key, map);
+ SourceValidity newValidity = adapter.getValidity(key, parameters);
if (!forcedLoad && valid == SourceValidity.UNKNWON) {
if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
return objects[0];
@@ -506,18 +393,18 @@
/**
* Loads a profile.
*/
- private Object loadProfile(Object key, Map map, Object factory)
+ protected Object loadProfile(Object key, Map map, Object factory)
throws Exception {
- MapSourceAdapter adapter = null;
+ ProfileLS adapter = null;
try {
- adapter = (MapSourceAdapter) this.manager.lookup(MapSourceAdapter.ROLE);
+ adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
Object object = adapter.loadProfile(key, map);
this.prepareObject(object, factory);
return object;
} finally {
- this.manager.release(adapter);
+ this.manager.release((Component) adapter);
}
}
@@ -531,168 +418,47 @@
return false;
}
- /**
- * Prepares the object by using the specified factory.
- */
- private void prepareObject(Object object, Object factory)
- throws ProcessingException {
- if (factory != null && object != null) {
- if (object instanceof Layout) {
- ((LayoutFactory)factory).prepareLayout((Layout)object);
- } else if (object instanceof CopletDataManager) {
- CopletFactory copletFactory = (CopletFactory)factory;
- Iterator iterator = ((CopletDataManager)object).getCopletData().values().iterator();
- while (iterator.hasNext()) {
- CopletData cd = (CopletData)iterator.next();
- copletFactory.prepare(cd);
- }
- } else if (object instanceof CopletInstanceDataManager) {
- CopletFactory copletFactory = (CopletFactory)factory;
- Iterator iterator = ((CopletInstanceDataManager)object).getCopletInstanceData().values().iterator();
- while (iterator.hasNext()) {
- CopletInstanceData cid = (CopletInstanceData)iterator.next();
- copletFactory.prepare(cid);
- }
- }
- }
- }
-
- public CopletInstanceData getCopletInstanceData(String copletID) {
- PortalService service = null;
- String attribute = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
-
- attribute = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName()+"/CopletInstanceData";
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
-
- return copletInstanceDataManager.getCopletInstanceData(copletID);
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- public List getCopletInstanceData(CopletData data) {
- List coplets = new ArrayList();
- PortalService service = null;
- String attribute = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
-
- attribute = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName()+"/CopletInstanceData";
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
-
- Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
- while ( iter.hasNext() ) {
- CopletInstanceData current = (CopletInstanceData)iter.next();
- if ( current.getCopletData().equals(data) ) {
- coplets.add( current );
- }
- }
- return coplets;
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- public void register(CopletInstanceData coplet) {
- PortalService service = null;
- String attribute = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
-
- attribute = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName()+"/CopletInstanceData";
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
-
- copletInstanceDataManager.putCopletInstanceData( coplet );
-
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- public void unregister(CopletInstanceData coplet) {
- PortalService service = null;
- String attribute = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
-
- attribute = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName()+"/CopletInstanceData";
- CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
-
- copletInstanceDataManager.getCopletInstanceData().remove(coplet.getId());
-
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- public void register(Layout layout) {
- PortalService service = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
-
- Map layoutMap = (Map)service.getAttribute("layout-map");
- if ( layoutMap == null ) {
- layout = (Layout)service.getAttribute(portalPrefix+"/Layout");
- if (layout != null) {
- layoutMap = new HashMap();
- this.cacheLayouts(layoutMap, layout);
- service.setAttribute("layout-map", layoutMap);
- }
+ protected Map buildKey(PortalService service,
+ Map parameters,
+ String layoutKey,
+ boolean load)
+ throws ProcessingException, ConfigurationException {
+
+ // TODO Change to KeyManager usage
+ final String type = (String)parameters.get("type");
+ final Configuration config = (Configuration) parameters.get("config");
+ final String profileType = (String)parameters.get("profiletype");
+ final String postFix = (load ? "load" : "save");
+ final UserHandler handler = (UserHandler)parameters.get("handler");
+
+ String uri = null;
+ if (type == null) {
+ uri = config.getChild(profileType + "-" + postFix).getAttribute("uri");
+ } else if (type.equals("global")) {
+ uri = config.getChild(profileType + "-global-" + postFix).getAttribute("uri");
+ } else if (type.equals("role")) {
+ uri = config.getChild(profileType + "-role-" + postFix).getAttribute("uri");
+ } else if (type.equals("user")) {
+ uri = config.getChild(profileType + "-user-" + postFix).getAttribute("uri");
+ }
+
+ Map key = new SequencedHashMap();
+ key.put("baseuri", uri);
+ key.put("separator", "?");
+ key.put("portal", service.getPortalName());
+ key.put("layout", layoutKey);
+ if ( type != null ) {
+ key.put("type", type);
+ if ( "role".equals(type) || "user".equals(type)) {
+ key.put("role", handler.getContext().getContextInfo().get("role"));
}
-
- if ( layoutMap != null) {
- layoutMap.put(layout.getId(), layout);
+ if ( "user".equals(type) ) {
+ key.put("user", handler.getUserId());
}
-
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- public void unregister(Layout layout) {
- PortalService service = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
-
- Map layoutMap = (Map)service.getAttribute("layout-map");
-
- if ( layoutMap != null) {
- layoutMap.remove(layout.getId());
- }
-
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup portal service.", e);
- } finally {
- this.manager.release(service);
}
+ return key;
}
- public void setDefaultLayout(Layout object) {
- PortalService service = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- service.setTemporaryAttribute("DEFAULT_LAYOUT", object);
- } catch (ComponentException e) {
- throw new CascadingRuntimeException("Unable to lookup service manager.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
class ReadWriteLock {
private Thread activeWriter = null;
private HashSet activeReaders = new HashSet();
@@ -756,4 +522,5 @@
}
}
}
-}
\ No newline at end of file
+
+}
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java
Index: CopletBaseDataManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletBaseDataManager.java 20 May 2003 14:32:36 -0000 1.2
+++ CopletBaseDataManager.java 10 Jul 2003 13:17:00 -0000 1.3
@@ -58,7 +58,7 @@
/**
* Holds instances of CopletBaseData.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/MapProfileLS.java
Index: MapProfileLS.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.portal.profile.impl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.persistance.CastorSourceConverter;
import org.apache.cocoon.portal.profile.ProfileLS;
import org.apache.cocoon.xml.dom.DOMUtil;
import org.apache.excalibur.source.ModifiableSource;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
import org.apache.excalibur.source.SourceUtil;
import org.apache.excalibur.source.SourceValidity;
import org.apache.excalibur.xml.sax.SAXParser;
import org.w3c.dom.Element;
/**
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
*
* @version CVS $Id: MapProfileLS.java,v 1.1 2003/07/10 13:16:59 cziegeler Exp $
*/
public class MapProfileLS
extends AbstractLogEnabled
implements Component, Composable, ProfileLS, ThreadSafe {
/** The component manager */
protected ComponentManager manager;
protected String getURI(Map keyMap, Map parameters)
throws Exception {
final StringBuffer buffer = new StringBuffer();
Iterator iter = keyMap.entrySet().iterator();
boolean pars = false;
boolean first = true;
while ( iter.hasNext() ) {
final Map.Entry entry = (Entry) iter.next();
if ( pars ) {
if ( first ) {
first = false;
if ( buffer.toString().indexOf('?') == -1 ) {
buffer.append('?');
} else {
buffer.append('&');
}
} else {
buffer.append('&');
}
buffer.append(entry.getKey().toString());
buffer.append('=');
} else {
if ( !first) {
buffer.append('/');
}
first = true;
}
String append = entry.getValue().toString();
if ( "?".equals(append) ) {
first = true;
pars = true;
} else {
buffer.append(append);
}
}
return buffer.toString();
}
protected StringBuffer getSaveURI(Map keyMap, Map parameters)
throws Exception {
final StringBuffer buffer = new StringBuffer((String)parameters.get("baseURI"));
Iterator iter = keyMap.values().iterator();
while ( iter.hasNext() ) {
final Object value = iter.next();
buffer.append('/');
buffer.append(value.toString());
}
return buffer;
}
/* (non-Javadoc)
* @see org.apache.cocoon.portal.profile.ProfileLS#loadProfile(java.lang.Object)
*/
public Object loadProfile(Object key, Map parameters)
throws Exception {
final Map keyMap = (Map) key;
final String uri = this.getURI( keyMap, parameters );
Source source = null;
CastorSourceConverter converter = null;
SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
try {
source = resolver.resolveURI(uri);
converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
return converter.getObject(source.getInputStream(), parameters);
} finally {
if ( resolver != null ) {
resolver.release(source);
}
manager.release(converter);
manager.release(resolver);
}
}
/* (non-Javadoc)
* @see org.apache.cocoon.portal.profile.ProfileLS#saveProfile(java.lang.Object, java.lang.Object)
*/
public void saveProfile(Object key, Map parameters, Object profile) throws Exception {
final Map keyMap = (Map) key;
final String uri = this.getURI( keyMap, parameters );
// first test: modifiable source?
SourceResolver resolver = null;
CastorSourceConverter 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);
return;
}
} finally {
if ( resolver != null ) {
resolver.release(source);
}
manager.release(converter);
manager.release(resolver);
source = null;
converter = null;
resolver = null;
}
final StringBuffer buffer = this.getSaveURI( keyMap, parameters );
SAXParser parser = null;
try {
resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
ByteArrayOutputStream writer = new ByteArrayOutputStream();
converter.storeObject(writer, parameters, profile);
buffer.append("&content=");
buffer.append(SourceUtil.encode(writer.toString()));
source = resolver.resolveURI(buffer.toString());
parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
Element element = DOMUtil.getDocumentFragment(parser, new InputStreamReader(source.getInputStream())).getOwnerDocument().getDocumentElement();
if (!DOMUtil.getValueOf(element, "descendant::sourceResult/execution").trim().equals("success")) {
throw new IOException("Could not save profile: "+DOMUtil.getValueOf(element, "descendant::sourceResult/message"));
}
} finally {
if ( resolver != null ) {
resolver.release(source);
}
manager.release((Component)parser);
manager.release(converter);
manager.release(resolver);
}
}
/* (non-Javadoc)
* @see org.apache.cocoon.portal.profile.ProfileLS#getValidity(java.lang.Object)
*/
public SourceValidity getValidity(Object key, Map parameters) {
SourceResolver resolver = null;
Source source = null;
try {
final Map keyMap = (Map) key;
final String uri = this.getURI( keyMap, parameters );
resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
source = resolver.resolveURI(uri);
return source.getValidity();
} catch (Exception e) {
getLogger().warn(e.getMessage(), e);
return null;
} finally {
if (resolver != null) {
resolver.release(source);
}
manager.release(resolver);
}
}
/* (non-Javadoc)
* @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager)
*/
public void compose(ComponentManager manager)
throws ComponentException {
this.manager = manager;
}
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
Index: AbstractProfileManager.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.portal.profile.impl;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.profile.ProfileManager;
/**
* Base class for all profile managers
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
*
* @version CVS $Id: AbstractProfileManager.java,v 1.1 2003/07/10 13:17:00 cziegeler Exp $
*/
public abstract class AbstractProfileManager
extends AbstractLogEnabled
implements Composable, ProfileManager, ThreadSafe {
public static final String DEFAULT_LAYOUT_KEY = "portal";
protected ComponentManager manager;
/**
* @see org.apache.avalon.framework.component.Composable#compose(ComponentManager)
*/
public void compose(ComponentManager componentManager) throws ComponentException {
this.manager = componentManager;
}
/**
* Change the default layout key for most functions
*/
public void setDefaultLayoutKey(String layoutKey) {
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
if ( layoutKey == null ) {
service.removeAttribute("default-layout-key");
} else {
service.setAttribute("default-layout-key", layoutKey);
}
} catch (ComponentException ce) {
// this should never happen
throw new CascadingRuntimeException("Unable to lookup portal service.", ce);
} finally {
this.manager.release(service);
}
}
/**
* Get the default layout key
*/
public String getDefaultLayoutKey() {
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
String defaultLayoutKey = (String)service.getAttribute("default-layout-key");
if ( defaultLayoutKey == null ) {
return DEFAULT_LAYOUT_KEY;
}
return defaultLayoutKey;
} catch (ComponentException ce) {
// this should never happen
throw new CascadingRuntimeException("Unable to lookup portal service.", ce);
} finally {
this.manager.release(service);
}
}
public void login() {
}
public void logout() {
}
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
Index: AbstractUserProfileManager.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.portal.profile.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.coplet.CopletData;
import org.apache.cocoon.portal.coplet.CopletFactory;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.coplet.adapter.CopletAdapter;
import org.apache.cocoon.portal.layout.CompositeLayout;
import org.apache.cocoon.portal.layout.Item;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.layout.LayoutFactory;
/**
* The profile manager using the authentication framework
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id: AbstractUserProfileManager.java,v 1.1 2003/07/10 13:17:00 cziegeler Exp $
*/
public abstract class AbstractUserProfileManager
extends AbstractProfileManager {
public void login() {
super.login();
// TODO - we should move most of the stuff from getPortalLayout to here
// for now we use a hack :)
this.getPortalLayout(null, null);
}
public void logout() {
final String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
ComponentSelector adapterSelector = null;
try {
adapterSelector = (ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
service = (PortalService)this.manager.lookup(PortalService.ROLE);
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute("CopletInstanceData:"+layoutKey);
Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
while ( iter.hasNext() ) {
CopletInstanceData cid = (CopletInstanceData) iter.next();
CopletAdapter adapter = null;
try {
adapter = (CopletAdapter)adapterSelector.select(cid.getCopletData().getCopletBaseData().getCopletAdapterName());
adapter.logout( cid );
} finally {
adapterSelector.release( adapter );
}
}
service.removeAttribute("CopletData:"+layoutKey);
service.removeAttribute("CopletInstanceData:"+layoutKey);
service.removeAttribute("Layout:"+layoutKey);
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
this.manager.release(adapterSelector);
}
super.logout();
}
/**
* @param layoutMap
* @param layout
*/
protected void cacheLayouts(Map layoutMap, Layout layout) {
if ( layout != null ) {
if ( layout.getId() != null ) {
layoutMap.put( layout.getId(), layout );
}
if ( layout instanceof CompositeLayout ) {
CompositeLayout cl = (CompositeLayout)layout;
Iterator i = cl.getItems().iterator();
while ( i.hasNext() ) {
Item current = (Item)i.next();
this.cacheLayouts( layoutMap, current.getLayout() );
}
}
}
}
/**
* Prepares the object by using the specified factory.
*/
protected void prepareObject(Object object, Object factory)
throws ProcessingException {
if (factory != null && object != null) {
if (object instanceof Layout) {
((LayoutFactory)factory).prepareLayout((Layout)object);
} else if (object instanceof CopletDataManager) {
CopletFactory copletFactory = (CopletFactory)factory;
Iterator iterator = ((CopletDataManager)object).getCopletData().values().iterator();
while (iterator.hasNext()) {
CopletData cd = (CopletData)iterator.next();
copletFactory.prepare(cd);
}
} else if (object instanceof CopletInstanceDataManager) {
CopletFactory copletFactory = (CopletFactory)factory;
Iterator iterator = ((CopletInstanceDataManager)object).getCopletInstanceData().values().iterator();
while (iterator.hasNext()) {
CopletInstanceData cid = (CopletInstanceData)iterator.next();
copletFactory.prepare(cid);
}
}
}
}
public CopletInstanceData getCopletInstanceData(String copletID) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
attribute = "CopletInstanceData:"+layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
return copletInstanceDataManager.getCopletInstanceData(copletID);
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public List getCopletInstanceData(CopletData data) {
String layoutKey = this.getDefaultLayoutKey();
List coplets = new ArrayList();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
Iterator iter = copletInstanceDataManager.getCopletInstanceData().values().iterator();
while ( iter.hasNext() ) {
CopletInstanceData current = (CopletInstanceData)iter.next();
if ( current.getCopletData().equals(data) ) {
coplets.add( current );
}
}
return coplets;
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public void register(CopletInstanceData coplet) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
copletInstanceDataManager.putCopletInstanceData( coplet );
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public void unregister(CopletInstanceData coplet) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
copletInstanceDataManager.getCopletInstanceData().remove(coplet.getId());
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public void register(Layout layout) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
Map layoutMap = (Map)service.getAttribute("Layout-Map:" + layoutKey);
if ( layoutMap == null ) {
layout = (Layout)service.getAttribute("Layout:" + layoutKey);
if (layout != null) {
layoutMap = new HashMap();
this.cacheLayouts(layoutMap, layout);
service.setAttribute("Layout-Map:" + layoutKey, layoutMap);
}
}
if ( layoutMap != null) {
layoutMap.put(layout.getId(), layout);
}
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public void unregister(Layout layout) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
Map layoutMap = (Map)service.getAttribute("Layout-Map:" + layoutKey);
if ( layoutMap != null) {
layoutMap.remove(layout.getId());
}
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup portal service.", e);
} finally {
this.manager.release(service);
}
}
public void setEntryLayout(Layout object) {
String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
service.setTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey, object);
} catch (ComponentException e) {
throw new CascadingRuntimeException("Unable to lookup service manager.", e);
} finally {
this.manager.release(service);
}
}
/* (non-Javadoc)
* @see org.apache.cocoon.portal.profile.ProfileManager#getPortalLayout(java.lang.String, java.lang.String)
*/
public Layout getPortalLayout(String layoutKey, String layoutID) {
PortalService service = null;
LayoutFactory factory = null;
CopletFactory copletFactory = null;
ComponentSelector adapterSelector = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
factory = (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);
copletFactory = (CopletFactory) this.manager.lookup(CopletFactory.ROLE);
adapterSelector = (ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
if ( null == layoutKey ) {
layoutKey = this.getDefaultLayoutKey();
}
// FIXME actually this is a hack for full screen
Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
if ( null != l) {
return l;
}
final String layoutAttributeKey = "Layout:" + layoutKey;
final String layoutObjectsAttributeKey = "Layout-Map:" + layoutKey;
Layout layout = (Layout)service.getAttribute(layoutAttributeKey);
if (layout == null) {
layout = this.loadProfile(layoutKey, service, copletFactory, factory, adapterSelector);
}
if ( layoutID != null ) {
// now search for a layout
Map layoutMap = (Map)service.getAttribute(layoutObjectsAttributeKey);
if ( layoutMap == null ) {
layoutMap = new HashMap();
this.cacheLayouts(layoutMap, layout);
service.setAttribute(layoutObjectsAttributeKey, layoutMap);
}
if ( layoutMap != null) {
return (Layout) layoutMap.get( layoutID );
}
}
return layout;
} catch (Exception ce) {
// TODO
throw new CascadingRuntimeException("Arg", ce);
} finally {
this.manager.release(service);
this.manager.release((Component)factory);
this.manager.release((Component)copletFactory);
this.manager.release(adapterSelector);
}
}
/**
* This loads a new profile
*/
protected abstract Layout loadProfile(String layoutKey,
PortalService service,
CopletFactory copletFactory,
LayoutFactory layoutFactory,
ComponentSelector adapterSelector)
throws Exception;
}
1.3 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java
Index: ErrorHandlerHelper.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ErrorHandlerHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorHandlerHelper.java 29 Apr 2003 10:45:20 -0000 1.2
+++ ErrorHandlerHelper.java 10 Jul 2003 13:17:00 -0000 1.3
@@ -66,8 +66,8 @@
/**
* Helps to call error handlers from PipelineNode and PipelinesNode.
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @version CVS $Id$
*/
public class ErrorHandlerHelper extends AbstractLogEnabled implements Composable {
1.3 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java
Index: PipelinesNodeBuilder.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipelinesNodeBuilder.java 11 Apr 2003 13:14:51 -0000 1.2
+++ PipelinesNodeBuilder.java 10 Jul 2003 13:17:00 -0000 1.3
@@ -63,8 +63,8 @@
/**
* Builds a <map:pipelines>
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
1.5 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
Index: MountNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MountNode.java 6 Jul 2003 11:44:30 -0000 1.4
+++ MountNode.java 10 Jul 2003 13:17:00 -0000 1.5
@@ -66,7 +66,7 @@
/**
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @version CVS $Id$
*/
1.8 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
Index: PipelineNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PipelineNode.java 9 Jul 2003 07:42:23 -0000 1.7
+++ PipelineNode.java 10 Jul 2003 13:17:00 -0000 1.8
@@ -67,8 +67,8 @@
/**
* Handles <map:pipeline>
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
1.4 +3 -3 cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java
Index: PipelinesNode.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PipelinesNode.java 6 Jul 2003 11:44:30 -0000 1.3
+++ PipelinesNode.java 10 Jul 2003 13:17:00 -0000 1.4
@@ -67,8 +67,8 @@
/**
* Handles <map:pipelines>
*
- * @author <a href="mailto:juergen.seitz@basf-it-services.com">J�rgen Seitz</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
1.8 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
Index: EnvironmentWrapper.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EnvironmentWrapper.java 6 Jul 2003 20:37:48 -0000 1.7
+++ EnvironmentWrapper.java 10 Jul 2003 13:17:01 -0000 1.8
@@ -71,7 +71,7 @@
* It has the same properties except that the object model
* contains a <code>RequestWrapper</code> object.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
*/
1.2 +1 -1 cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java
Index: ValidationException.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ValidationException.java 29 Apr 2003 10:45:20 -0000 1.1
+++ ValidationException.java 10 Jul 2003 13:17:01 -0000 1.2
@@ -1,7 +1,7 @@
/*
ValidationException.java
- Author: Bj�rn L�tkemeier <bl...@s-und-n.de>
+ Author: Björn Lütkemeier <bl...@s-und-n.de>
Date: April 23, 2003
*/
1.3 +2 -2 cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java
Index: ExceptionGenerator.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExceptionGenerator.java 8 May 2003 10:13:02 -0000 1.2
+++ ExceptionGenerator.java 10 Jul 2003 13:17:01 -0000 1.3
@@ -65,7 +65,7 @@
/**
* Exception generator.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @version CVS $Id$
*/
public class ExceptionGenerator extends AbstractGenerator {
1.2 +52 -4 cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java
Index: ApplicationException.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ApplicationException.java 29 Apr 2003 10:45:20 -0000 1.1
+++ ApplicationException.java 10 Jul 2003 13:17:01 -0000 1.2
@@ -1,12 +1,60 @@
/*
- ApplicationException.java
- Author: Bj�rn L�tkemeier <bl...@s-und-n.de>
- Date: April 23, 2003
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
- */
+ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+ used to endorse or promote products derived from this software without
+ prior written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+*/
package org.apache.cocoon.samples.errorhandling;
+/**
+* @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
+*
+* @version CVS $Id$
+*/
public class ApplicationException
extends Exception {
private int errorCode;
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
Index: PortalManagerImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PortalManagerImpl.java 3 Jul 2003 08:27:47 -0000 1.3
+++ PortalManagerImpl.java 10 Jul 2003 13:17:02 -0000 1.4
@@ -108,7 +108,7 @@
try {
service = (PortalService)this.componentManager.lookup(PortalService.ROLE);
profileManager = (ProfileManager)this.componentManager.lookup(ProfileManager.ROLE);
- Layout portalLayout = profileManager.getPortalLayout(null);
+ Layout portalLayout = profileManager.getPortalLayout(null, null);
rendererSelector = (ComponentSelector)this.componentManager.lookup(Renderer.ROLE+"Selector");
portalLayoutRenderer = (Renderer)rendererSelector.select(portalLayout.getRendererName());
1.8 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletData.java
Index: CopletData.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletData.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CopletData.java 13 Jun 2003 14:15:04 -0000 1.7
+++ CopletData.java 10 Jul 2003 13:17:02 -0000 1.8
@@ -61,7 +61,7 @@
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.6 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletBaseData.java
Index: CopletBaseData.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletBaseData.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CopletBaseData.java 26 May 2003 09:52:59 -0000 1.5
+++ CopletBaseData.java 10 Jul 2003 13:17:02 -0000 1.6
@@ -57,7 +57,7 @@
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.8 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
Index: CopletInstanceData.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CopletInstanceData.java 17 Jun 2003 20:10:39 -0000 1.7
+++ CopletInstanceData.java 10 Jul 2003 13:17:02 -0000 1.8
@@ -60,7 +60,7 @@
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.3 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input/CopletModule.java
Index: CopletModule.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/components/modules/input/CopletModule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopletModule.java 27 May 2003 11:54:18 -0000 1.2
+++ CopletModule.java 10 Jul 2003 13:17:03 -0000 1.3
@@ -93,7 +93,7 @@
* </map:action>
* </map:action></pre>
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @version CVS $Id$
*/
public class CopletModule
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
Index: FullScreenCopletEventAspect.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FullScreenCopletEventAspect.java 7 May 2003 06:22:27 -0000 1.1
+++ FullScreenCopletEventAspect.java 10 Jul 2003 13:17:03 -0000 1.2
@@ -138,7 +138,7 @@
ProfileManager profileManager = null;
try {
profileManager = (ProfileManager) this.manager.lookup(ProfileManager.ROLE);
- profileManager.setDefaultLayout( startingLayout );
+ profileManager.setEntryLayout( startingLayout );
} catch (ComponentException ce) {
// ignore
} finally {
1.7 +41 -8 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FrameEventAspect.java
Index: FrameEventAspect.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FrameEventAspect.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FrameEventAspect.java 28 May 2003 13:47:29 -0000 1.6
+++ FrameEventAspect.java 10 Jul 2003 13:17:03 -0000 1.7
@@ -50,6 +50,8 @@
*/
package org.apache.cocoon.portal.event.aspect.impl;
+import java.util.StringTokenizer;
+
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
@@ -64,10 +66,12 @@
import org.apache.cocoon.portal.event.aspect.EventAspectContext;
import org.apache.cocoon.portal.event.impl.ChangeAspectDataEvent;
import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.layout.impl.FrameLayout;
import org.apache.cocoon.portal.profile.ProfileManager;
/**
*
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
*
@@ -100,27 +104,56 @@
} catch (Exception ignore) {
}
if (e == null) {
- // Use '|' character as delimiter between ID and URI
- int index = value.indexOf('|');
- if (index != -1) {
- String id = value.substring(0, index);
+ // Use '|' character as delimiter between Group, ID and URI
+ StringTokenizer tokenizer = new StringTokenizer(value, "|");
+ int tokenNumber = 0;
+ int tokenCount = tokenizer.countTokens();
+ // if only 3 params are in the String
+ if (tokenCount == 2)
+ tokenNumber = tokenNumber + 1;
+
+ String groupKey = null;
+ String id = null;
String uri = null;
- if (index != (value.length() - 1)) {
- uri = value.substring(index + 1);
+
+ while (tokenizer.hasMoreTokens())
+ {
+
+ switch (tokenNumber)
+ {
+ case 0 :
+ groupKey = tokenizer.nextToken();
+ break;
+ case 1 :
+ id = tokenizer.nextToken();
+ break;
+ case 2 :
+ uri = tokenizer.nextToken();
+ break;
}
+ tokenNumber = tokenNumber + 1;
+ } // while
+
+ if (tokenCount > 0) {
ProfileManager profileManager = null;
try {
profileManager = (ProfileManager)this.manager.lookup(ProfileManager.ROLE);
- Layout layout = profileManager.getPortalLayout( id );
+ Layout layout = profileManager.getPortalLayout(groupKey, id );
if ( layout != null ) {
+ if (layout instanceof FrameLayout){
e = new ChangeAspectDataEvent(layout, "frame", uri);
publisher.publish(e);
+ } else {
+ this.getLogger().warn("the configured layout: " + layout.getName() + " is not a FrameLayout.");
+ }
}
} catch (ComponentException ignore) {
} finally {
this.manager.release( profileManager );
}
+ } else {
+ this.getLogger().warn("data for LinkEvent is not set correctly");
}
}
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/LinkEventAspect.java
Index: LinkEventAspect.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.portal.event.aspect.impl;
import java.util.StringTokenizer;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.event.Event;
import org.apache.cocoon.portal.event.Publisher;
import org.apache.cocoon.portal.event.aspect.EventAspect;
import org.apache.cocoon.portal.event.aspect.EventAspectContext;
import org.apache.cocoon.portal.event.impl.ChangeAspectDataEvent;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.layout.impl.LinkLayout;
import org.apache.cocoon.portal.profile.ProfileManager;
/**
*
* @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
*
* @version CVS $Id: LinkEventAspect.java,v 1.1 2003/07/10 13:17:03 cziegeler Exp $
*/
public class LinkEventAspect
extends AbstractLogEnabled
implements EventAspect, ThreadSafe, Composable {
protected ComponentManager manager;
/* (non-Javadoc)
* @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
*/
public void process(EventAspectContext context, PortalService service) {
// TODO - make this configurable
final String requestParameterName = "link";
final Request request = ObjectModelHelper.getRequest(context.getObjectModel());
String[] values = request.getParameterValues(requestParameterName);
if (values != null) {
final Publisher publisher = context.getEventPublisher();
for (int i = 0; i < values.length; i++) {
final String value = values[i];
Event e = null;
try {
e = context.getEventConverter().decode(value);
if (null != e) {
publisher.publish(e);
}
} catch (Exception ignore) {
}
if (e == null) {
// Use '|' character as delimiter between targetGroup, targetId, contentGroup and contentId
StringTokenizer tokenizer = new StringTokenizer(value, "|");
int tokenNumber = 0;
int tokenCount = tokenizer.countTokens();
// if only 3 params are in the String
if (tokenCount == 3)
tokenNumber = tokenNumber + 1;
String targetGroup = null;
String targetId = null;
String contentGroup = null;
String contentId = null;
while (tokenizer.hasMoreTokens())
{
switch (tokenNumber)
{
case 0 :
targetGroup = tokenizer.nextToken();
break;
case 1 :
targetId = tokenizer.nextToken();
break;
case 2 :
contentGroup = tokenizer.nextToken();
break;
case 3 :
contentId = tokenizer.nextToken();
break;
}
tokenNumber = tokenNumber + 1;
} // while
if (tokenCount > 0) {
ProfileManager profileManager = null;
try {
profileManager = (ProfileManager)this.manager.lookup(ProfileManager.ROLE);
Layout layout = profileManager.getPortalLayout(targetGroup, targetId );
if ( layout != null ) {
if (layout instanceof LinkLayout){
LinkLayout linkLayout = (LinkLayout)layout;
e = new ChangeAspectDataEvent(linkLayout, "link-layout-key", contentGroup);
publisher.publish(e);
e = new ChangeAspectDataEvent(linkLayout, "link-layout-id", contentId);
publisher.publish(e);
} else {
this.getLogger().warn("the configured layout: " + layout.getName() + " is not a linkLayout.");
}
}
} catch (ComponentException ignore) {
} finally {
this.manager.release( profileManager );
}
} else {
this.getLogger().warn("data for LinkEvent is not set correctly");
}
}
}
}
// and invoke next one
context.invokeNext(service);
}
/* (non-Javadoc)
* @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager)
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
}
1.5 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/environment/Environment.java
Index: Environment.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/Environment.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Environment.java 6 Jul 2003 20:37:48 -0000 1.4
+++ Environment.java 10 Jul 2003 13:17:03 -0000 1.5
@@ -58,7 +58,7 @@
/**
* Base interface for an environment abstraction
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
1.15 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AbstractEnvironment.java 3 Jun 2003 07:29:19 -0000 1.14
+++ AbstractEnvironment.java 10 Jul 2003 13:17:03 -0000 1.15
@@ -75,7 +75,7 @@
/**
* Base class for any environment
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/ObjectModelAction.java
Index: ObjectModelAction.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/ObjectModelAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ObjectModelAction.java 8 May 2003 11:54:01 -0000 1.1
+++ ObjectModelAction.java 10 Jul 2003 13:17:04 -0000 1.2
@@ -61,7 +61,7 @@
/**
* Stores all parameters in the object model adding prefix "cocoon-portal-".
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @version CVS $Id$
*/
public class ObjectModelAction
1.2 +16 -8 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java
Index: LinkLayout.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/LinkLayout.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LinkLayout.java 7 May 2003 06:22:21 -0000 1.1
+++ LinkLayout.java 10 Jul 2003 13:17:04 -0000 1.2
@@ -53,25 +53,33 @@
import org.apache.cocoon.portal.layout.AbstractLayout;
import org.apache.cocoon.portal.layout.Layout;
-
/**
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
+ * @author <a href="mailto:juergen.seitz@basf-it-services.com">Jürgen Seitz</a>
*
* @version CVS $Id$
*/
-public final class LinkLayout
- extends AbstractLayout
- implements Layout {
+public class LinkLayout extends AbstractLayout implements Layout {
+
+ protected String linkedLayoutKey;
+ protected String linkedLayoutId;
- private String linkedLayoutId;
-
public void setLayoutId(String layoutId) {
this.linkedLayoutId = layoutId;
}
-
+
public String getLayoutId() {
return this.linkedLayoutId;
}
+
+ public String getLayoutKey() {
+ return linkedLayoutKey;
+ }
+
+ public void setLayoutKey(String key) {
+ linkedLayoutKey = key;
+ }
+
}
1.14 +2 -2 cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java
Index: CocoonComponentManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- CocoonComponentManager.java 21 Jun 2003 14:08:07 -0000 1.13
+++ CocoonComponentManager.java 10 Jul 2003 13:17:04 -0000 1.14
@@ -83,7 +83,7 @@
* directly - and do not assume that a {@link ComponentManager} you get
* via the compose() method is an instance of CocoonComponentManager.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id$
*/
1.4 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
Index: CopletTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletTransformer.java 27 May 2003 11:54:17 -0000 1.3
+++ CopletTransformer.java 10 Jul 2003 13:17:04 -0000 1.4
@@ -74,7 +74,7 @@
* Please see also the documentation of superclass AbstractCopletTransformer for how
* the coplet instance data are acquired.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
* @version CVS $Id$
*/
public class CopletTransformer
1.5 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java
Index: EventLinkTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/transformation/EventLinkTransformer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EventLinkTransformer.java 27 May 2003 11:54:17 -0000 1.4
+++ EventLinkTransformer.java 10 Jul 2003 13:17:04 -0000 1.5
@@ -83,7 +83,7 @@
* Please see also the documentation of superclass AbstractCopletTransformer for how
* the coplet instance data are acquired.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletLinkEvent.java
Index: CopletLinkEvent.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletLinkEvent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CopletLinkEvent.java 26 May 2003 13:18:19 -0000 1.1
+++ CopletLinkEvent.java 10 Jul 2003 13:17:04 -0000 1.2
@@ -56,7 +56,7 @@
/**
* This class realizes a link event created by the EventLinkTransformer.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.6 +27 -6 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
Index: ProfileManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProfileManager.java 27 May 2003 14:07:16 -0000 1.5
+++ ProfileManager.java 10 Jul 2003 13:17:04 -0000 1.6
@@ -71,18 +71,39 @@
String ROLE = ProfileManager.class.getName();
- Layout getPortalLayout(String key);
+ /**
+ * Get the portal layout defined by the layout key. This
+ * usually addresses the layout profile.
+ * With the optional subKey it's possible to retrieve
+ * a specific layout object in the profile defined by
+ * the layout key.
+ * @param layoutKey A key describing the layout or null for the default
+ * @param subKey The id of a layout object or null for the root object
+ * @return The layout
+ */
+ Layout getPortalLayout(String layoutKey, String layoutID);
- void setDefaultLayout(Layout object);
+ /**
+ * FIXME this is for the full-screen function
+ */
+ void setEntryLayout(Layout object);
+
+ /**
+ * Change the default layout key for most functions
+ */
+ void setDefaultLayoutKey(String layoutKey);
+
+ /**
+ * Get the default layout key
+ */
+ String getDefaultLayoutKey();
CopletInstanceData getCopletInstanceData(String copletID);
List getCopletInstanceData(CopletData data);
- // TODO - not called yet
void login();
- // TODO - not called yet
void logout();
void register(CopletInstanceData coplet);
1.4 +12 -5 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileLS.java
Index: ProfileLS.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileLS.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProfileLS.java 22 May 2003 15:19:43 -0000 1.3
+++ ProfileLS.java 10 Jul 2003 13:17:04 -0000 1.4
@@ -58,12 +58,19 @@
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
public interface ProfileLS {
- Object loadProfile(Object key, Map map) throws Exception; //TODO define ExceptionType later
- void saveProfile(Object key, Map map, Object profile) throws Exception; //TODO define ExceptionType later
- SourceValidity getValidity(Object key, Map map);
+
+ String ROLE = ProfileLS.class.getName();
+
+ // TODO define ExceptionType later
+ Object loadProfile(Object key, Map parameters) throws Exception;
+
+ //TODO define ExceptionType later
+ void saveProfile(Object key, Map parameters, Object profile) throws Exception;
+
+ SourceValidity getValidity(Object key, Map parameters);
}
1.19 +1 -1 cocoon-2.1/src/blocks/portal/conf/portal.xconf
Index: portal.xconf
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/conf/portal.xconf,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- portal.xconf 15 Jun 2003 19:44:58 -0000 1.18
+++ portal.xconf 10 Jul 2003 13:17:06 -0000 1.19
@@ -206,7 +206,7 @@
<mapping-source source="copletdata">context://samples/portal/profiles/mapping/copletdata.xml</mapping-source>
<mapping-source source="copletinstancedata">context://samples/portal/profiles/mapping/copletinstancedata.xml</mapping-source>
</component>
- <component class="org.apache.cocoon.portal.profile.impl.MapSourceAdapter" role="org.apache.cocoon.portal.profile.impl.MapSourceAdapter" />
+ <component class="org.apache.cocoon.portal.profile.impl.MapProfileLS" role="org.apache.cocoon.portal.profile.ProfileLS" />
<component class="org.apache.cocoon.components.variables.DefaultVariableResolverFactory" role="org.apache.cocoon.components.variables.VariableResolverFactory" />
</xconf>
1.2 +2 -2 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/Constants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Constants.java 8 May 2003 11:54:00 -0000 1.1
+++ Constants.java 10 Jul 2003 13:17:07 -0000 1.2
@@ -53,7 +53,7 @@
/**
* Defines constants used within portal classes.
*
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
1.5 +16 -7 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/components/persistance/CastorSourceConverter.java
Index: CastorSourceConverter.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/components/persistance/CastorSourceConverter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CastorSourceConverter.java 27 May 2003 07:38:33 -0000 1.4
+++ CastorSourceConverter.java 10 Jul 2003 13:17:07 -0000 1.5
@@ -70,6 +70,7 @@
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.portal.util.ReferenceFieldHandler;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
import org.exolab.castor.mapping.Mapping;
@@ -79,10 +80,17 @@
import org.xml.sax.InputSource;
/**
- *
+ * This is a component that converts the profiles (= object tree) to XML and vice-versa
+ * using Castor.
+ *
+ * In order to work properly the methods provided by this interface require some
+ * parameters:
+ * objectmap : containing a map of objects for resolving references during load
+ * profiletype: specifying the mapping (this is one of layout, copletinstancedata, copletdata or copletbasedate
+ *
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
- * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Björn Lütkemeier</a>
*
* @version CVS $Id$
*/
@@ -96,9 +104,10 @@
private ComponentManager manager;
private Map mappings = new HashMap();
- public Object getObject(InputStream stream, String name) throws ConverterException {
+ public Object getObject(InputStream stream, Map parameters) throws ConverterException {
try {
- Unmarshaller unmarshaller = new Unmarshaller((Mapping)this.mappings.get(name));
+ ReferenceFieldHandler.setObjectMap((Map)parameters.get("objectmap"));
+ Unmarshaller unmarshaller = new Unmarshaller((Mapping)this.mappings.get(parameters.get("profiletype")));
Object result = unmarshaller.unmarshal(new InputSource(stream));
stream.close();
return result;
@@ -109,12 +118,12 @@
}
}
- public void storeObject(OutputStream stream, String name, Object object) throws ConverterException {
+ public void storeObject(OutputStream stream, Map parameters, Object object) throws ConverterException {
Writer writer = new OutputStreamWriter(stream);
try {
Marshaller marshaller = new Marshaller( writer );
Mapping mapping = new Mapping();
- marshaller.setMapping((Mapping)this.mappings.get(name));
+ marshaller.setMapping((Mapping)this.mappings.get(parameters.get(parameters.get("profiletype"))));
marshaller.marshal(object);
writer.close();
} catch (MappingException e) {