/** * Process a "stop" event for this Host. */ private void stop() { if (debug > 0) log(rb.getString(LogFacade.PROCESSING_STOP_INFO)); }
/** * Process a "start" event for this Host. */ private void start() { if (debug > 0) log(rb.getString(LogFacade.PROCESSING_START_INFO)); deploy(); }
/** * Deploy a web application for any user who has a web application present * in a directory with a specified name within their home directory. */ private void deploy() { if (debug >= 1) log(rb.getString(LogFacade.DEPLOYING_USER_WEB_APP_INFO)); // Load the user database object for this host UserDatabase database = null; try { Class clazz = Class.forName(userClass); database = (UserDatabase) clazz.newInstance(); database.setUserConfig(this); } catch (Exception e) { log(rb.getString(LogFacade.LOADING_USER_DATABASE_EXCEPTION), e); return; } // Deploy the web application (if any) for each defined user Enumeration users = database.getUsers(); while (users.hasMoreElements()) { String user = (String) users.nextElement(); String home = database.getHome(user); deploy(user, home); } }
/** * Process the START event for an associated Host. * * @param event The lifecycle event that has occurred */ public void lifecycleEvent(LifecycleEvent event) { // Identify the host we are associated with try { host = (Host) event.getLifecycle(); } catch (ClassCastException e) { String msg = MessageFormat.format(rb.getString(LogFacade.LIFECYCLE_OBJECT_NOT_HOST_EXCEPTION), event.getLifecycle()); log(msg, e); return; } // Process the event that has occurred if (event.getType().equals(Lifecycle.START_EVENT)) start(); else if (event.getType().equals(Lifecycle.STOP_EVENT)) stop(); }