1 17 package org.apache.forrest.eclipse.job; 18 19 import org.apache.forrest.eclipse.ForrestPlugin; 20 import org.apache.log4j.Logger; 21 import org.eclipse.core.runtime.IProgressMonitor; 22 import org.eclipse.core.runtime.IStatus; 23 import org.eclipse.core.runtime.Status; 24 import org.eclipse.debug.core.DebugException; 25 26 27 30 public class ForrestStopper extends ForrestJob { 31 34 protected static final Logger logger = Logger.getLogger(ForrestStopper.class); 35 36 private static final int EXCEPTION_UNABLE_TO_STOP = 3010; 37 38 42 protected ForrestStopper(String workingDir) { 43 super("Forrest Runner"); 44 45 this.workingDir = workingDir; 46 } 47 48 51 public IStatus run(IProgressMonitor monitor) { 52 if (logger.isDebugEnabled()) { 53 logger.debug("run(IProgressMonitor) - start"); 54 } 55 56 IStatus status = null; 57 58 try { 59 ForrestManager.stopServer(workingDir); 60 logger.info("run() - Forrest server stopped"); 61 status = Status.OK_STATUS; 62 } catch (DebugException e) { 63 logger.error("run(IProgressMonitor)", e); 64 status = new Status(Status.ERROR, ForrestPlugin.ID, ForrestStopper.EXCEPTION_UNABLE_TO_STOP, "Unable to stop Forrest Server", e); 65 } 66 67 if (logger.isDebugEnabled()) { 68 logger.debug("run(IProgressMonitor) - end"); 69 } 70 return status; 71 } 72 73 } | Popular Tags |