Author: cziegeler
Date: Mon Oct 3 09:46:51 2005
New Revision: 293387
URL: http://svn.apache.org/viewcvs?rev=293387&view=rev
Log:
Clean up actions and improve event handling with new user events
Added:
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java (with props)
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java (with props)
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java (with props)
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java (with props)
Modified:
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/BookmarkAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/CopletSetDataAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LoginAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LogoutAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/SaveAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/URLAction.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletEventDescription.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletMapping.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/FullScreenMapping.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutEventDescription.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutMapping.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/Mapping.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
cocoon/trunk/lib/optional/cowarp-0.5-dev-20051002.jar
Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java?rev=293387&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java Mon Oct 3 09:46:51 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.acting;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.acting.ServiceableAction;
+import org.apache.cocoon.portal.PortalService;
+
+/**
+ * This abstract action provides access to the {@link PortalService}.
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version $Id$
+ */
+public abstract class AbstractPortalAction
+ extends ServiceableAction
+ implements ThreadSafe, Disposable {
+
+ protected PortalService portalService;
+
+ /**
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
+ */
+ public void dispose() {
+ if ( this.manager != null ) {
+ this.manager.release(this.portalService);
+ this.portalService = null;
+ this.manager = null;
+ }
+ }
+
+ /**
+ * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ */
+ public void service(ServiceManager manager) throws ServiceException {
+ super.service(manager);
+ this.portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
+ }
+}
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/AbstractPortalAction.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/BookmarkAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/BookmarkAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/BookmarkAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/BookmarkAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-200% The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,16 +30,13 @@
import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.Session;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.acting.helpers.CopletMapping;
import org.apache.cocoon.portal.acting.helpers.FullScreenMapping;
import org.apache.cocoon.portal.acting.helpers.LayoutMapping;
@@ -66,26 +63,26 @@
* </bookmarks>
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public class BookmarkAction
-extends ServiceableAction
-implements ThreadSafe, Parameterizable {
+ extends AbstractPortalAction
+ implements Parameterizable {
protected Map eventMap = new HashMap();
-
+
protected String historyParameterName;
-
+
protected String configurationFile;
-
- /* (non-Javadoc)
+
+ /**
* @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters)
*/
public void parameterize(Parameters parameters) throws ParameterException {
this.historyParameterName = parameters.getParameter("history-parameter-name", "history");
this.configurationFile = parameters.getParameter("src", null);
if ( this.configurationFile == null ) return;
-
+
// The "lazy-load" parameter allows to defer loading of the config from "src" at
// the first call to act. This is for now undocumented until
// That was needed in the case of a dynamic source ("cocoon://blah") produced by the sitemap where
@@ -95,7 +92,7 @@
loadConfig();
}
}
-
+
private void loadConfig() throws ParameterException {
Configuration config;
org.apache.excalibur.source.SourceResolver resolver = null;
@@ -165,11 +162,14 @@
}
}
}
-
+
// Nullify config filename so as not to reload it.
this.configurationFile = null;
}
+ /**
+ * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+ */
public Map act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
@@ -177,7 +177,7 @@
Parameters par)
throws Exception {
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN act resolver="+resolver+
+ this.getLogger().debug("Bookmark action called with resolver="+resolver+
", objectModel="+objectModel+
", source="+source+
", par="+par);
@@ -188,61 +188,46 @@
}
Map result;
- PortalService service = null;
- try {
- service = (PortalService)this.manager.lookup(PortalService.ROLE);
+ this.portalService.getComponentManager().getPortalManager().process();
- service.getComponentManager().getPortalManager().process();
-
- final Request request = ObjectModelHelper.getRequest(objectModel);
- final Session session = request.getSession(false);
- final List events = new ArrayList();
-
- // is the history invoked?
- final String historyValue = request.getParameter(this.historyParameterName);
- if ( historyValue != null && session != null) {
- // get the history
- final List history = (List)session.getAttribute("portal-history");
- if ( history != null ) {
- final int index = Integer.parseInt(historyValue);
- final List state = (List)history.get(index);
- if ( state != null ) {
- final Iterator iter = state.iterator();
- while ( iter.hasNext() ) {
- Mapping m = (Mapping)iter.next();
- events.add(m.getEvent(service, null));
- }
- while (history.size() > index ) {
- history.remove(history.size()-1);
- }
+ final Request request = ObjectModelHelper.getRequest(objectModel);
+ final Session session = request.getSession(false);
+ final List events = new ArrayList();
+
+ // is the history invoked?
+ final String historyValue = request.getParameter(this.historyParameterName);
+ if ( historyValue != null && session != null) {
+ // get the history
+ final List history = (List)session.getAttribute("portal-history");
+ if ( history != null ) {
+ final int index = Integer.parseInt(historyValue);
+ final List state = (List)history.get(index);
+ if ( state != null ) {
+ final Iterator iter = state.iterator();
+ while ( iter.hasNext() ) {
+ Mapping m = (Mapping)iter.next();
+ events.add(m.getEvent(this.portalService, null));
+ }
+ while (history.size() > index ) {
+ history.remove(history.size()-1);
}
}
}
- Enumeration enumeration = request.getParameterNames();
- while (enumeration.hasMoreElements()) {
- String name = (String)enumeration.nextElement();
- String value = request.getParameter(name);
-
- Mapping m = (Mapping) this.eventMap.get(name);
- if ( m != null ) {
- events.add(m.getEvent(service, value));
- }
- }
- String uri = service.getComponentManager().getLinkService().getLinkURI(events);
- result = new HashMap();
- result.put("uri", uri.substring(uri.indexOf('?')+1));
-
- } catch (ServiceException ce) {
- throw new ProcessingException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
-
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END act map={}");
}
+ Enumeration enumeration = request.getParameterNames();
+ while (enumeration.hasMoreElements()) {
+ String name = (String)enumeration.nextElement();
+ String value = request.getParameter(name);
+
+ Mapping m = (Mapping) this.eventMap.get(name);
+ if ( m != null ) {
+ events.add(m.getEvent(this.portalService, value));
+ }
+ }
+ String uri = this.portalService.getComponentManager().getLinkService().getLinkURI(events);
+ result = new HashMap();
+ result.put("uri", uri.substring(uri.indexOf('?')+1));
return result;
}
-
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/CopletSetDataAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/CopletSetDataAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/CopletSetDataAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/CopletSetDataAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,75 +19,59 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.portal.Constants;
-import org.apache.cocoon.portal.PortalService;
import org.apache.cocoon.portal.event.Event;
import org.apache.cocoon.portal.event.EventManager;
import org.apache.cocoon.portal.event.impl.CopletJXPathEvent;
/**
- * Using this action, you can set values in a coplet
+ * Using this action, you can set values in a coplet.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public class CopletSetDataAction
-extends ServiceableAction {
+ extends AbstractPortalAction {
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
throws Exception {
- PortalService portalService = null;
- try {
+ // determine coplet id
+ String copletId = null;
+ Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
+ if (context != null) {
+ copletId = (String)context.get(Constants.COPLET_ID_KEY);
+ } else {
+ copletId = (String)objectModel.get(Constants.COPLET_ID_KEY);
+ }
- portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
+ if (copletId == null) {
+ throw new ConfigurationException("copletId must be passed in the object model either directly (e.g. by using ObjectModelAction) or within the parent context.");
+ }
- // determine coplet id
- String copletId = null;
- Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
- if (context != null) {
- copletId = (String)context.get(Constants.COPLET_ID_KEY);
- } else {
- copletId = (String)objectModel.get(Constants.COPLET_ID_KEY);
- }
-
- if (copletId == null) {
- throw new ConfigurationException("copletId must be passed in the object model either directly (e.g. by using ObjectModelAction) or within the parent context.");
- }
-
- // now traverse parameters:
- // parameter name is path
- // parameter value is value
- // if the value is null or empty, the value is not set!
- final String[] names = parameters.getNames();
- if ( names != null ) {
- final EventManager publisher = portalService.getComponentManager().getEventManager();
- for(int i=0; i<names.length; i++) {
- final String path = names[i];
- final String value = parameters.getParameter(path, null );
- if ( value != null && value.trim().length() > 0 ) {
- final Event event = new CopletJXPathEvent(portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId),
- path,
- value);
- publisher.send(event);
- }
+ // now traverse parameters:
+ // parameter name is path
+ // parameter value is value
+ // if the value is null or empty, the value is not set!
+ final String[] names = parameters.getNames();
+ if ( names != null ) {
+ final EventManager publisher = this.portalService.getComponentManager().getEventManager();
+ for(int i=0; i<names.length; i++) {
+ final String path = names[i];
+ final String value = parameters.getParameter(path, null );
+ if ( value != null && value.trim().length() > 0 ) {
+ final Event event = new CopletJXPathEvent(this.portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId),
+ path,
+ value);
+ publisher.send(event);
}
}
-
- return EMPTY_MAP;
-
- } catch (ServiceException e) {
- throw new ProcessingException("Unable to lookup component.", e);
- } finally {
- this.manager.release(portalService);
- }
+ }
+ return EMPTY_MAP;
}
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LoginAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LoginAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LoginAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LoginAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,25 +18,22 @@
import java.util.Map;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.user.UserDidLoginEvent;
+import org.apache.cocoon.portal.profile.PortalUser;
/**
- * This action logs the user into the portal
+ * This action logs the user into the portal.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
-*/
+ * @version $Id$
+ */
public final class LoginAction
-extends ServiceableAction
-implements ThreadSafe {
+ extends AbstractPortalAction {
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
public Map act(Redirector redirector,
@@ -46,27 +43,13 @@
Parameters par)
throws Exception {
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN act resolver="+resolver+
- ", objectModel="+objectModel+
- ", source="+source+
- ", par="+par);
+ this.getLogger().debug("Portal login action called.");
}
- PortalService service = null;
- try {
- service = (PortalService)this.manager.lookup(PortalService.ROLE);
- service.getComponentManager().getProfileManager().login();
- } catch (ServiceException ce) {
- throw new ProcessingException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
-
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END act map={}");
- }
+ PortalUser user = this.portalService.getComponentManager().getProfileManager().getUser();
+ Event event = new UserDidLoginEvent(user);
+ this.portalService.getComponentManager().getEventManager().send(event);
return EMPTY_MAP;
}
-
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LogoutAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LogoutAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LogoutAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/LogoutAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,25 +18,22 @@
import java.util.Map;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.user.UserWillLogoutEvent;
+import org.apache.cocoon.portal.profile.PortalUser;
/**
- * This action logs the current user out of the portal
+ * This action logs the current user out of the portal.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
-*/
+ * @version $Id$
+ */
public final class LogoutAction
-extends ServiceableAction
-implements ThreadSafe {
+ extends AbstractPortalAction {
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
public Map act(Redirector redirector,
@@ -46,25 +43,12 @@
Parameters par)
throws Exception {
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN act resolver="+resolver+
- ", objectModel="+objectModel+
- ", source="+source+
- ", par="+par);
+ this.getLogger().debug("Portal logout action called.");
}
- PortalService service = null;
- try {
- service = (PortalService)this.manager.lookup(PortalService.ROLE);
- service.getComponentManager().getProfileManager().logout();
- } catch (ServiceException ce) {
- throw new ProcessingException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
-
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END act map={}");
- }
+ PortalUser user = this.portalService.getComponentManager().getProfileManager().getUser();
+ Event event = new UserWillLogoutEvent(user);
+ this.portalService.getComponentManager().getEventManager().send(event);
return EMPTY_MAP;
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/SaveAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/SaveAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/SaveAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/SaveAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,25 +18,19 @@
import java.util.Map;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.portal.PortalService;
/**
* This action saves the profile.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id$
+ * @version $Id$
*/
public final class SaveAction
-extends ServiceableAction
-implements ThreadSafe {
+ extends AbstractPortalAction {
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
public Map act(Redirector redirector,
@@ -46,26 +40,10 @@
Parameters par)
throws Exception {
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN act resolver="+resolver+
- ", objectModel="+objectModel+
- ", source="+source+
- ", par="+par);
- }
-
- PortalService service = null;
- try {
- service = (PortalService)this.manager.lookup(PortalService.ROLE);
- service.getComponentManager().getProfileManager().saveUserProfiles(null);
- } catch (ServiceException ce) {
- throw new ProcessingException("Unable to lookup portal service.", ce);
- } finally {
- this.manager.release(service);
- }
-
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END act map={}");
+ this.getLogger().debug("Portal Save Action called.");
}
+ this.portalService.getComponentManager().getProfileManager().saveUserProfiles(null);
return EMPTY_MAP;
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/URLAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/URLAction.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/URLAction.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/URLAction.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,12 +29,15 @@
* This action builds correct urls. It uses the src parameter as the base url
* and adds all sitemap parameters as request parameters.
*
- * @version $Id:$
-*/
+ * @version $Id$
+ */
public class URLAction
-extends ServiceableAction
-implements ThreadSafe {
+ extends ServiceableAction
+ implements ThreadSafe {
+ /**
+ * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+ */
public Map act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
@@ -42,7 +45,7 @@
Parameters par)
throws Exception {
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN act resolver="+resolver+
+ this.getLogger().debug("Portal URL Action called with resolver="+resolver+
", objectModel="+objectModel+
", source="+source+
", par="+par);
@@ -66,10 +69,9 @@
}
final Map result = Collections.singletonMap("url", buffer.toString());
if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END act map={}");
+ this.getLogger().debug("Portal URL Action provides url=" + buffer.toString());
}
return result;
}
-
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletEventDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletEventDescription.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletEventDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletEventDescription.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,15 +19,18 @@
import org.apache.cocoon.portal.event.Event;
/**
- * Helper class for an coplet event
- *
+ * Helper class for an coplet event.
+ *
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: CopletEventDescription.java,v 1.2 2004/03/05 13:02:09 bdelacretaz Exp $
+ * @version $Id$
*/
public class CopletEventDescription extends CopletMapping {
public Object data;
+ /**
+ * @see org.apache.cocoon.portal.acting.helpers.Mapping#getEvent(org.apache.cocoon.portal.PortalService, java.lang.Object)
+ */
public Event getEvent(PortalService service, Object data) {
return super.getEvent(service, (data == null ? this.data : data));
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletMapping.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletMapping.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletMapping.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/CopletMapping.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,19 +21,22 @@
import org.apache.cocoon.portal.event.impl.CopletJXPathEvent;
/**
- * Helper class for an coplet event
- *
+ * Helper class for an coplet event.
+ *
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: CopletMapping.java,v 1.2 2004/03/05 13:02:09 bdelacretaz Exp $
+ * @version $Id$
*/
public class CopletMapping extends Mapping {
+
public String copletId;
public String path;
+ /**
+ * @see org.apache.cocoon.portal.acting.helpers.Mapping#getEvent(org.apache.cocoon.portal.PortalService, java.lang.Object)
+ */
public Event getEvent(PortalService service, Object data) {
CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(this.copletId);
Event e = new CopletJXPathEvent(cid, this.path, data);
return e;
}
-
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/FullScreenMapping.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/FullScreenMapping.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/FullScreenMapping.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/FullScreenMapping.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,15 +23,19 @@
import org.apache.cocoon.portal.profile.ProfileManager;
/**
- * Helper class for a full screen event
- *
+ * Helper class for a full screen event.
+ *
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
* @version CVS $Id: CopletMapping.java 30941 2004-07-29 19:56:58Z vgritsenko $
*/
public class FullScreenMapping extends Mapping {
+
public String copletId;
public String layoutId;
-
+
+ /**
+ * @see org.apache.cocoon.portal.acting.helpers.Mapping#getEvent(org.apache.cocoon.portal.PortalService, java.lang.Object)
+ */
public Event getEvent(PortalService service, Object data) {
final ProfileManager manager = service.getComponentManager().getProfileManager();
final CopletInstanceData cid = manager.getCopletInstanceData(this.copletId);
@@ -40,5 +44,4 @@
Event e = new FullScreenCopletEvent(cid, layout);
return e;
}
-
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutEventDescription.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutEventDescription.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutEventDescription.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutEventDescription.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,15 +19,18 @@
import org.apache.cocoon.portal.event.Event;
/**
- * Helper class for a layout event
- *
+ * Helper class for a layout event.
+ *
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: LayoutEventDescription.java,v 1.2 2004/03/05 13:02:09 bdelacretaz Exp $
+ * @version $Id$
*/
public class LayoutEventDescription extends LayoutMapping {
public Object data;
+ /**
+ * @see org.apache.cocoon.portal.acting.helpers.Mapping#getEvent(org.apache.cocoon.portal.PortalService, java.lang.Object)
+ */
public Event getEvent(PortalService service, Object data) {
return super.getEvent(service, (data == null ? this.data : data));
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutMapping.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutMapping.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutMapping.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/LayoutMapping.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,15 +21,19 @@
import org.apache.cocoon.portal.layout.Layout;
/**
- * Helper class for a layout event
+ * Helper class for a layout event.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: LayoutMapping.java,v 1.2 2004/03/05 13:02:09 bdelacretaz Exp $
-*/
+ * @version $Id$
+ */
public class LayoutMapping extends Mapping {
+
public String layoutId;
public String path;
-
+
+ /**
+ * @see org.apache.cocoon.portal.acting.helpers.Mapping#getEvent(org.apache.cocoon.portal.PortalService, java.lang.Object)
+ */
public Event getEvent(PortalService service, Object data) {
Layout layout = service.getComponentManager().getProfileManager().getPortalLayout(null, this.layoutId);
Event e = new JXPathEvent(layout, this.path, data);
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/Mapping.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/Mapping.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/Mapping.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/acting/helpers/Mapping.java Mon Oct 3 09:46:51 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,12 +21,12 @@
import org.apache.cocoon.portal.event.Event;
/**
- * Helper class for an event
+ * Helper class for an event.
*
* @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: Mapping.java,v 1.3 2004/03/29 12:22:16 cziegeler Exp $
-*/
+ * @version $Id$
+ */
public abstract class Mapping implements Serializable {
-
+
public abstract Event getEvent(PortalService service, Object data);
}
Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java?rev=293387&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java Mon Oct 3 09:46:51 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.event.user;
+
+import org.apache.cocoon.portal.profile.PortalUser;
+
+/**
+ * This event is send when a new user logs into the portal.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public class UserDidLoginEvent implements UserEvent {
+
+ protected final PortalUser portalUser;
+
+ public UserDidLoginEvent(PortalUser pu) {
+ this.portalUser = pu;
+ }
+ public PortalUser getPortalUser() {
+ return portalUser;
+ }
+}
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserDidLoginEvent.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java?rev=293387&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java Mon Oct 3 09:46:51 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.event.user;
+
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.profile.PortalUser;
+
+/**
+ * This interface marks an event as a user related event.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public interface UserEvent extends Event {
+
+ PortalUser getPortalUser();
+}
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserEvent.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java?rev=293387&view=auto
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java (added)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java Mon Oct 3 09:46:51 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.event.user;
+
+import org.apache.cocoon.portal.profile.PortalUser;
+
+/**
+ * This event is send when a user logs out from the portal.
+ * Note, that not in all circumstances a logout is received from a user.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public class UserWillLogoutEvent implements UserEvent {
+
+ protected final PortalUser portalUser;
+
+ public UserWillLogoutEvent(PortalUser pu) {
+ this.portalUser = pu;
+ }
+ public PortalUser getPortalUser() {
+ return portalUser;
+ }
+}
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/user/UserWillLogoutEvent.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/ProfileManager.java Mon Oct 3 09:46:51 2005
@@ -58,17 +58,6 @@
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);
@@ -122,4 +111,7 @@
* Get current user information
*/
PortalUser getUser();
+
+ void login();
+ void logout();
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractProfileManager.java Mon Oct 3 09:46:51 2005
@@ -16,6 +16,7 @@
package org.apache.cocoon.portal.profile.impl;
import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
@@ -23,7 +24,12 @@
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.event.Receiver;
+import org.apache.cocoon.portal.event.user.UserDidLoginEvent;
+import org.apache.cocoon.portal.event.user.UserEvent;
+import org.apache.cocoon.portal.event.user.UserWillLogoutEvent;
import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.profile.PortalUser;
import org.apache.cocoon.portal.profile.ProfileManager;
/**
@@ -35,7 +41,7 @@
*/
public abstract class AbstractProfileManager
extends AbstractLogEnabled
- implements Serviceable, Disposable, ProfileManager, ThreadSafe {
+ implements Serviceable, Disposable, ProfileManager, ThreadSafe, Receiver, Initializable {
/** The service manager of the portal application. */
protected ServiceManager manager;
@@ -56,6 +62,9 @@
*/
public void dispose() {
if ( this.manager != null ) {
+ if ( this.portalService != null ) {
+ this.portalService.getComponentManager().getEventManager().unsubscribe(this);
+ }
this.manager.release(this.portalService);
this.portalService = null;
this.manager = null;
@@ -63,6 +72,25 @@
}
/**
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
+ */
+ public void initialize() throws Exception {
+ this.portalService.getComponentManager().getEventManager().subscribe(this);
+ }
+
+ /**
+ * Receives any user related event and invokes login, logout etc.
+ * @see Receiver
+ */
+ public void inform(UserEvent event, PortalService service) {
+ if ( event instanceof UserDidLoginEvent ) {
+ this.login(event.getPortalUser());
+ } else if ( event instanceof UserWillLogoutEvent ) {
+ this.logout(event.getPortalUser());
+ }
+ }
+
+ /**
* @see org.apache.cocoon.portal.profile.ProfileManager#register(org.apache.cocoon.portal.coplet.CopletInstanceData)
*/
public void register(CopletInstanceData coplet) {
@@ -113,16 +141,30 @@
}
/**
+ * This method is invoked when a user logs in.
+ */
+ protected void login(PortalUser user) {
+ // overwrite in subclass
+ }
+
+ /**
+ * This method is invoked when a user logs out.
+ */
+ protected void logout(PortalUser user) {
+ // overwrite in subclass
+ }
+
+ /**
* @see org.apache.cocoon.portal.profile.ProfileManager#login()
*/
public void login() {
- // overwrite in subclass
+ throw new RuntimeException("Don't use the login method anymore.");
}
/**
* @see org.apache.cocoon.portal.profile.ProfileManager#logout()
*/
public void logout() {
- // overwrite in subclass
+ throw new RuntimeException("Don't use the logout method anymore.");
}
}
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/AbstractUserProfileManager.java Mon Oct 3 09:46:51 2005
@@ -34,6 +34,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.portal.profile.PortalUser;
/**
* An abstract profile manager providing a different profile for each user.
@@ -47,19 +48,19 @@
extends AbstractProfileManager {
/**
- * @see org.apache.cocoon.portal.profile.ProfileManager#login()
+ * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#login(org.apache.cocoon.portal.profile.PortalUser)
*/
- public void login() {
- super.login();
+ protected void login(PortalUser user) {
+ super.login(user);
// TODO - we should move most of the stuff from getPortalLayout to here
// for now we use a hack :)
this.getPortalLayout(null, null);
}
/**
- * @see org.apache.cocoon.portal.profile.ProfileManager#logout()
+ * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#logout(org.apache.cocoon.portal.profile.PortalUser)
*/
- public void logout() {
+ public void logout(PortalUser user) {
ServiceSelector adapterSelector = null;
try {
adapterSelector = (ServiceSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
@@ -88,7 +89,7 @@
} finally {
this.manager.release(adapterSelector);
}
- super.logout();
+ super.logout(user);
}
/**
Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/profile/impl/GroupBasedProfileManager.java Mon Oct 3 09:46:51 2005
@@ -208,19 +208,19 @@
}
/**
- * @see org.apache.cocoon.portal.profile.ProfileManager#login()
+ * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#login(org.apache.cocoon.portal.profile.PortalUser)
*/
- public void login() {
- super.login();
+ protected void login(PortalUser user) {
+ super.login(user);
// TODO - we should move most of the stuff from getPortalLayout to here
// for now we use a hack :)
this.getPortalLayout(null, null);
}
/**
- * @see org.apache.cocoon.portal.profile.ProfileManager#logout()
+ * @see org.apache.cocoon.portal.profile.impl.AbstractProfileManager#logout(org.apache.cocoon.portal.profile.PortalUser)
*/
- public void logout() {
+ protected void logout(PortalUser user) {
final UserProfile profile = this.getUserProfile(null);
if ( profile != null ) {
ServiceSelector adapterSelector = null;
@@ -246,7 +246,7 @@
}
this.removeUserProfiles();
}
- super.logout();
+ super.logout(user);
}
/**
Modified: cocoon/trunk/lib/optional/cowarp-0.5-dev-20051002.jar
URL: http://svn.apache.org/viewcvs/cocoon/trunk/lib/optional/cowarp-0.5-dev-20051002.jar?rev=293387&r1=293386&r2=293387&view=diff
==============================================================================
Binary files - no diff available.
|