*/
@Override
public AbstractServer deployServer(EjbContainer ejbContainer,
JavaClassGenerator javaGen)
throws ClassNotFoundException, ConfigException {
AbstractServer server;
if (Stateless.class.equals(getSessionType()))
server = new StatelessManager(ejbContainer, getAnnotatedType());
else if (Stateful.class.equals(getSessionType()))
server = new StatefulManager(ejbContainer, getAnnotatedType());
else if (Singleton.class.equals(getSessionType()))
server = new SingletonManager(ejbContainer, getAnnotatedType());
else
throw new IllegalStateException(String.valueOf(getSessionType()));
server.setModuleName(getEJBModuleName());
server.setEJBName(getEJBName());
server.setMappedName(getMappedName());
server.setId(getEJBModuleName() + "#" + getEJBName());
server.setContainerTransaction(_isContainerTransaction);
server.setEjbClass(loadClass(getEJBClass().getName()));
ArrayList<ApiClass> remoteList = _sessionBean.getRemoteApi();
if (remoteList.size() > 0) {
ArrayList<Class> classList = new ArrayList<Class>();
for (ApiClass apiClass : remoteList) {
classList.add(loadClass(apiClass.getName()));
}
server.setRemoteApiList(classList);
}
/*
* if (getRemote21() != null)
* server.setRemote21(loadClass(getRemote21().getName()));
*/
ArrayList<ApiClass> localList = _sessionBean.getLocalApi();
if (localList.size() > 0) {
ArrayList<Class> classList = new ArrayList<Class>();
for (ApiClass apiClass : localList) {
classList.add(loadClass(apiClass.getName()));
}
server.setLocalApiList(classList);
}
/*
* if (getLocal21() != null)
* server.setLocal21(loadClass(getLocal21().getName()));
*/
Class contextImplClass = javaGen.loadClass(getSkeletonName());
server.setContextImplClass(contextImplClass);
Class beanClass = javaGen.loadClass(getEJBClass().getName());
Class[] classes = contextImplClass.getDeclaredClasses();
for (Class aClass : classes) {
if (getEJBClass().isAssignableFrom(aClass)) {
server.setBeanImplClass(aClass);
break;
}
}
Thread thread = Thread.currentThread();
ClassLoader oldLoader = thread.getContextClassLoader();
try {
thread.setContextClassLoader(server.getClassLoader());
EjbProducer<?> producer = server.getProducer();
producer.setInjectionTarget(getInjectionTarget());
producer.setInitProgram(getInitProgram());