KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > om > common > AbstractSupportSet


1 /*
2  * Copyright 2003,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 /*
17
18  */

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