/** * Acknowledge the occurrence of the specified event. * * @param event LifecycleEvent that has occurred */ @Override public void lifecycleEvent(LifecycleEvent event) { if(event.getType().equals(Lifecycle.BEFORE_INIT_EVENT)) { // register our custom context implementation host = (StandardHost)event.getLifecycle(); for(LifecycleListener listener : host.findLifecycleListeners()) { if(listener instanceof HostConfig) { ((HostConfig)listener).setContextClass(MarmottaContext.class.getCanonicalName()); } } } else if(event.getType().equals(Lifecycle.BEFORE_START_EVENT)) { if(event.getLifecycle() instanceof Host) { // register a container listener to indicate when a component has started log.info("starting host instance"); host = (StandardHost)event.getLifecycle(); host.addContainerListener(this); File file = new File(System.getProperty("catalina.base"),host.getAppBase()); max_progress = (file.list() != null ? file.list().length : 0); } } }
/** * Process the START event for an associated Host. * * @param event The lifecycle event that has occurred */ @Override public void lifecycleEvent(LifecycleEvent event) { // Identify the host we are associated with try { host = (Host) event.getLifecycle(); if (host instanceof StandardHost) { setCopyXML(((StandardHost) host).isCopyXML()); setDeployXML(((StandardHost) host).isDeployXML()); setUnpackWARs(((StandardHost) host).isUnpackWARs()); setContextClass(((StandardHost) host).getContextClass()); } } catch (ClassCastException e) { log.error(sm.getString("hostConfig.cce", event.getLifecycle()), e); return; } // Process the event that has occurred if (event.getType().equals(Lifecycle.PERIODIC_EVENT)) { check(); } else if (event.getType().equals(Lifecycle.START_EVENT)) { start(); } else if (event.getType().equals(Lifecycle.STOP_EVENT)) { stop(); } }
setDeployXML(((StandardHost) host).isDeployXML()); setUnpackWARs(((StandardHost) host).isUnpackWARs()); setContextClass(((StandardHost) host).getContextClass());
setDeployXML(((StandardHost) host).isDeployXML()); setUnpackWARs(((StandardHost) host).isUnpackWARs()); setContextClass(((StandardHost) host).getContextClass());