All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.javadoc.org.spincast.plugins.processutils.SpincastProcessUtilsDefault.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






SpincastProcessUtilsDefault (org.spincast:spincast-framework 1.14.0 API)












org.spincast.plugins.processutils

Class SpincastProcessUtilsDefault

  • java.lang.Object
    • org.spincast.plugins.processutils.SpincastProcessUtilsDefault
    • Field Detail

      • logger

        protected static final org.slf4j.Logger logger
    • Method Detail

      • executeGoalOnExternalMavenProject

        public File executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo,
                                                      MavenProjectGoal mavenGoal)
        Description copied from interface: SpincastProcessUtils
        Execute the specified goal on an external Maven project.

        If the project is located on the classpath, it first copies it to the file system (in a temp folder).

        Specified by:
        executeGoalOnExternalMavenProject in interface SpincastProcessUtils
        Returns:
        the root directory of the project. This will be the same as the specified path if on the file system, or will be the created temp directory where the project has been copied (from the classpath) otherwise.
      • executeGoalOnExternalMavenProject

        public File executeGoalOnExternalMavenProject(ResourceInfo projectRootInfo,
                                                      MavenProjectGoal mavenGoal,
                                                      Map<String,Object> pomParams)
        Description copied from interface: SpincastProcessUtils
        Execute the specified goal on an external Maven project.

        If the project is located on the classpath, it first copies it to the file system (in a temp folder).

        Specified by:
        executeGoalOnExternalMavenProject in interface SpincastProcessUtils
        pomParams - Before executing the goal, those parameters are used to replace placeholders in the project's pom.xml using Spincast's TemplatingEngine.
        Returns:
        the root directory of the project. This will be the same as the specified path if on the file system, or will be the created temp directory where the project has been copied (from the classpath) otherwise.
      • executeAsync

        public void executeAsync(ProcessExecutionHandler handler,
                                 String... cmdArgs)
        Description copied from interface: SpincastProcessUtils
        Execute an external program asynchronously.

        The method will only return when the process is actually created or if an exception occured when trying to do so.

        If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:

         ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
         {
             // override some methods...
         };
         getSpincastProcessUtils().executeAsync(handler,
                                                "java",
                                                "-jar",
                                                jarFile.getAbsolutePath());
         try {
             //...
         } finally {
             handler.killProcess();
         }
         
        Specified by:
        executeAsync in interface SpincastProcessUtils
        Parameters:
        handler - to get information from the created process and to be able to kill it.
      • executeAsync

        public void executeAsync(ProcessExecutionHandler handler,
                                 long timeoutAmount,
                                 TimeUnit timeoutUnit,
                                 String... cmdArgs)
        Description copied from interface: SpincastProcessUtils
        Execute an external program asynchronously.

        The method will only return when the process is actually created or if an exception occured when trying to do so.

        If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:

         ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
         {
             // override some methods...
         };();
         getSpincastProcessUtils().executeAsync(handler,
                                                "java",
                                                "-jar",
                                                jarFile.getAbsolutePath());
         try {
             //...
         } finally {
             handler.killProcess();
         }
         
        Specified by:
        executeAsync in interface SpincastProcessUtils
        Parameters:
        handler - to get information from the created process and to be able to kill it.
        timeoutAmount - the amount of time the external program is allowed to run before a timeout occurs. When the timeout occurs: Note that onExit() will not be called if a timeout occurs!
        timeoutUnit - the timeout unit.
      • executeAsync

        public void executeAsync(ProcessExecutionHandler handler,
                                 List<String> cmdArgs)
        Description copied from interface: SpincastProcessUtils
        Execute an external program asynchronously.

        The method will only return when the process is actually created or if an exception occured when trying to do so.

        If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:

         ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
         {
             // override some methods...
         };
         getSpincastProcessUtils().executeAsync(handler,
                                                "java",
                                                "-jar",
                                                jarFile.getAbsolutePath());
         try {
             //...
         } finally {
             handler.killProcess();
         }
         
        Specified by:
        executeAsync in interface SpincastProcessUtils
        Parameters:
        handler - to get information from the created process and to be able to kill it.
      • executeAsync

        public void executeAsync(ProcessExecutionHandler handler,
                                 long timeoutAmount,
                                 TimeUnit timeoutUnit,
                                 List<String> cmdArgs)
        Description copied from interface: SpincastProcessUtils
        Execute an external program asynchronously.

        The method will only return when the process is actually created or if an exception occured when trying to do so.

        If this creates a process that is not made to exit automatically (for example it starts an HTTP server), you must kill the process by yourself!:

         ProcessExecutionHandlerDefault handler = new ProcessExecutionHandlerDefault();
         {
             // override some methods...
         };
         getSpincastProcessUtils().executeAsync(handler,
                                                "java",
                                                "-jar",
                                                jarFile.getAbsolutePath());
         try {
             //...
         } finally {
             handler.killProcess();
         }
         
        Specified by:
        executeAsync in interface SpincastProcessUtils
        Parameters:
        handler - to get information from the created process and to be able to kill it.
        timeoutAmount - the amount of time the external program is allowed to run before a timeout occurs. When the timeout occurs: Note that onExit() will not be called if a timeout occurs!
        timeoutUnit - the timeout unit.
      • killProcess

        protected void killProcess(Process process)
      • waitForStreamsToBeEmpty

        protected void waitForStreamsToBeEmpty(Thread systemOutReaderThread,
                                               Thread systemErrReaderThread)

Copyright © 2019. All rights reserved.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy