public void stop ( AbstractWisdomMojo mojo ) throws MojoExecutionException { File script = new File ( mojo . getWisdomRootDirectory ( ) , "chameleon.sh" ) ; if ( ! script . isFile ( ) ) { throw new MojoExecutionException ( "The 'chameleon.sh' file does not exist in " + mojo . getWisdomRootDirectory ( ) . getAbsolutePath ( ) + " - cannot stop the Wisdom instance" ) ; } // If there is a RUNNING_PID file, exit immediately. File pid = new File ( mojo . getWisdomRootDirectory ( ) , "RUNNING_PID" ) ; if ( ! pid . isFile ( ) ) { mojo . getLog ( ) . info ( "The RUNNING_PID file does not exist, are you sure Wisdom is running ?" ) ; return ; } CommandLine cmdLine = new CommandLine ( script ) ; cmdLine . addArgument ( "stop" ) ; try { mojo . getLog ( ) . info ( "Stopping Wisdom Server using '" + cmdLine . toString ( ) + "'." ) ; // As we know which command line we are executing, we can safely execute the command. Runtime . getRuntime ( ) . exec ( cmdLine . toStrings ( ) , null , mojo . getWisdomRootDirectory ( ) ) ; //NOSONAR } catch ( IOException e ) { throw new MojoExecutionException ( "Cannot stop Wisdom" , e ) ; } }
Stops a running instance of wisdom using chameleon stop .