KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > impl > AbstractContainer


1 /*
2  * Copyright 2005 Joe Walker
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.directwebremoting.impl;
17
18 import java.util.Collection JavaDoc;
19 import java.util.Iterator JavaDoc;
20
21 import org.directwebremoting.Container;
22 import org.directwebremoting.extend.InitializingBean;
23
24 /**
25  * An implementation of some of the simpler methods from {@link Container}
26  * @author Joe Walker [joe at getahead dot ltd dot uk]
27  */

28 public abstract class AbstractContainer implements Container
29 {
30     /**
31      * Used after setup to call {@link InitializingBean#afterContainerSetup(Container)}
32      * on all the contained beans.
33      */

34     protected void callInitializingBeans()
35     {
36         Collection JavaDoc beanNames = getBeanNames();
37         for (Iterator JavaDoc it = beanNames.iterator(); it.hasNext();)
38         {
39             String JavaDoc name = (String JavaDoc) it.next();
40             Object JavaDoc bean = getBean(name);
41
42             if (bean instanceof InitializingBean)
43             {
44                 InitializingBean startMeUp = (InitializingBean) bean;
45                 startMeUp.afterContainerSetup(this);
46             }
47         }
48     }
49 }
50
Popular Tags