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 2004/09/02 17:05:59 UTC
svn commit: rev 37385 - in cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal: . acting event/aspect/impl impl layout/impl layout/renderer/aspect/impl profile profile/impl
Author: cziegeler
Date: Thu Sep 2 08:05:58 2004
New Revision: 37385
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/SaveAction.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
Log:
Move layout key handling to service
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/PortalService.java Thu Sep 2 08:05:58 2004
@@ -18,6 +18,7 @@
import java.util.Iterator;
import org.apache.avalon.framework.component.Component;
+import org.apache.cocoon.portal.layout.Layout;
/**
* This is the central component in the portal. It holds the configuration
@@ -28,7 +29,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>
*
- * @version CVS $Id: PortalService.java,v 1.3 2004/03/05 13:02:08 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public interface PortalService extends Component {
@@ -92,4 +93,22 @@
* Return the component manager for the current portal
*/
PortalComponentManager getComponentManager();
+
+ /**
+ * FIXME this is for the full-screen function
+ * @param layoutKey TODO
+ */
+ void setEntryLayout(String layoutKey, Layout object);
+ Layout getEntryLayout(String layoutKey);
+
+ /**
+ * Change the default layout key for most functions
+ */
+ void setDefaultLayoutKey(String layoutKey);
+
+ /**
+ * Get the default layout key
+ */
+ String getDefaultLayoutKey();
+
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/SaveAction.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/SaveAction.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/SaveAction.java Thu Sep 2 08:05:58 2004
@@ -31,7 +31,7 @@
* This action saves the profile
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: SaveAction.java,v 1.3 2004/03/15 18:18:19 cziegeler Exp $
+ * @version CVS $Id$
*/
public final class SaveAction
extends ServiceableAction
@@ -57,7 +57,7 @@
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
service.setPortalName(par.getParameter("portal-name"));
- service.getComponentManager().getProfileManager().saveUserProfiles();
+ service.getComponentManager().getProfileManager().saveUserProfiles(null);
} catch (ParameterException pe) {
throw new ProcessingException("Parameter portal-name is required.");
} catch (ServiceException ce) {
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/AbstractContentEventAspect.java Thu Sep 2 08:05:58 2004
@@ -36,7 +36,7 @@
* @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>
*
- * @version CVS $Id: AbstractContentEventAspect.java,v 1.4 2004/03/05 13:02:12 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public abstract class AbstractContentEventAspect
extends AbstractLogEnabled
@@ -95,6 +95,7 @@
publisher.publish(e);
}
} catch (Exception ignore) {
+ // ignroe it
}
// the event could not be generated, so try different approach
if (e == null) {
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java Thu Sep 2 08:05:58 2004
@@ -35,14 +35,13 @@
import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.layout.impl.CopletLayout;
-import org.apache.cocoon.portal.profile.ProfileManager;
/**
*
* @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: FullScreenCopletEventAspect.java,v 1.6 2004/03/05 13:02:12 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class FullScreenCopletEventAspect
extends AbstractLogEnabled
@@ -110,12 +109,11 @@
PortalService portalService = null;
try {
portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
- ProfileManager pm = portalService.getComponentManager().getProfileManager();
- final Layout old = pm.getEntryLayout();
+ final Layout old = portalService.getEntryLayout(null);
if ( old != null && old instanceof CopletLayout) {
((CopletLayout)old).getCopletInstanceData().setAspectData("fullScreen", Boolean.FALSE);
}
- pm.setEntryLayout( startingLayout );
+ portalService.setEntryLayout( null, startingLayout );
if ( startingLayout != null && startingLayout instanceof CopletLayout) {
((CopletLayout)startingLayout).getCopletInstanceData().setAspectData("fullScreen", Boolean.TRUE);
}
@@ -147,6 +145,7 @@
eventManager = (EventManager) this.manager.lookup( EventManager.ROLE );
eventManager.getRegister().unsubscribe( this );
} catch (Exception ignore) {
+ // ignore this here
} finally {
this.manager.release( eventManager );
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java Thu Sep 2 08:05:58 2004
@@ -35,7 +35,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>
*
- * @version CVS $Id: PortalManagerImpl.java,v 1.7 2004/03/05 13:02:13 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class PortalManagerImpl
extends AbstractLogEnabled
@@ -61,13 +61,14 @@
*/
public void showPortal(ContentHandler contentHandler, Parameters parameters)
throws SAXException {
-// final boolean useContentDeliverer = (parameters == null ? true :
-// parameters.getParameterAsBoolean("use-content-deliverer", true));
-
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
- Layout portalLayout = service.getComponentManager().getProfileManager().getPortalLayout(null, null);
+ // first check for a full screen layout
+ Layout portalLayout = service.getEntryLayout(null);
+ if ( portalLayout == null ) {
+ portalLayout = service.getComponentManager().getProfileManager().getPortalLayout(null, null);
+ }
Renderer portalLayoutRenderer = service.getComponentManager().getRenderer( portalLayout.getRendererName());
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Thu Sep 2 08:05:58 2004
@@ -36,6 +36,7 @@
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.portal.PortalComponentManager;
import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.layout.Layout;
/**
* Default implementation of a portal service using a session to store
@@ -61,7 +62,9 @@
protected Map portalComponentManagers = new HashMap();
- final protected String key = this.getClass().getName();
+ protected Map portalConfigurations = new HashMap();
+
+ final protected static String KEY = PortalServiceImpl.class.getName();
/* (non-Javadoc)
* @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
@@ -72,11 +75,11 @@
protected PortalServiceInfo getInfo() {
final Request request = ContextHelper.getRequest( this.context );
- PortalServiceInfo info = (PortalServiceInfo) request.getAttribute(this.key);
+ PortalServiceInfo info = (PortalServiceInfo) request.getAttribute(KEY);
if ( info == null ) {
info = new PortalServiceInfo();
info.setup(ContextHelper.getObjectModel(this.context), this.portalComponentManagers);
- request.setAttribute(this.key, info);
+ request.setAttribute(KEY, info);
}
return info;
}
@@ -144,6 +147,7 @@
ContainerUtil.dispose( i.next() );
}
this.portalComponentManagers.clear();
+ this.portalConfigurations.clear();
}
/* (non-Javadoc)
@@ -162,6 +166,8 @@
ContainerUtil.service( c, this.manager );
ContainerUtil.configure( c, current );
ContainerUtil.initialize( c );
+
+ this.portalConfigurations.put( name, current );
} catch (Exception e) {
throw new ConfigurationException("Unable to setup new portal component manager for portal " + name, e);
}
@@ -169,4 +175,55 @@
}
}
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.PortalService#setEntryLayout(org.apache.cocoon.portal.layout.Layout)
+ */
+ public void setEntryLayout(String layoutKey, Layout object) {
+ if ( layoutKey == null ) {
+ layoutKey = this.getDefaultLayoutKey();
+ }
+ if ( object == null ) {
+ this.removeTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
+ } else {
+ this.setTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey, object);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.PortalService#getEntryLayout()
+ */
+ public Layout getEntryLayout(String layoutKey) {
+ if ( layoutKey == null ) {
+ layoutKey = this.getDefaultLayoutKey();
+ }
+ return (Layout)this.getTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.PortalService#setDefaultLayoutKey(java.lang.String)
+ */
+ public void setDefaultLayoutKey(String layoutKey) {
+ if ( layoutKey == null ) {
+ this.removeAttribute("default-layout-key");
+ } else {
+ this.setAttribute("default-layout-key", layoutKey);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.PortalService#getDefaultLayoutKey()
+ */
+ public String getDefaultLayoutKey() {
+ String key = (String)this.getAttribute("default-layout-key");
+ if ( key == null ) {
+ Configuration config = (Configuration)this.portalConfigurations.get(this.getPortalName());
+ key = config.getAttribute("default-layout-key", "portal");
+ if ( key != null ) {
+ this.setDefaultLayoutKey(key);
+ }
+ }
+ return key;
+ }
+
+
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/DefaultLayoutFactory.java Thu Sep 2 08:05:58 2004
@@ -426,7 +426,7 @@
ProfileManager profileManager = service.getComponentManager().getProfileManager();
if ( layout instanceof CopletLayout ) {
// full screen?
- if ( layout.equals(profileManager.getEntryLayout()) ) {
+ if ( layout.equals(service.getEntryLayout(null)) ) {
Event event = new FullScreenCopletEvent(((CopletLayout)layout).getCopletInstanceData(), null);
eventManager = (EventManager)this.manager.lookup(EventManager.ROLE);
eventManager.getPublisher().publish(event);
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/FullScreenCopletAspect.java Thu Sep 2 08:05:58 2004
@@ -47,7 +47,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>
*
- * @version CVS $Id: FullScreenCopletAspect.java,v 1.8 2004/04/25 20:09:34 haul Exp $
+ * @version CVS $Id$
*/
public class FullScreenCopletAspect extends AbstractAspect {
@@ -64,7 +64,7 @@
Boolean supportsFullScreen = (Boolean)cid.getCopletData().getAspectData("full-screen");
if ( supportsFullScreen == null || supportsFullScreen.equals(Boolean.TRUE) ) {
- final Layout fullScreenLayout = service.getComponentManager().getProfileManager().getEntryLayout();
+ final Layout fullScreenLayout = service.getEntryLayout(null);
if ( fullScreenLayout != null && fullScreenLayout.equals( layout )) {
FullScreenCopletEvent event = new FullScreenCopletEvent( cid, null );
XMLUtils.createElement(handler, "fullscreen-uri", service.getComponentManager().getLinkService().getLinkURI(event));
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/ProfileManager.java Thu Sep 2 08:05:58 2004
@@ -49,22 +49,6 @@
*/
Layout getPortalLayout(String layoutKey, String layoutID);
- /**
- * FIXME this is for the full-screen function
- */
- void setEntryLayout(Layout object);
- Layout getEntryLayout();
-
- /**
- * 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);
@@ -74,22 +58,41 @@
*/
CopletData getCopletData(String copletDataId);
+ /**
+ * This method is invoked when the user logs into the portal.
+ */
void login();
+ /**
+ * This method is invoked when the user logs out of the portal
+ *
+ */
void logout();
+ /**
+ * New coplet instance datas have to be registered using this method.
+ */
void register(CopletInstanceData coplet);
+ /**
+ * Removed coplet instance datas have to be unregistered using this method.
+ */
void unregister(CopletInstanceData coplet);
+ /**
+ * New layouts have to be registered using this method.
+ */
void register(Layout layout);
+ /**
+ * New layouts have to be unregistered using this method.
+ */
void unregister(Layout layout);
/**
* Save the profile
*/
- void saveUserProfiles();
+ void saveUserProfiles(String layoutKey);
/**
* Get all instances
@@ -101,4 +104,18 @@
*/
Collection getCopletDatas();
+ /**
+ * Copy the current (default) layout and store it under
+ * the provided key.
+ * The copy includes copying of layout objects (with attached
+ * items) and coplet instance datas.
+ */
+ Layout copyProfile(String layoutKey);
+
+ /**
+ * Store the provided profile under the layoutKey.
+ * This method can be used to overwrite a profile with another
+ * one.
+ */
+ void storeProfile(Layout rootLayout, String layoutKey);
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java Thu Sep 2 08:05:58 2004
@@ -15,16 +15,11 @@
*/
package org.apache.cocoon.portal.profile.impl;
-import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.layout.Layout;
import org.apache.cocoon.portal.profile.ProfileManager;
@@ -38,9 +33,7 @@
*/
public abstract class AbstractProfileManager
extends AbstractLogEnabled
- implements Serviceable, Configurable, ProfileManager, ThreadSafe {
-
- protected String defaultLayoutKey;
+ implements Serviceable, ProfileManager, ThreadSafe {
protected ServiceManager manager;
@@ -66,9 +59,9 @@
}
/* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#saveUserProfiles()
+ * @see org.apache.cocoon.portal.profile.ProfileManager#saveUserProfiles(String)
*/
- public void saveUserProfiles() {
+ public void saveUserProfiles(String layoutKey) {
// overwrite in subclass
}
@@ -87,47 +80,6 @@
}
/* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#setDefaultLayoutKey(java.lang.String)
- */
- 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 (ServiceException ce) {
- // this should never happen
- throw new CascadingRuntimeException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#getDefaultLayoutKey()
- */
- 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 this.defaultLayoutKey;
- }
- return defaultLayoutKey;
- } catch (ServiceException ce) {
- // this should never happen
- throw new CascadingRuntimeException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
-
- }
-
- /* (non-Javadoc)
* @see org.apache.cocoon.portal.profile.ProfileManager#login()
*/
public void login() {
@@ -142,47 +94,16 @@
}
/* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#setEntryLayout(org.apache.cocoon.portal.layout.Layout)
+ * @see org.apache.cocoon.portal.profile.ProfileManager#copyProfile(java.lang.String)
*/
- public void setEntryLayout(Layout object) {
- String layoutKey = this.getDefaultLayoutKey();
- PortalService service = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- if ( object == null ) {
- service.removeTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
- } else {
- service.setTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey, object);
- }
- } catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup service manager.", e);
- } finally {
- this.manager.release(service);
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#getEntryLayout()
- */
- public Layout getEntryLayout() {
- String layoutKey = this.getDefaultLayoutKey();
- PortalService service = null;
- try {
- service = (PortalService) this.manager.lookup(PortalService.ROLE);
- return (Layout)service.getTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
- } catch (ServiceException e) {
- throw new CascadingRuntimeException("Unable to lookup service manager.", e);
- } finally {
- this.manager.release(service);
- }
+ public Layout copyProfile(String layoutKey) {
+ throw new RuntimeException("Copy profile is not implemented.");
}
/* (non-Javadoc)
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
- */
- public void configure(Configuration configuration) throws ConfigurationException {
- Configuration child = configuration.getChild("default-layout-key");
- // get configured default LayoutKey
- this.defaultLayoutKey = child.getValue("portal");
+ * @see org.apache.cocoon.portal.profile.ProfileManager#storeProfile(org.apache.cocoon.portal.layout.Layout, java.lang.String)
+ */
+ public void storeProfile(Layout rootLayout, String layoutKey) {
+ throw new RuntimeException("Store profile is not implemented.");
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java Thu Sep 2 08:05:58 2004
@@ -61,10 +61,10 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#logout()
*/
public void logout() {
- final String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
ServiceSelector adapterSelector = null;
try {
+ final String layoutKey = service.getDefaultLayoutKey();
adapterSelector = (ServiceSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
service = (PortalService)this.manager.lookup(PortalService.ROLE);
@@ -146,11 +146,11 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#getCopletInstanceData(java.lang.String)
*/
public CopletInstanceData getCopletInstanceData(String copletID) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
attribute = "CopletInstanceData:"+layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
@@ -167,11 +167,11 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#getCopletData(java.lang.String)
*/
public CopletData getCopletData(String copletDataId) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
attribute = "CopletInstanceData:"+layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
@@ -198,12 +198,12 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#getCopletInstanceData(org.apache.cocoon.portal.coplet.CopletData)
*/
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);
+ final String layoutKey = service.getDefaultLayoutKey();
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
@@ -227,11 +227,11 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
*/
public void register(CopletInstanceData coplet) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
@@ -249,11 +249,11 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.coplet.CopletInstanceData)
*/
public void unregister(CopletInstanceData coplet) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
String attribute = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
attribute = "CopletInstanceData:" + layoutKey;
CopletInstanceDataManager copletInstanceDataManager = (CopletInstanceDataManager)service.getAttribute(attribute);
@@ -267,11 +267,14 @@
}
}
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.layout.Layout)
+ */
public void register(Layout layout) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
Map layoutMap = (Map)service.getAttribute("Layout-Map:" + layoutKey);
if ( layoutMap == null ) {
@@ -294,11 +297,14 @@
}
}
+ /* (non-Javadoc)
+ * @see org.apache.cocoon.portal.profile.ProfileManager#unregister(org.apache.cocoon.portal.layout.Layout)
+ */
public void unregister(Layout layout) {
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
Map layoutMap = (Map)service.getAttribute("Layout-Map:" + layoutKey);
@@ -328,12 +334,7 @@
adapterSelector = (ServiceSelector)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;
+ layoutKey = service.getDefaultLayoutKey();
}
final String layoutAttributeKey = "Layout:" + layoutKey;
@@ -380,10 +381,10 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#getCopletDatas()
*/
public Collection getCopletDatas() {
- final String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
CopletDataManager manager = (CopletDataManager)service.getAttribute("CopletData:" + layoutKey);
return manager.getCopletData().values();
} catch (Exception e) {
@@ -397,10 +398,10 @@
* @see org.apache.cocoon.portal.profile.ProfileManager#getCopletInstanceDatas()
*/
public Collection getCopletInstanceDatas() {
- final String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
CopletInstanceDataManager manager = (CopletInstanceDataManager)service.getAttribute("CopletInstanceData:" + layoutKey);
return manager.getCopletInstanceData().values();
} catch (Exception e) {
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/AuthenticationProfileManager.java Thu Sep 2 08:05:58 2004
@@ -147,13 +147,15 @@
return layout;
}
- public void saveUserProfiles() {
- final String layoutKey = this.getDefaultLayoutKey();
+ public void saveUserProfiles(String layoutKey) {
ProfileLS adapter = null;
PortalService service = null;
try {
adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
service = (PortalService) this.manager.lookup(PortalService.ROLE);
+ if ( layoutKey == null ) {
+ layoutKey = service.getDefaultLayoutKey();
+ }
RequestState state = this.getRequestState();
UserHandler handler = state.getHandler();
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java Thu Sep 2 08:05:58 2004
@@ -77,12 +77,12 @@
protected Map copletDatas;
protected UserProfile getUserProfile(String layoutKey) {
- if ( layoutKey == null ) {
- layoutKey = this.getDefaultLayoutKey();
- }
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
+ if ( layoutKey == null ) {
+ layoutKey = service.getDefaultLayoutKey();
+ }
return (UserProfile)service.getAttribute(KEY_PREFIX + layoutKey);
} catch (ServiceException e) {
@@ -95,10 +95,10 @@
protected void removeUserProfiles() {
// TODO: remove all profiles - we have to rememember all used layout keys
- String layoutKey = this.getDefaultLayoutKey();
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
+ final String layoutKey = service.getDefaultLayoutKey();
service.removeAttribute(KEY_PREFIX + layoutKey);
} catch (ServiceException e) {
@@ -111,7 +111,7 @@
protected void storeUserProfile(String layoutKey, PortalService service, UserProfile profile) {
if ( layoutKey == null ) {
- layoutKey = this.getDefaultLayoutKey();
+ layoutKey = service.getDefaultLayoutKey();
}
service.setAttribute(KEY_PREFIX + layoutKey, profile);
}
@@ -289,12 +289,7 @@
try {
service = (PortalService) this.manager.lookup(PortalService.ROLE);
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;
+ layoutKey = service.getDefaultLayoutKey();
}
UserProfile profile = this.getUserProfile(layoutKey);
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/profile/impl/StaticProfileManager.java Thu Sep 2 08:05:58 2004
@@ -47,8 +47,10 @@
*
* @version CVS $Id$
*/
-public class StaticProfileManager extends AbstractProfileManager implements Configurable
-{
+public class StaticProfileManager
+extends AbstractProfileManager
+implements Configurable {
+
protected String profilesPath;
protected StaticBucketMap copletInstanceDataManagers = new StaticBucketMap();
@@ -66,11 +68,7 @@
service = (PortalService) this.manager.lookup(PortalService.ROLE);
if (layoutKey == null) {
- Layout l = getEntryLayout();
- if (null != l) {
- return l;
- }
- layoutKey = getDefaultLayoutKey();
+ layoutKey = service.getDefaultLayoutKey();
}
String serviceKey = LAYOUTKEY_PREFIX + layoutKey;
@@ -329,18 +327,10 @@
}
/* (non-Javadoc)
- * @see org.apache.cocoon.portal.profile.ProfileManager#saveUserProfiles()
- */
- public void saveUserProfiles() {
- // nothing to do
- }
-
- /* (non-Javadoc)
* @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
public void configure(Configuration configuration)
throws ConfigurationException {
- super.configure(configuration);
Configuration child = configuration.getChild("profiles-path");
this.profilesPath = child.getValue("cocoon:/profiles");
}