KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > acting > LogoutAction


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.acting;
17
18 import java.util.Map JavaDoc;
19
20 import org.apache.avalon.framework.parameters.Parameters;
21 import org.apache.avalon.framework.service.ServiceException;
22 import org.apache.avalon.framework.thread.ThreadSafe;
23 import org.apache.cocoon.ProcessingException;
24 import org.apache.cocoon.acting.ServiceableAction;
25 import org.apache.cocoon.environment.Redirector;
26 import org.apache.cocoon.environment.SourceResolver;
27 import org.apache.cocoon.portal.PortalService;
28
29 /**
30  * This action logs the current user out of the portal
31  *
32  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
33  * @version CVS $Id: LogoutAction.java 124479 2005-01-07 11:01:03Z cziegeler $
34 */

35 public final class LogoutAction
36 extends ServiceableAction
37 implements ThreadSafe {
38
39     /* (non-Javadoc)
40      * @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)
41      */

42     public Map JavaDoc act(Redirector redirector,
43                    SourceResolver resolver,
44                    Map JavaDoc objectModel,
45                    String JavaDoc source,
46                    Parameters par)
47     throws Exception JavaDoc {
48         if (this.getLogger().isDebugEnabled() ) {
49             this.getLogger().debug("BEGIN act resolver="+resolver+
50                                    ", objectModel="+objectModel+
51                                    ", source="+source+
52                                    ", par="+par);
53         }
54
55         PortalService service = null;
56         try {
57             service = (PortalService)this.manager.lookup(PortalService.ROLE);
58             service.getComponentManager().getProfileManager().logout();
59         } catch (ServiceException ce) {
60             throw new ProcessingException("Unable to lookup portal service.", ce);
61         } finally {
62             this.manager.release(service);
63         }
64
65         if (this.getLogger().isDebugEnabled() ) {
66             this.getLogger().debug("END act map={}");
67         }
68
69         return EMPTY_MAP;
70     }
71
72 }
73
Popular Tags