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/05/21 15:06:07 UTC
cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/factory/impl AbstractProducible.java
cziegeler 2003/05/21 06:06:06
Modified: src/blocks/portal/java/org/apache/cocoon/portal/layout/impl
DefaultLayoutFactory.java
src/blocks/portal/samples/profiles/mapping layout.xml
copletbasedata.xml copletdata.xml
copletinstancedata.xml
src/blocks/portal/java/org/apache/cocoon/portal/coplet
CopletInstanceData.java CopletData.java
CopletBaseData.java
src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl
SessionAspectDataStore.java
AbstractAspectalizableDescription.java
DefaultAspectDataHandler.java
RequestAspectDataStore.java
AbstractAspectalizable.java
src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
SimpleProfileManager.java
src/blocks/portal/java/org/apache/cocoon/portal/layout
Layout.java AbstractLayout.java LayoutFactory.java
src/blocks/portal/conf portal.xconf
src/blocks/portal/samples/profiles/layout portal.xml
src/blocks/portal/java/org/apache/cocoon/portal/aspect
AspectDescription.java Aspectalizable.java
AspectalizableDescription.java
AspectDataHandler.java AspectDataStore.java
src/blocks/portal/java/org/apache/cocoon/portal/factory
Producible.java
src/blocks/portal/java/org/apache/cocoon/portal/factory/impl
AbstractProducible.java
Added: src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl
PersistentAspectDataStore.java
src/blocks/portal/java/org/apache/cocoon/portal/profile/impl
CopletDataFieldHandler.java
CopletInstanceDataFieldHandler.java
CopletBaseDataFieldHandler.java
src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
RemovableAspect.java
Removed: src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
RemoveableAspect.java
Log:
Removing dependency to castor
Refactoring
Revision Changes Path
1.5 +39 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
Index: DefaultLayoutFactory.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultLayoutFactory.java 20 May 2003 14:06:42 -0000 1.4
+++ DefaultLayoutFactory.java 21 May 2003 13:06:00 -0000 1.5
@@ -50,8 +50,10 @@
*/
package org.apache.cocoon.portal.layout.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.activity.Disposable;
@@ -74,6 +76,7 @@
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.util.ClassUtils;
/**
*
@@ -88,6 +91,8 @@
protected Map layouts = new HashMap();
+ protected List descriptions = new ArrayList();
+
protected ComponentSelector storeSelector;
protected ComponentManager manager;
@@ -120,6 +125,7 @@
}
DefaultAspectDataHandler handler = new DefaultAspectDataHandler(desc, this.storeSelector);
this.layouts.put(desc.getName(), new Object[] {desc, handler});
+ this.descriptions.add(desc);
}
}
}
@@ -152,6 +158,38 @@
}
}
}
+
+ public Layout newInstance(String layoutName)
+ throws ProcessingException {
+ Object[] o = (Object[]) this.layouts.get( layoutName );
+
+ if ( o == null ) {
+ throw new ProcessingException("LayoutDescription with name " + layoutName + " not found.");
+ }
+ DefaultLayoutDescription layoutDescription = (DefaultLayoutDescription)o[0];
+
+ Layout layout = null;
+ try {
+ Class clazz = ClassUtils.loadClass( layoutDescription.getClassName() );
+ layout = (Layout)clazz.newInstance();
+
+ } catch (Exception e) {
+ throw new ProcessingException("Unable to create new instance", e );
+ }
+
+ // TODO - set unique id
+ String id = layoutName + '-' + System.currentTimeMillis();
+ layout.initialize( layoutName, id );
+ layout.setDescription( layoutDescription );
+ layout.setAspectDataHandler((AspectDataHandler)o[1]);
+
+ return layout;
+ }
+
+ public List getLayoutDescriptions() {
+ return this.descriptions;
+ }
+
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Disposable#dispose()
1.7 +3 -1 cocoon-2.1/src/blocks/portal/samples/profiles/mapping/layout.xml
Index: layout.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/mapping/layout.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- layout.xml 20 May 2003 14:06:42 -0000 1.6
+++ layout.xml 21 May 2003 13:06:00 -0000 1.7
@@ -11,6 +11,9 @@
<field name="name" type="java.lang.String">
<bind-xml name="name" node="attribute" />
</field>
+ <field name="id" type="java.lang.String" >
+ <bind-xml name="id" node="attribute" />
+ </field>
</class>
<class name="org.apache.cocoon.portal.layout.AbstractParameters"
@@ -28,7 +31,6 @@
<field name="static" type="boolean">
<bind-xml name="static" node="attribute" />
</field>
- <field name="id" type="java.lang.String" />
</class>
<class name="org.apache.cocoon.portal.layout.impl.LinkLayout"
1.3 +1 -1 cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletbasedata.xml
Index: copletbasedata.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletbasedata.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- copletbasedata.xml 20 May 2003 14:32:37 -0000 1.2
+++ copletbasedata.xml 21 May 2003 13:06:00 -0000 1.3
@@ -5,7 +5,7 @@
<class name="org.apache.cocoon.portal.profile.impl.CopletBaseDataManager">
<map-to xml="coplets" />
- <field name="copletBaseData" type="org.apache.cocoon.portal.coplet.CopletBaseData" collection="map">
+ <field name="copletBaseData" type="org.apache.cocoon.portal.coplet.CopletBaseData" collection="vector" handler="org.apache.cocoon.portal.profile.impl.CopletBaseDataFieldHandler">
<bind-xml auto-naming="deriveByClass" />
</field>
</class>
1.3 +1 -1 cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletdata.xml
Index: copletdata.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletdata.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- copletdata.xml 20 May 2003 14:32:37 -0000 1.2
+++ copletdata.xml 21 May 2003 13:06:00 -0000 1.3
@@ -5,7 +5,7 @@
<class name="org.apache.cocoon.portal.profile.impl.CopletDataManager">
<map-to xml="coplets" />
- <field name="copletData" type="org.apache.cocoon.portal.coplet.CopletData" collection="map">
+ <field name="copletData" type="org.apache.cocoon.portal.coplet.CopletData" collection="vector" handler="org.apache.cocoon.portal.profile.impl.CopletDataFieldHandler">
<bind-xml auto-naming="deriveByClass"/>
</field>
</class>
1.3 +1 -1 cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletinstancedata.xml
Index: copletinstancedata.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/mapping/copletinstancedata.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- copletinstancedata.xml 20 May 2003 14:32:37 -0000 1.2
+++ copletinstancedata.xml 21 May 2003 13:06:01 -0000 1.3
@@ -5,7 +5,7 @@
<class name="org.apache.cocoon.portal.profile.impl.CopletInstanceDataManager">
<map-to xml="coplets" />
- <field name="copletInstanceData" type="org.apache.cocoon.portal.coplet.CopletInstanceData" collection="map">
+ <field name="copletInstanceData" type="org.apache.cocoon.portal.coplet.CopletInstanceData" collection="vector" handler="org.apache.cocoon.portal.profile.impl.CopletInstanceDataFieldHandler">
<bind-xml auto-naming="deriveByClass"/>
</field>
</class>
1.4 +2 -10 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletInstanceData.java 20 May 2003 14:32:36 -0000 1.3
+++ CopletInstanceData.java 21 May 2003 13:06:01 -0000 1.4
@@ -50,7 +50,6 @@
*/
package org.apache.cocoon.portal.coplet;
-import org.exolab.castor.mapping.MapItem;
/**
*
@@ -60,9 +59,7 @@
*
* @version CVS $Id$
*/
-public final class CopletInstanceData
-// extending MapItem used for Castor map workaround
-extends MapItem {
+public final class CopletInstanceData {
public final static int STATUS_MINIMIZED = 0;
public final static int STATUS_MAXIMIZED = 1;
@@ -77,8 +74,6 @@
* Constructor
*/
public CopletInstanceData() {
- // used for Castor map workaround
- this.setValue(this);
}
/**
@@ -95,9 +90,6 @@
*/
public void setId(String copletId) {
this.copletId = copletId;
-
- // used for Castor map workaround
- this.setKey(copletId);
}
/**
1.4 +1 -9 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletData.java 20 May 2003 14:32:36 -0000 1.3
+++ CopletData.java 21 May 2003 13:06:01 -0000 1.4
@@ -55,7 +55,6 @@
import java.util.Map;
import org.apache.cocoon.portal.util.DeltaApplicable;
-import org.exolab.castor.mapping.MapItem;
/**
*
@@ -66,8 +65,6 @@
* @version CVS $Id$
*/
public class CopletData
-//extending MapItem used for Castor map workaround
-extends MapItem
implements DeltaApplicable {
protected String id;
@@ -86,8 +83,6 @@
* Constructor
*/
public CopletData() {
- // used for Castor map workaround
- this.setValue(this);
}
public String getId() {
@@ -96,9 +91,6 @@
public void setId(String name) {
this.id = name;
-
- // used for Castor map workaround
- this.setKey(name);
}
/**
1.4 +2 -11 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CopletBaseData.java 20 May 2003 14:32:36 -0000 1.3
+++ CopletBaseData.java 21 May 2003 13:06:01 -0000 1.4
@@ -53,8 +53,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.exolab.castor.mapping.MapItem;
-
/**
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
@@ -63,9 +61,7 @@
*
* @version CVS $Id$
*/
-public final class CopletBaseData
-// extending MapItem used for Castor map workaround
-extends MapItem {
+public final class CopletBaseData {
private Map copletConfig = new HashMap();
@@ -76,8 +72,6 @@
private String defaultRendererName = null;
public CopletBaseData() {
- // used for Castor map workaround
- this.setValue(this);
}
public String getId() {
@@ -86,9 +80,6 @@
public void setId(String name) {
this.id = name;
-
- // used for Castor map workaround
- this.setKey(name);
}
public String getCopletAdapterName() {
1.2 +5 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/SessionAspectDataStore.java
Index: SessionAspectDataStore.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/SessionAspectDataStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SessionAspectDataStore.java 20 May 2003 14:06:43 -0000 1.1
+++ SessionAspectDataStore.java 21 May 2003 13:06:02 -0000 1.2
@@ -97,4 +97,8 @@
this.getMap(owner).put(aspectName, data);
}
+ public boolean isPersistent() {
+ return false;
+ }
+
}
1.2 +3 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizableDescription.java
Index: AbstractAspectalizableDescription.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizableDescription.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractAspectalizableDescription.java 20 May 2003 14:06:43 -0000 1.1
+++ AbstractAspectalizableDescription.java 21 May 2003 13:06:02 -0000 1.2
@@ -73,7 +73,7 @@
/**
* @return
*/
- public List getAspects() {
+ public List getAspectDescriptions() {
return this.aspects;
}
@@ -84,7 +84,7 @@
/**
* Return the description for an aspect
*/
- public AspectDescription getAspect(String name) {
+ public AspectDescription getAspectDescription(String name) {
AspectDescription desc = null;
Iterator i = this.aspects.iterator();
while (desc == null && i.hasNext() ) {
1.2 +55 -10 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/DefaultAspectDataHandler.java
Index: DefaultAspectDataHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/DefaultAspectDataHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultAspectDataHandler.java 20 May 2003 14:06:43 -0000 1.1
+++ DefaultAspectDataHandler.java 21 May 2003 13:06:02 -0000 1.2
@@ -50,7 +50,9 @@
*/
package org.apache.cocoon.portal.aspect.impl;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.component.Component;
@@ -73,8 +75,6 @@
protected AspectalizableDescription description;
- // TODO - Implement persistence
-
protected ComponentSelector storeSelector;
/**
@@ -91,7 +91,7 @@
*/
public Object getAspectData(Aspectalizable owner, String aspectName) {
// is this aspect allowed?
- AspectDescription aspectDesc = this.description.getAspect( aspectName );
+ AspectDescription aspectDesc = this.description.getAspectDescription( aspectName );
if ( aspectDesc == null ) return null;
// lookup storage
@@ -118,9 +118,54 @@
/* (non-Javadoc)
* @see org.apache.cocoon.portal.aspect.AspectDataHandler#getAspectDatas(org.apache.cocoon.portal.aspect.Aspectalizable)
*/
- public List getAspectDatas(Aspectalizable owner) {
- // TODO Auto-generated method stub
- return null;
+ public Map getAspectDatas(Aspectalizable owner) {
+ Map datas = new HashMap();
+ Iterator iter = this.description.getAspectDescriptions().iterator();
+ while ( iter.hasNext() ) {
+ AspectDescription current = (AspectDescription)iter.next();
+ Object data = this.getAspectData(owner, current.getName());
+ if ( data != null ) {
+ datas.put( current.getName(), data );
+ }
+ }
+ return datas;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.aspect.AspectDataHandler#getPersistentAspectDatas(org.apache.cocoon.portal.aspect.Aspectalizable)
+ */
+ public Map getPersistentAspectDatas(Aspectalizable owner) {
+ Map datas = new HashMap();
+ Iterator iter = this.description.getAspectDescriptions().iterator();
+ while ( iter.hasNext() ) {
+ AspectDescription current = (AspectDescription)iter.next();
+
+ // lookup storage
+ AspectDataStore store = null;
+ Object data = null;
+ try {
+ store = (AspectDataStore)this.storeSelector.select(current.getStoreName());
+ if ( store.isPersistent() ) {
+ data = store.getAspectData(owner, current.getName());
+
+ if ( data == null && current.isAutoCreate() ) {
+ data = AspectUtil.createNewInstance(current);
+ store.setAspectData( owner, current.getName(), data );
+ }
+
+ if ( data != null ) {
+ datas.put( current.getName(), data );
+ }
+ }
+
+ } catch (ComponentException ce) {
+ throw new CascadingRuntimeException("Unable to lookup aspect data store " + current.getStoreName(), ce);
+ } finally {
+ this.storeSelector.release( (Component)store );
+ }
+
+ }
+ return datas;
}
/* (non-Javadoc)
@@ -130,7 +175,7 @@
String aspectName,
Object data) {
// is this aspect allowed?
- AspectDescription aspectDesc = this.description.getAspect( aspectName );
+ AspectDescription aspectDesc = this.description.getAspectDescription( aspectName );
if ( aspectDesc == null ) return;
// lookup storage
@@ -149,6 +194,6 @@
* Is this supported
*/
public boolean isAspectSupported(String aspectName) {
- return (this.description.getAspect(aspectName) != null);
+ return (this.description.getAspectDescription(aspectName) != null);
}
}
1.2 +4 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/RequestAspectDataStore.java
Index: RequestAspectDataStore.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/RequestAspectDataStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestAspectDataStore.java 20 May 2003 14:06:43 -0000 1.1
+++ RequestAspectDataStore.java 21 May 2003 13:06:02 -0000 1.2
@@ -97,4 +97,7 @@
this.getMap(owner).put(aspectName, data);
}
+ public boolean isPersistent() {
+ return false;
+ }
}
1.3 +7 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizable.java
Index: AbstractAspectalizable.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/AbstractAspectalizable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractAspectalizable.java 20 May 2003 14:06:43 -0000 1.2
+++ AbstractAspectalizable.java 21 May 2003 13:06:02 -0000 1.3
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.portal.aspect.impl;
-import java.util.List;
+import java.util.Map;
import org.apache.cocoon.portal.aspect.AspectDataHandler;
import org.apache.cocoon.portal.aspect.Aspectalizable;
@@ -82,10 +82,14 @@
this.aspectDataHandler.setAspectData(this, aspectName, data);
}
- public List getAspectDatas(){
+ public Map getAspectDatas(){
return this.aspectDataHandler.getAspectDatas(this);
}
+ public Map getPersistentAspectDatas(){
+ return this.aspectDataHandler.getPersistentAspectDatas(this);
+ }
+
/**
* This method is invoked once to set the handler
*/
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/impl/PersistentAspectDataStore.java
Index: PersistentAspectDataStore.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.aspect.impl;
/**
* An aspect data store is a component that manages aspect data objects.
*
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
*
* @version CVS $Id: PersistentAspectDataStore.java,v 1.1 2003/05/21 13:06:02 cziegeler Exp $
*/
public class PersistentAspectDataStore
extends SessionAspectDataStore {
public boolean isPersistent() {
return true;
}
}
1.5 +3 -4 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/SimpleProfileManager.java
Index: SimpleProfileManager.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/SimpleProfileManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleProfileManager.java 20 May 2003 14:32:36 -0000 1.4
+++ SimpleProfileManager.java 21 May 2003 13:06:04 -0000 1.5
@@ -65,7 +65,6 @@
import org.apache.cocoon.portal.aspect.AspectStatus;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.coplet.status.SizeableStatus;
-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;
@@ -531,9 +530,9 @@
throws ProcessingException {
String id = layout.getId();
if ( id == null ) {
- id = Integer.toString(layout.hashCode());
- ((AbstractLayout)layout).setId(id);
+ throw new ProcessingException("Layout has no id " + layout.getName());
}
+
if (layout instanceof CompositeLayout) {
final CompositeLayout compositeLayout = (CompositeLayout) layout;
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletDataFieldHandler.java
Index: CopletDataFieldHandler.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.Iterator;
import java.util.Map;
import java.util.Vector;
import org.apache.cocoon.portal.coplet.CopletData;
import org.exolab.castor.mapping.FieldHandler;
/**
* Field handler for CopletData instances.
*
* @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
*
* @version CVS $Id: CopletDataFieldHandler.java,v 1.1 2003/05/21 13:06:04 cziegeler Exp $
*/
public class CopletDataFieldHandler
implements FieldHandler {
public void checkValidity(Object object)
{
}
public Object getValue(Object object)
{
Map map = ((CopletDataManager)object).getCopletData();
Vector result = new Vector(map.size());
Iterator iterator = map.values().iterator();
while (iterator.hasNext())
result.addElement(iterator.next());
return result;
}
public Object newInstance(Object parent)
{
return new CopletData();
}
public void resetValue(Object object)
{
((CopletDataManager)object).getCopletData().clear();
}
public void setValue(Object object, Object value)
{
CopletData data = (CopletData)value;
((CopletDataManager)object).getCopletData().put(data.getId(), data);
}
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletInstanceDataFieldHandler.java
Index: CopletInstanceDataFieldHandler.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.Iterator;
import java.util.Map;
import java.util.Vector;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.exolab.castor.mapping.FieldHandler;
/**
* Field handler for CopletInstanceData instances.
*
* @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
*
* @version CVS $Id: CopletInstanceDataFieldHandler.java,v 1.1 2003/05/21 13:06:04 cziegeler Exp $
*/
public class CopletInstanceDataFieldHandler
implements FieldHandler {
public void checkValidity(Object object)
{
}
public Object getValue(Object object)
{
Map map = ((CopletInstanceDataManager)object).getCopletInstanceData();
Vector result = new Vector(map.size());
Iterator iterator = map.values().iterator();
while (iterator.hasNext())
result.addElement(iterator.next());
return result;
}
public Object newInstance(Object parent)
{
return new CopletInstanceData();
}
public void resetValue(Object object)
{
((CopletInstanceDataManager)object).getCopletInstanceData().clear();
}
public void setValue(Object object, Object value)
{
CopletInstanceData data = (CopletInstanceData)value;
((CopletInstanceDataManager)object).getCopletInstanceData().put(data.getId(), data);
}
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/CopletBaseDataFieldHandler.java
Index: CopletBaseDataFieldHandler.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.Iterator;
import java.util.Map;
import java.util.Vector;
import org.apache.cocoon.portal.coplet.CopletBaseData;
import org.exolab.castor.mapping.FieldHandler;
/**
* Field handler for CopletBaseData instances.
*
* @author <a href="mailto:bluetkemeier@s-und-n.de">Bj�rn L�tkemeier</a>
*
* @version CVS $Id: CopletBaseDataFieldHandler.java,v 1.1 2003/05/21 13:06:04 cziegeler Exp $
*/
public class CopletBaseDataFieldHandler
implements FieldHandler {
public void checkValidity(Object object)
{
}
public Object getValue(Object object)
{
Map map = ((CopletBaseDataManager)object).getCopletBaseData();
Vector result = new Vector(map.size());
Iterator iterator = map.values().iterator();
while (iterator.hasNext())
result.addElement(iterator.next());
return result;
}
public Object newInstance(Object parent)
{
return new CopletBaseData();
}
public void resetValue(Object object)
{
((CopletBaseDataManager)object).getCopletBaseData().clear();
}
public void setValue(Object object, Object value)
{
CopletBaseData data = (CopletBaseData)value;
((CopletBaseDataManager)object).getCopletBaseData().put(data.getId(), data);
}
}
1.6 +1 -7 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java
Index: Layout.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/Layout.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Layout.java 20 May 2003 14:06:43 -0000 1.5
+++ Layout.java 21 May 2003 13:06:04 -0000 1.6
@@ -77,12 +77,6 @@
*/
String getLayoutRendererName();
- /**
- * Get the unique id of this layout object
- * @return String Unique id
- */
- String getId();
-
Item getParent();
void setParent(Item item);
1.7 +2 -18 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
Index: AbstractLayout.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractLayout.java 20 May 2003 14:06:43 -0000 1.6
+++ AbstractLayout.java 21 May 2003 13:06:04 -0000 1.7
@@ -65,8 +65,6 @@
protected String rendererName;
- protected String id;
-
protected Item parent;
protected boolean _static;
@@ -85,21 +83,6 @@
this.rendererName = value;
}
- /**
- * @return String
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the id.
- * @param id The id to set
- */
- public void setId(String id) {
- this.id = id;
- }
-
public Item getParent() {
return this.parent;
}
@@ -107,6 +90,7 @@
public void setParent(Item item) {
this.parent = item;
}
+
/* (non-Javadoc)
* @see org.apache.cocoon.portal.layout.Layout#isStatic()
*/
1.3 +9 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/LayoutFactory.java
Index: LayoutFactory.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/LayoutFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LayoutFactory.java 19 May 2003 12:50:59 -0000 1.2
+++ LayoutFactory.java 21 May 2003 13:06:04 -0000 1.3
@@ -50,6 +50,8 @@
*/
package org.apache.cocoon.portal.layout;
+import java.util.List;
+
import org.apache.cocoon.ProcessingException;
/**
@@ -68,4 +70,10 @@
void prepareLayout(Layout layout)
throws ProcessingException;
+
+ Layout newInstance(String name)
+ throws ProcessingException;
+
+ List getLayoutDescriptions();
+
}
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/RemovableAspect.java
Index: RemovableAspect.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.layout.renderer.aspect.impl;
import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.coplet.status.MandatoryStatus;
import org.apache.cocoon.portal.event.impl.LayoutRemoveEvent;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.layout.impl.CopletLayout;
import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext;
import org.apache.cocoon.portal.profile.ProfileManager;
import org.apache.cocoon.xml.XMLUtils;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
/**
*
* @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>
*
* @version CVS $Id: RemovableAspect.java,v 1.1 2003/05/21 13:06:04 cziegeler Exp $
*/
public class RemovableAspect extends AbstractAspect {
/* (non-Javadoc)
* @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext, org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
*/
public void toSAX(RendererAspectContext context,
Layout layout,
PortalService service,
ContentHandler handler)
throws SAXException {
CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
if (cid.getCopletData().isRemovable()) {
}
MandatoryStatus mandatory = (MandatoryStatus) this.getStatus(MandatoryStatus.class, ProfileManager.SESSION_STATUS, cid.getCopletData().getId());
if ( mandatory == null || !mandatory.isMandatory()) {
LayoutRemoveEvent lre = new LayoutRemoveEvent(layout, 0);
XMLUtils.createElement(handler, "remove-uri", service.getLinkService().getLinkURI(lre));
}
context.invokeNext(layout, service, handler);
}
}
1.6 +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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- portal.xconf 20 May 2003 14:06:43 -0000 1.5
+++ portal.xconf 21 May 2003 13:06:05 -0000 1.6
@@ -46,7 +46,7 @@
<aspect name="coplet-sizing" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.SizingAspect"/>
<!-- This aspect can be used to render the remove button -->
- <aspect name="coplet-removing" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.RemoveableAspect"/>
+ <aspect name="coplet-removing" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.RemovableAspect"/>
<!-- This aspect can be used to render a full-screen button -->
<aspect name="coplet-full-screen" class="org.apache.cocoon.portal.layout.renderer.aspect.impl.FullScreenCopletAspect"/>
1.6 +26 -40 cocoon-2.1/src/blocks/portal/samples/profiles/layout/portal.xml
Index: portal.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/layout/portal.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- portal.xml 19 May 2003 13:16:34 -0000 1.5
+++ portal.xml 21 May 2003 13:06:05 -0000 1.6
@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<composite-layout static="true" name="tab">
+<composite-layout static="true" name="tab" id="cl1">
<named-item name="News">
- <composite-layout name="column">
+ <composite-layout name="column" id="c1">
<item>
<parameter name="width" value="350" />
- <composite-layout static="true" name="row">
+ <composite-layout static="true" name="row" id="r1">
<item>
- <coplet-layout static="true" name="coplet">
- <id>1</id>
+ <coplet-layout static="true" name="coplet" id="1">
<parameter name="title" value="Newsweek"/>
<coplet-instance-data>Newsweek-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
- <coplet-layout name="coplet">
- <id>2</id>
+ <coplet-layout name="coplet" id="2">
<parameter name="title" value="NYT Business"/>
<coplet-instance-data>NYTBusiness-1</coplet-instance-data>
</coplet-layout>
@@ -22,25 +20,22 @@
</composite-layout>
</item>
<item>
- <composite-layout static="false" name="row">
+ <composite-layout static="false" name="row" id="r2">
<item>
- <coplet-layout name="coplet">
- <id>3</id>
+ <coplet-layout name="coplet" id="3">
<parameter name="title" value="BBC News"/>
<coplet-instance-data>BBCNews-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
- <composite-layout name="column">
+ <composite-layout name="column" id="c2">
<item>
- <frame-layout name="frame">
- <id>a</id>
+ <frame-layout name="frame" id="a">
<source>cocoon://samples/portal/news/NYTSport.rss</source>
</frame-layout>
</item>
<item>
- <coplet-layout name="coplet">
- <id>4</id>
+ <coplet-layout name="coplet" id="4">
<parameter name="title" value="CNET News" />
<coplet-instance-data>CNET News-1</coplet-instance-data>
</coplet-layout>
@@ -48,18 +43,16 @@
</composite-layout>
</item>
<item>
- <composite-layout name="column">
+ <composite-layout name="column" id="c3">
<item>
- <coplet-layout name="coplet">
- <id>5</id>
+ <coplet-layout name="coplet" id="5">
<parameter name="title" value="CNET Business News" />
<coplet-instance-data>CNET Business-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
<parameter name="bgcolor" value="grey" />
- <frame-layout name="frame">
- <id>b</id>
+ <frame-layout name="frame" id="b">
<source>cocoon://samples/portal/news/CNNEurope.rss</source>
</frame-layout>
</item>
@@ -68,17 +61,15 @@
</composite-layout>
</item>
<item>
- <composite-layout static="false" name="row">
+ <composite-layout static="false" name="row" id="r5">
<item>
- <coplet-layout name="coplet">
- <id>6</id>
+ <coplet-layout name="coplet" id="6">
<parameter name="title" value="Chicago Sunday Times" />
<coplet-instance-data>CSTNews-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
- <coplet-layout name="coplet">
- <id>7</id>
+ <coplet-layout name="coplet" id="7">
<parameter name="title" value="CNN Europe" />
<coplet-instance-data>CNNEurope-1</coplet-instance-data>
</coplet-layout>
@@ -88,20 +79,18 @@
</composite-layout>
</named-item>
<named-item name="Weblogs">
- <composite-layout name="column">
+ <composite-layout name="column" id="c19">
<item>
- <composite-layout name="row">
+ <composite-layout name="row" id="r12">
<item>
- <coplet-layout name="coplet">
- <id>8</id>
+ <coplet-layout name="coplet" id="8">
<parameter name="title" value="ML's Weblog" />
<parameter name="bgcolor" value="#ffff00" />
<coplet-instance-data>ML Weblog-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
- <coplet-layout name="coplet">
- <id>9</id>
+ <coplet-layout name="coplet" id="9">
<parameter name="title" value="CZ's Weblog" />
<parameter name="bgcolor" value="#ffff00" />
<coplet-instance-data>CZ Weblog-1</coplet-instance-data>
@@ -110,10 +99,9 @@
</composite-layout>
</item>
<item>
- <composite-layout name="row">
+ <composite-layout name="row" id="r13">
<item>
- <coplet-layout name="coplet">
- <id>10</id>
+ <coplet-layout name="coplet" id="10">
<parameter name="title" value="Another Weblog" />
<parameter name="bgcolor" value="#ffff00" />
<coplet-instance-data>Weblog-1</coplet-instance-data>
@@ -124,19 +112,17 @@
</composite-layout>
</named-item>
<named-item name="Cocoon">
- <composite-layout name="row">
+ <composite-layout name="row" id="r14">
<item>
- <composite-layout name="column">
+ <composite-layout name="column" id="c39">
<item>
- <coplet-layout name="coplet">
- <id>11</id>
+ <coplet-layout name="coplet" id="11">
<parameter name="title" value="Cocoon Introduction" />
<coplet-instance-data>Introduction-1</coplet-instance-data>
</coplet-layout>
</item>
<item>
- <coplet-layout name="coplet">
- <id>12</id>
+ <coplet-layout name="coplet" id="12">
<parameter name="title" value="Cocoon Overview" />
<coplet-instance-data>Overview-1</coplet-instance-data>
</coplet-layout>
1.2 +2 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDescription.java
Index: AspectDescription.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDescription.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AspectDescription.java 20 May 2003 14:06:43 -0000 1.1
+++ AspectDescription.java 21 May 2003 13:06:05 -0000 1.2
@@ -79,4 +79,5 @@
* If the data is not available, create it automatically (or not)
*/
boolean isAutoCreate();
+
}
1.5 +11 -5 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/Aspectalizable.java
Index: Aspectalizable.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/Aspectalizable.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Aspectalizable.java 20 May 2003 14:06:43 -0000 1.4
+++ Aspectalizable.java 21 May 2003 13:06:05 -0000 1.5
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.portal.aspect;
-import java.util.List;
+import java.util.Map;
/**
@@ -80,11 +80,17 @@
void setAspectData(String aspectName, Object data);
/**
- * Return all aspect datas
- * @return A list of objects
+ * Return all aspect datas
+ * @return A map of data objects, the keys are built by the aspect names
*/
- List getAspectDatas();
+ Map getAspectDatas();
+ /**
+ * Return all persistent aspect datas
+ * @return A map of data objects, the keys are built by the aspect names
+ */
+ Map getPersistentAspectDatas();
+
/**
* Is this aspect supported
*/
1.2 +3 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectalizableDescription.java
Index: AspectalizableDescription.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectalizableDescription.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AspectalizableDescription.java 20 May 2003 14:06:43 -0000 1.1
+++ AspectalizableDescription.java 21 May 2003 13:06:05 -0000 1.2
@@ -67,11 +67,11 @@
/**
* @return All {@link AspectDescription}s
*/
- List getAspects();
+ List getAspectDescriptions();
/**
* Return the description for an aspect
*/
- AspectDescription getAspect(String name);
+ AspectDescription getAspectDescription(String name);
}
1.5 +5 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDataHandler.java
Index: AspectDataHandler.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDataHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AspectDataHandler.java 20 May 2003 14:06:43 -0000 1.4
+++ AspectDataHandler.java 21 May 2003 13:06:05 -0000 1.5
@@ -50,7 +50,7 @@
*/
package org.apache.cocoon.portal.aspect;
-import java.util.List;
+import java.util.Map;
/**
* This interface is able to get a stored aspect
@@ -66,8 +66,10 @@
void setAspectData(Aspectalizable owner, String aspectName, Object data);
- List getAspectDatas(Aspectalizable owner);
+ Map getAspectDatas(Aspectalizable owner);
+ Map getPersistentAspectDatas(Aspectalizable owner);
+
boolean isAspectSupported(String aspectName);
}
1.2 +6 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDataStore.java
Index: AspectDataStore.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/aspect/AspectDataStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AspectDataStore.java 20 May 2003 14:06:43 -0000 1.1
+++ AspectDataStore.java 21 May 2003 13:06:05 -0000 1.2
@@ -67,4 +67,9 @@
void setAspectData(Aspectalizable owner, String aspectName, Object data);
+ /**
+ * Is the data persistent
+ */
+ boolean isPersistent();
+
}
1.2 +13 -3 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/factory/Producible.java
Index: Producible.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/factory/Producible.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Producible.java 20 May 2003 14:06:43 -0000 1.1
+++ Producible.java 21 May 2003 13:06:06 -0000 1.2
@@ -57,8 +57,6 @@
/**
* This interface marks an object that can be created by a factory.
*
- * TODO - perhaps we should add an id here as well
- *
* @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
*
* @version CVS $Id$
@@ -72,7 +70,19 @@
String getName();
/**
+ * Get the unique id of this object
+ * @return String Unique id
+ */
+ String getId();
+
+ /**
* Set the layout description
*/
void setDescription(ProducibleDescription description);
+
+ /**
+ * Initialize the object. This should only be called once directly
+ * after the creation
+ */
+ void initialize(String name, String id);
}
1.2 +27 -1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/factory/impl/AbstractProducible.java
Index: AbstractProducible.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/factory/impl/AbstractProducible.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractProducible.java 20 May 2003 14:06:42 -0000 1.1
+++ AbstractProducible.java 21 May 2003 13:06:06 -0000 1.2
@@ -69,6 +69,8 @@
protected String name;
+ protected String id;
+
transient protected ProducibleDescription description;
/**
@@ -92,5 +94,29 @@
this.description = description;
}
+ /**
+ * Get the unique id of this object
+ * @return String Unique id
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * Get the unique id of this object
+ * @return String Unique id
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Initialize the object. This should only be called once directly
+ * after the creation
+ */
+ public void initialize(String name, String id) {
+ this.name = name;
+ this.id = id;
+ }
}