/** * 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; }
/** * 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; }
/** * 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 ref : engines) { sniffers.add(ref.getContainerInfo().getSniffer()); } for (ModuleInfo module : modules) { sniffers.addAll(module.getSniffers()); } return sniffers; }
public void clean(ExtendedDeploymentContext context) { try { getContainerInfo().clean(context); } catch (Exception e) { context.getLogger().log(Level.WARNING, "Exception while cleaning module '" + this + "'" + e, e); } }
/** * 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 ref : engines) { sniffers.add(ref.getContainerInfo().getSniffer()); } for (ModuleInfo module : modules) { sniffers.addAll(module.getSniffers()); } return sniffers; }
public void clean(ExtendedDeploymentContext context) { try { getContainerInfo().clean(context); } catch (Exception e) { context.getLogger().log(Level.WARNING, "Exception while cleaning module '" + this + "'" + e, e); } }
public <T extends Container> EngineRef getEngineRefForContainer(Class<T> type) { for (EngineRef engine : _getEngineRefs()) { T container = null; try { container = type.cast(engine.getContainerInfo().getContainer()); } catch (Exception e) { // ignore, wrong container } if (container!=null) { return engine; } } return null; }
public <T extends Container> EngineRef getEngineRefForContainer(Class<T> type) { for (EngineRef engine : _getEngineRefs()) { T container = null; try { container = type.cast(engine.getContainerInfo().getContainer()); } catch (Exception e) { // ignore, wrong container } if (container!=null) { return engine; } } return null; }
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) { getContainerInfo().load(context); tracker.add("loaded", EngineRef.class, this); }
public void load(ExtendedDeploymentContext context, ProgressTracker tracker) { getContainerInfo().load(context); tracker.add("loaded", EngineRef.class, this); }
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 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); } }
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; }
/** * Saves its state to the configuration. this method must be called within a transaction * to the configured engine instance. * * @param engine the engine configuration being persisted */ public void save(Engine engine) throws TransactionFailure, PropertyVetoException { engine.setSniffer(getContainerInfo().getSniffer().getModuleType()); if (appConfig != null) { engine.setApplicationConfig(appConfig); } }
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 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; }
/** * Saves its state to the configuration. this method must be called within a transaction * to the configured engine instance. * * @param engine the engine configuration being persisted */ public void save(Engine engine) throws TransactionFailure, PropertyVetoException { engine.setSniffer(getContainerInfo().getSniffer().getModuleType()); if (appConfig != null) { engine.setApplicationConfig(appConfig); } }
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); } }
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); } }