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/12/10 16:31:41 UTC
cvs commit: cocoon-2.1/src/blocks/portal/conf actions.xmap
cziegeler 2003/12/10 07:31:41
Modified: src/blocks/portal/conf actions.xmap
Added: src/blocks/portal/java/org/apache/cocoon/portal/acting
SaveAction.java
Log:
New Action for saving the profile
Revision Changes Path
1.1 cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/acting/SaveAction.java
Index: SaveAction.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.portal.acting;
import java.util.Map;
import org.apache.avalon.framework.parameters.ParameterException;
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: SaveAction.java,v 1.1 2003/12/10 15:31:41 cziegeler Exp $
*/
public final class SaveAction
extends ServiceableAction
implements ThreadSafe {
public Map act(Redirector redirector,
SourceResolver resolver,
Map objectModel,
String source,
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.setPortalName(par.getParameter("portal-name"));
service.getComponentManager().getProfileManager().saveUserProfiles();
} catch (ParameterException pe) {
throw new ProcessingException("Parameter portal-name is required.");
} 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={}");
}
return EMPTY_MAP;
}
}
1.4 +2 -0 cocoon-2.1/src/blocks/portal/conf/actions.xmap
Index: actions.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/conf/actions.xmap,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- actions.xmap 9 Dec 2003 10:21:56 -0000 1.3
+++ actions.xmap 10 Dec 2003 15:31:41 -0000 1.4
@@ -11,4 +11,6 @@
src="org.apache.cocoon.portal.acting.ObjectModelAction"/>
<map:action name="portal-set-data"
src="org.apache.cocoon.portal.acting.CopletSetDataAction"/>
+ <map:action name="portal-save-profile"
+ src="org.apache.cocoon.portal.acting.SaveAction"/>
</xmap>