public Set<EngineRef> getEngineRefs() { Set<EngineRef> copy = new LinkedHashSet<EngineRef>(); copy.addAll(_getEngineRefs()); return copy; }
public Set<EngineRef> getEngineRefs() { Set<EngineRef> copy = new LinkedHashSet<EngineRef>(); copy.addAll(_getEngineRefs()); return copy; }
/** * 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; }
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 clean(ExtendedDeploymentContext context) throws Exception { for (EngineRef ref : _getEngineRefs()) { ref.clean(context); } if (events!=null) { events.send(new Event<DeploymentContext>(Deployment.MODULE_CLEANED,context), false); } }
/** * 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); } } }
/** * 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 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; }
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; }
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); } }
Thread.currentThread().setContextClassLoader(context.getClassLoader()); for (EngineRef engine : _getEngineRefs()) { if (logger.isLoggable(Level.FINE)) { logger.fine("starting " + engine.getContainerInfo().getSniffer().getModuleType());
Thread.currentThread().setContextClassLoader(context.getClassLoader()); for (EngineRef engine : _getEngineRefs()) { if (logger.isLoggable(Level.FINE)) { logger.fine("starting " + engine.getContainerInfo().getSniffer().getModuleType());
try { Thread.currentThread().setContextClassLoader(context.getClassLoader()); for (EngineRef engine : _getEngineRefs()) {
try { Thread.currentThread().setContextClassLoader(context.getClassLoader()); for (EngineRef engine : _getEngineRefs()) {