@Override public void addLifecycleListener(final LifecycleListener listener) { if (delegate instanceof Lifecycle) { ((Lifecycle) delegate).addLifecycleListener(listener); } }
/** * Handle the beginning of an XML element. * * @param attributes The attributes of this element * * @exception Exception if a processing error occurs */ public void begin(String namespace, String name, Attributes attributes) throws Exception { // Instantiate a new LifecyleListener implementation object String className = listenerClass; if (attributeName != null) { String value = attributes.getValue(attributeName); if (value != null) className = value; } Class clazz = Class.forName(className); LifecycleListener listener = (LifecycleListener) clazz.newInstance(); // Add this LifecycleListener to our associated component Lifecycle lifecycle = (Lifecycle) digester.peek(); lifecycle.addLifecycleListener(listener); }
/** * Handle the beginning of an XML element. * * @param attributes The attributes of this element * * @exception Exception if a processing error occurs */ public void begin(Attributes attributes) throws Exception { // Instantiate a new LifecyleListener implementation object String className = listenerClass; if (attributeName != null) { String value = attributes.getValue(attributeName); if (value != null) className = value; } Class clazz = Class.forName(className); LifecycleListener listener = (LifecycleListener) clazz.newInstance(); // Add this LifecycleListener to our associated component Lifecycle lifecycle = (Lifecycle) digester.peek(); lifecycle.addLifecycleListener(listener); }
/** * Associate lifecycle listeners with the instance, if it implements Lifecycle. */ protected static void addLifecycleListeners(Object instance, List<ListenerMetaData> list) throws Exception { if (list == null) { return; } org.apache.catalina.Lifecycle lifecycle = null; if (!(instance instanceof org.apache.catalina.Lifecycle)) { return; } else { lifecycle = (org.apache.catalina.Lifecycle) instance; } Iterator<ListenerMetaData> listenerMetaDatas = list.iterator(); while (listenerMetaDatas.hasNext()) { ListenerMetaData listenerMetaData = listenerMetaDatas.next(); lifecycle.addLifecycleListener((org.apache.catalina.LifecycleListener) getInstance(listenerMetaData, null)); } }
public Context createEJBWebServiceContext(String contextPath, WebServiceContainer webServiceContainer, String securityRealmName, String realmName, String transportGuarantee, String authMethod, ClassLoader classLoader) { if( log.isDebugEnabled() ) log.debug("Creating EJBWebService context '" + contextPath + "'."); TomcatEJBWebServiceContext context = new TomcatEJBWebServiceContext(contextPath, webServiceContainer, securityRealmName, realmName, transportGuarantee, authMethod, classLoader); ContextConfig config = new ContextConfig(); config.setCustomAuthenticators(authenticators); ((Lifecycle) context).addLifecycleListener(config); return (context); }
LifecycleListener listener = (LifecycleListener) clazz.newInstance(); ((Lifecycle) context).addLifecycleListener(listener);
public void start() throws JMException { Server server = this.findServer(); if (server != null) { if (!(server instanceof Lifecycle)) throw new IllegalStateException(); Lifecycle lifecycle = (Lifecycle) server; if (!this.containsListener(lifecycle)) { lifecycle.addLifecycleListener(this); } if (this.init.compareAndSet(false, true)) { this.init(server); } if (this.start.compareAndSet(false, true)) { this.eventHandler.start(new CatalinaServer(server, this.mbeanServer)); } } }
private void addListeners(Server server) { // Register ourself as a listener for child services for (Service service: server.findServices()) { Container engine = service.getContainer(); engine.addContainerListener(this); ((Lifecycle) engine).addLifecycleListener(this); for (Container host: engine.findChildren()) { host.addContainerListener(this); for (Container context: host.findChildren()) { ((Lifecycle) context).addLifecycleListener(this); } } } }
LifecycleListener listener = (LifecycleListener) clazz.newInstance(); ((Lifecycle) context).addLifecycleListener(listener);
/** * Prepare for the beginning of active use of the public methods of this * component. This method should be called after <code>configure()</code>, * and before any of the public methods of the component are utilized. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ public void start() throws LifecycleException { // Validate and update our current component state if (started) throw new LifecycleException (MESSAGES.valveAlreadyStarted()); lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; if (container instanceof Context) { ((Lifecycle) container).addLifecycleListener(this); } }
/** * Prepare for the beginning of active use of the public methods of this * component. This method should be called after <code>configure()</code>, * and before any of the public methods of the component are utilized. * * @exception LifecycleException if this component detects a fatal error * that prevents this component from being used */ public void start() throws LifecycleException { // Validate and update our current component state if (started) throw new LifecycleException (sm.getString("semaphoreValve.alreadyStarted")); lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; if (container instanceof Context) { ((Lifecycle) container).addLifecycleListener(this); } }
public Context createContext(String path, String docBase, ClassLoader cl) { if( log.isDebugEnabled() ) log.debug("Creating context '" + path + "' with docBase '" + docBase + "'"); GeronimoStandardContext context = new GeronimoStandardContext(); context.setDocBase(docBase); context.setPath(path); if (cl != null) context.setParentClassLoader(cl); ContextConfig config = new ContextConfig(); config.setCustomAuthenticators(authenticators); ((Lifecycle) context).addLifecycleListener(config); context.setDelegate(true); return (context); }
((Lifecycle) context).addLifecycleListener(config);
for (ListenerType listenerType: getListener()) { LifecycleListener listener = listenerType.getLifecycleListener(cl); lifecycle.addLifecycleListener(listener);
((Lifecycle) context).addLifecycleListener(config);
for (ListenerType listenerType: getListener()) { LifecycleListener listener = listenerType.getLifecycleListener(cl); lifecycle.addLifecycleListener(listener);
@Override public Context createContext(String path, String docBase) { if( log.isDebugEnabled() ) log.debug("Creating context '" + path + "' with docBase '" + docBase + "'"); context = new StandardContext(); context.setDocBase(docBase); context.setPath(path); ContextConfig config = new ContextConfig(); config.setCustomAuthenticators(authenticators); ((Lifecycle) context).addLifecycleListener(config); return (context); }
((Lifecycle) context).addLifecycleListener(this); if (context.isStarted()) { addContext(context);
((Lifecycle) context).addLifecycleListener(this); if (context.isStarted()) { addContext(context);
Engine engine = (Engine) service.getContainer(); engine.addContainerListener(this); ((Lifecycle) engine).addLifecycleListener(this); if (engine.getDefaultHost() != null) { mapper.setDefaultHostName(engine.getDefaultHost()); mapper.addHost(host.getName(), ((Host) host).findAliases(), host); for (Container context : host.findChildren()) { ((Lifecycle) context).addLifecycleListener(this);