KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > adwt > service > ConsoleServiceProvider


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.adwt.service;
8
9 import java.beans.beancontext.BeanContextServices JavaDoc;
10 import java.util.Iterator JavaDoc;
11 import java.util.Vector JavaDoc;
12
13 import org.apache.log4j.Logger;
14 import org.ejtools.adwt.action.Command;
15 import org.ejtools.adwt.action.view.ShowConsoleAction;
16 import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider;
17
18 /**
19  * Description of the Class
20  *
21  * @author Laurent Etiemble
22  * @version $Revision: 1.5 $
23  * @todo Javadoc to complete
24  * @todo I18N to complete
25  */

26 public class ConsoleServiceProvider extends CustomBeanContextServiceProvider
27 {
28    /** Description of the Field */
29    protected ConsoleService service = null;
30    /** Description of the Field */
31    private static Logger logger = Logger.getLogger(ConsoleServiceProvider.class);
32
33
34    /** Constructor for the AboutServiceProvider object */
35    public ConsoleServiceProvider()
36    {
37       super();
38    }
39
40
41    /**
42     * Gets the currentServiceSelectors attribute of the ApplicationServiceProvider object
43     *
44     * @param bcs Description of the Parameter
45     * @param serviceClass Description of the Parameter
46     * @return The currentServiceSelectors value
47     */

48    public Iterator JavaDoc getCurrentServiceSelectors(BeanContextServices JavaDoc bcs, Class JavaDoc serviceClass)
49    {
50       return (new Vector JavaDoc().iterator());
51    }
52
53
54    /**
55     * Gets the service attribute of the ApplicationServiceProvider object
56     *
57     * @param bcs Description of the Parameter
58     * @param requestor Description of the Parameter
59     * @param serviceClass Description of the Parameter
60     * @param serviceSelector Description of the Parameter
61     * @return The service value
62     */

63    public Object JavaDoc getService(BeanContextServices JavaDoc bcs, Object JavaDoc requestor, Class JavaDoc serviceClass, Object JavaDoc serviceSelector)
64    {
65       return this.service;
66    }
67
68
69    /**
70     * Returns the service.
71     *
72     * @return ConsoleService
73     */

74    public ConsoleService getService()
75    {
76       return service;
77    }
78
79
80    /**
81     * Description of the Method
82     *
83     * @param bcs Description of the Parameter
84     * @param requestor Description of the Parameter
85     * @param service Description of the Parameter
86     */

87    public void releaseService(BeanContextServices JavaDoc bcs, Object JavaDoc requestor, Object JavaDoc service) { }
88
89
90    /**
91     * @return The serviceClass value
92     */

93    protected Class JavaDoc[] getServiceClass()
94    {
95       return new Class JavaDoc[]{ConsoleService.class};
96    }
97
98
99    /** */
100    protected void initializeBeanContextResources()
101    {
102       super.initializeBeanContextResources();
103       this.service = new ConsoleServiceInternalFrame(this.getBeanContext());
104
105       this.add(new ShowConsoleAction(
106          new Command()
107          {
108             public void execute()
109             {
110                ConsoleServiceProvider.this.service.show();
111             }
112          }
113          ));
114
115       logger.debug("Console Service installed");
116    }
117 }
118
Popular Tags