KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > service > ServiceManager


1 /*
2  * JBoss, the OpenSource EJB server
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.ejb3.service;
8
9 import javax.ejb.TimerService JavaDoc;
10 import javax.management.ObjectName JavaDoc;
11 import org.jboss.aop.AspectManager;
12 import org.jboss.ejb3.Container;
13 import org.jboss.ejb3.EjbLinkResolver;
14 import org.jboss.ejb3.Pool;
15 import org.jboss.ejb3.entity.ManagedEntityManagerFactory;
16 import org.jboss.ejb3.security.JaccHelper;
17 import org.jboss.system.ServiceMBeanSupport;
18
19 /**
20  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
21  * @version $Revision: 1.6.2.1 $
22  */

23 public class ServiceManager extends ServiceMBeanSupport implements ServiceManagerMBean, Container
24 {
25    private ServiceContainer container;
26    protected String JavaDoc jaccContextId;
27
28    public ServiceManager(ClassLoader JavaDoc cl, String JavaDoc beanClassName, String JavaDoc ejbName, AspectManager manager, String JavaDoc jaccContextId)
29    {
30       container = new ServiceContainer(cl, beanClassName, ejbName, manager);
31       this.jaccContextId = jaccContextId;
32    }
33
34    public Container getInstance()
35    {
36       return container;
37    }
38
39    public EjbLinkResolver getEjbLinkResolver()
40    {
41       return container.getEjbLinkResolver();
42    }
43
44    public void setEjbLinkResolver(EjbLinkResolver ejbLinkResolver)
45    {
46       container.setEjbLinkResolver(ejbLinkResolver);
47    }
48
49    public void createService() throws Exception JavaDoc
50    {
51       container.create();
52       JaccHelper.configureContainer(jaccContextId, container);
53    }
54
55    public ManagedEntityManagerFactory getManagedEntityManagerFactory()
56    {
57       return container.getManagedEntityManagerFactory();
58    }
59
60    public void setManagedEntityManagerFactory(ManagedEntityManagerFactory factory)
61    {
62       container.setManagedEntityManagerFactory(factory);
63    }
64
65    public void startService() throws Exception JavaDoc
66    {
67       container.start();
68    }
69
70    public void stopService() throws Exception JavaDoc
71    {
72       container.stop();
73    }
74
75    public void destroyService() throws Exception JavaDoc
76    {
77       container.destroy();
78    }
79    
80
81    public Class JavaDoc getBeanClass()
82    {
83       return container.getBeanClass();
84    }
85
86    public String JavaDoc getEjbName()
87    {
88       return container.getEjbName();
89    }
90
91    public ObjectName JavaDoc getObjectName()
92    {
93       return container.getObjectName();
94    }
95
96    public TimerService JavaDoc getTimerService()
97    {
98       return container.getTimerService();
99    }
100
101    public Pool getPool()
102    {
103       return container.getPool();
104    }
105
106    public Object JavaDoc construct()
107    {
108       return container.construct();
109    }
110
111    public void invokePostConstruct(Object JavaDoc bean)
112    {
113       container.invokePostConstruct(bean);
114    }
115
116    public void invokePreDestroy(Object JavaDoc bean)
117    {
118       container.invokePreDestroy(bean);
119    }
120
121    public void invokePostActivate(Object JavaDoc bean)
122    {
123       container.invokePostActivate(bean);
124    }
125
126    public void invokePrePassivate(Object JavaDoc bean)
127    {
128       container.invokePrePassivate(bean);
129    }
130    
131    public void invokeInit(Object JavaDoc bean)
132    {
133       container.invokeInit(bean);
134    }
135    
136    public void invokeInit(Object JavaDoc bean, Class JavaDoc[] initParameterTypes, Object JavaDoc[] initParameterValues)
137    {
138       container.invokeInit(bean, initParameterTypes, initParameterValues);
139    }
140 }
141
142
Popular Tags