KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > forms > acting > AbstractFormsAction


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.forms.acting;
17
18 import org.apache.cocoon.acting.Action;
19 import org.apache.cocoon.forms.FormManager;
20 import org.apache.avalon.framework.activity.Disposable;
21 import org.apache.avalon.framework.thread.ThreadSafe;
22 import org.apache.avalon.framework.service.Serviceable;
23 import org.apache.avalon.framework.service.ServiceManager;
24 import org.apache.avalon.framework.service.ServiceException;
25
26 /**
27  * Abstract base class for Cocoon Forms actions.
28  *
29  * @version $Id: AbstractFormsAction.java 56582 2004-11-04 10:16:22Z sylvain $
30  */

31 public abstract class AbstractFormsAction
32   implements Action, ThreadSafe, Serviceable, Disposable {
33       
34     protected ServiceManager manager;
35     
36     protected FormManager formManager;
37
38     public void service(ServiceManager serviceManager) throws ServiceException {
39         this.manager = serviceManager;
40         this.formManager = (FormManager)serviceManager.lookup(FormManager.ROLE);
41     }
42
43     public void dispose() {
44         if (this.manager != null) {
45             this.manager.release( this.formManager );
46             this.manager = null;
47             this.formManager = null;
48         }
49     }
50 }
51
Popular Tags