KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > common > AbstractSupportSet


1 /*
2  * Copyright 2004,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.pluto.om.common;
17
18 import java.util.HashSet JavaDoc;
19 import java.util.Iterator JavaDoc;
20
21 /**
22  *
23  *
24  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
25  *
26  * @version CVS $Id: AbstractSupportSet.java 123407 2004-12-27 13:51:59Z cziegeler $
27  */

28 public abstract class AbstractSupportSet
29     extends HashSet JavaDoc
30     implements java.io.Serializable JavaDoc, Support {
31
32     public AbstractSupportSet() {
33         // nothing to do
34
}
35
36
37     // support implemenation.
38
public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc {
39         dispatch(parameter, POST_LOAD);
40     }
41
42     public void preBuild(Object JavaDoc parameter) throws Exception JavaDoc {
43         dispatch(parameter, PRE_BUILD);
44     }
45     
46     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
47         dispatch(parameter, POST_BUILD);
48     }
49
50     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
51         dispatch(parameter, PRE_STORE);
52     }
53
54     public void postStore(Object JavaDoc parameter) throws Exception JavaDoc {
55         dispatch(parameter, POST_STORE);
56     }
57
58     // additional methods.
59
protected void dispatch(Object JavaDoc parameter, int id) throws Exception JavaDoc {
60         Iterator JavaDoc iterator = this.iterator();
61         while (iterator.hasNext()) {
62             Support support = (Support)iterator.next();
63             switch (id) {
64                 case POST_LOAD : support.postLoad(parameter); break;
65                 case PRE_BUILD : support.preBuild(parameter); break;
66                 case POST_BUILD: support.postBuild(parameter); break;
67                 case PRE_STORE : support.preStore(parameter); break;
68                 case POST_STORE: support.postStore(parameter); break;
69             }
70         }
71     }
72 }
73
Popular Tags