/** * Returns the list of sniffers that participated in loaded this * application * * @return array of sniffer that loaded the application's module */ public Collection<Sniffer> getSniffers() { List<Sniffer> sniffers = new ArrayList<Sniffer>(); for (EngineRef engine : _getEngineRefs()) { sniffers.add(engine.getContainerInfo().getSniffer()); } return sniffers; }
public void clean(ExtendedDeploymentContext context) throws Exception { for (EngineRef ref : reversedEngines) { ref.clean(context); } if (events!=null) { events.send(new Event<DeploymentContext>(Deployment.MODULE_CLEANED,context), false); } }
public synchronized void stop(ExtendedDeploymentContext context, Logger logger) { if (!started) return; ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef module : reversedEngines) { try { context.setClassLoader(moduleClassLoader); module.stop(context); } catch(Exception e) { logger.log(Level.SEVERE, "Cannot stop module " + module.getContainerInfo().getSniffer().getModuleType(),e ); } } started=false; if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_STOPPED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } }
public boolean suspend(Logger logger) { boolean isSuccess = true; for (EngineRef engine : reversedEngines) { try { engine.getApplicationContainer().suspend(); } catch(Exception e) { isSuccess = false; logger.log(Level.SEVERE, "Error suspending module " + engine.getContainerInfo().getSniffer().getModuleType(),e ); } } return isSuccess; }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef engine : reversedEngines) { if (engine.getApplicationContainer()!=null && engine.getApplicationContainer().getClassLoader()!=null) { classLoaders.add(engine.getApplicationContainer().getClassLoader()); try { context.setClassLoader(moduleClassLoader); engine.unload(context); } catch(Throwable e) { logger.log(Level.SEVERE, "Failed to unload from container type : " + engine.getContainerInfo().getSniffer().getModuleType(), e); } } } // add the module classloader to the predestroy list if it's not // already there if (classLoaders != null && moduleClassLoader != null) { classLoaders.add(moduleClassLoader); } if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_UNLOADED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); context.setClassLoader(null); } }
logger.fine("starting " + engine.getContainerInfo().getSniffer().getModuleType()); engine.getContainerInfo().getSniffer().getModuleType()); if (!engine.start( context, tracker)) { logger.log(Level.SEVERE, "Module not started " + engine.getApplicationContainer().toString()); throw new Exception( "Module not started " + engine.getApplicationContainer().toString()); logger.log(Level.SEVERE, "Exception while invoking " + engine.getApplicationContainer().getClass() + " start method", e); throw e; engine.getContainerInfo().getSniffer().getModuleType());
for (EngineRef engine : _getEngineRefs()) { final EngineInfo engineInfo = engine.getContainerInfo(); continue; engine.load(context, tracker); engine.setApplicationContainer(appCtr); filteredEngines.add(engine); filteredReversedEngines.addFirst(engine);
EngineRef engineRef = new EngineRef(engineInfo, null); addedEngines.add(engineRef); tracker.add("prepared", EngineRef.class, engineRef); for (EngineRef er : mi.getEngineRefs()) { ApplicationConfig c = savedAppConfig.get(mi.getName(), er.getContainerInfo().getSniffer().getModuleType()); if (c != null) { er.setApplicationConfig(c);
/** * Saves its state to the configuration. this method must be called within a transaction * to the configured module instance. * * @param module the module being persisted */ public void save(Module module) throws TransactionFailure, PropertyVetoException { // write out the module properties only for composite app if (Boolean.valueOf(moduleProps.getProperty( ServerTags.IS_COMPOSITE))) { moduleProps.remove(ServerTags.IS_COMPOSITE); for (Iterator itr = moduleProps.keySet().iterator(); itr.hasNext();) { String propName = (String) itr.next(); Property prop = module.createChild(Property.class); module.getProperty().add(prop); prop.setName(propName); prop.setValue(moduleProps.getProperty(propName)); } } for (EngineRef ref : _getEngineRefs()) { Engine engine = module.createChild(Engine.class); module.getEngines().add(engine); ref.save(engine); } } }
public void unload(ExtendedDeploymentContext context) { Logger logger = context.getLogger(); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef engine : _getEngineRefs()) { if (engine.getApplicationContainer()!=null && engine.getApplicationContainer().getClassLoader()!=null) { classLoaders.add(engine.getApplicationContainer().getClassLoader()); try { context.setClassLoader(moduleClassLoader); engine.unload(context); } catch(Throwable e) { logger.log(Level.SEVERE, "Failed to unload from container type : " + engine.getContainerInfo().getSniffer().getModuleType(), e); } } } // add the module classloader to the predestroy list if it's not // already there if (classLoaders != null && moduleClassLoader != null) { classLoaders.add(moduleClassLoader); } if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_UNLOADED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); context.setClassLoader(null); } }
public boolean resume(Logger logger) { boolean isSuccess = true; for (EngineRef module : _getEngineRefs()) { try { module.getApplicationContainer().resume(); } catch(Exception e) { isSuccess = false; logger.log(Level.SEVERE, "Error resuming module " + module.getContainerInfo().getSniffer().getModuleType(),e ); } } return isSuccess; }
logger.fine("starting " + engine.getContainerInfo().getSniffer().getModuleType()); engine.getContainerInfo().getSniffer().getModuleType()); if (!engine.start( context, tracker)) { logger.log(Level.SEVERE, "Module not started " + engine.getApplicationContainer().toString()); throw new Exception( "Module not started " + engine.getApplicationContainer().toString()); logger.log(Level.SEVERE, "Exception while invoking " + engine.getApplicationContainer().getClass() + " start method", e); throw e; engine.getContainerInfo().getSniffer().getModuleType());
for (EngineRef engine : _getEngineRefs()) { final EngineInfo engineInfo = engine.getContainerInfo(); continue; engine.load(context, tracker); engine.setApplicationContainer(appCtr); filteredEngines.add(engine); } catch(Exception e) {
EngineRef engineRef = new EngineRef(engineInfo, null); addedEngines.add(engineRef); tracker.add("prepared", EngineRef.class, engineRef); for (EngineRef er : mi.getEngineRefs()) { ApplicationConfig c = savedAppConfig.get(mi.getName(), er.getContainerInfo().getSniffer().getModuleType()); if (c != null) { er.setApplicationConfig(c);
/** * Saves its state to the configuration. this method must be called within a transaction * to the configured module instance. * * @param module the module being persisted */ public void save(Module module) throws TransactionFailure, PropertyVetoException { // write out the module properties only for composite app if (Boolean.valueOf(moduleProps.getProperty( ServerTags.IS_COMPOSITE))) { moduleProps.remove(ServerTags.IS_COMPOSITE); for (Iterator itr = moduleProps.keySet().iterator(); itr.hasNext();) { String propName = (String) itr.next(); Property prop = module.createChild(Property.class); module.getProperty().add(prop); prop.setName(propName); prop.setValue(moduleProps.getProperty(propName)); } } for (EngineRef ref : _getEngineRefs()) { Engine engine = module.createChild(Engine.class); module.getEngines().add(engine); ref.save(engine); } } }
/** * Returns the list of sniffers that participated in loaded this * application * * @return array of sniffer that loaded the application's module */ public Collection<Sniffer> getSniffers() { List<Sniffer> sniffers = new ArrayList<Sniffer>(); for (EngineRef engine : _getEngineRefs()) { sniffers.add(engine.getContainerInfo().getSniffer()); } return sniffers; }
public boolean suspend(Logger logger) { boolean isSuccess = true; for (EngineRef engine : _getEngineRefs()) { try { engine.getApplicationContainer().suspend(); } catch(Exception e) { isSuccess = false; logger.log(Level.SEVERE, "Error suspending module " + engine.getContainerInfo().getSniffer().getModuleType(),e ); } } return isSuccess; }
public synchronized void stop(ExtendedDeploymentContext context, Logger logger) { if (!started) return; ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(moduleClassLoader); for (EngineRef module : _getEngineRefs()) { try { context.setClassLoader(moduleClassLoader); module.stop(context); } catch(Exception e) { logger.log(Level.SEVERE, "Cannot stop module " + module.getContainerInfo().getSniffer().getModuleType(),e ); } } started=false; if (events!=null) { events.send(new Event<ModuleInfo>(Deployment.MODULE_STOPPED, this), false); } } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } }