kernel = KernelFactory.newInstance().createKernel("test.kernel");
kernel.boot();
//ServerInfo
serverInfoName = new ObjectName("geronimo.system:role=ServerInfo");
serverInfoGBean = new GBeanData(serverInfoName, BasicServerInfo.GBEAN_INFO);
serverInfoGBean.setAttribute("baseDirectory", ".");
start(serverInfoGBean);
//Default Realm
Map initParams = new HashMap();
if (realmClass != null){
initParams.put("userClassNames","org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
initParams.put("roleClassNames","org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
realm = new GBeanData(realmName, RealmGBean.GBEAN_INFO);
realm.setAttribute("className", realmClass);
realm.setAttribute("initParams", initParams);
start(realm);
}
//Default Host
initParams.clear();
initParams.put("workDir","work");
initParams.put("name","localhost");
initParams.put("appBase","");
host = new GBeanData(hostName, HostGBean.GBEAN_INFO);
host.setAttribute("className", "org.apache.catalina.core.StandardHost");
host.setAttribute("initParams", initParams);
start(host);
//Default Engine
initParams.clear();
initParams.put("name","Geronimo");
initParams.put("defaultHost","localhost");
engine = new GBeanData(engineName, EngineGBean.GBEAN_INFO);
engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
engine.setAttribute("initParams", initParams);
if (realmClass != null)
engine.setReferencePattern("RealmGBean", realmName);
engine.setReferencePattern("Hosts", hostName);
start(engine);
// Need to override the constructor for unit tests
container = new GBeanData(containerName, TomcatContainer.GBEAN_INFO);
container.setAttribute("classLoader", cl);
container.setAttribute("catalinaHome", "target/var/catalina");
container.setReferencePattern("EngineGBean", engineName);
container.setReferencePattern("ServerInfo", serverInfoName);
connector = new GBeanData(connectorName, ConnectorGBean.GBEAN_INFO);
connector.setAttribute("port", new Integer(8080));
connector.setAttribute("host", "localhost");
connector.setAttribute("name", "HTTP");
connector.setReferencePattern("TomcatContainer", containerName);
start(container);
start(connector);
tm = new GBeanData(tmName, TransactionManagerImplGBean.GBEAN_INFO);
Set patterns = new HashSet();
patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
tm.setReferencePatterns("ResourceManagers", patterns);
start(tm);
tcm = new GBeanData(tcmName, TransactionContextManagerGBean.GBEAN_INFO);
tcm.setReferencePattern("TransactionManager", tmName);
start(tcm);
ctc = new GBeanData(ctcName, ConnectionTrackingCoordinatorGBean.GBEAN_INFO);
start(ctc);
}