https://issues.apache.org/bugzilla/show_bug.cgi?id=52706
Bug #: 52706
Summary: Make Execute class extensible to allow custom
CommandLauncher implementation
Product: Ant
Version: 1.8.2
Platform: PC
Status: NEW
Severity: enhancement
Priority: P2
Component: Core
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 28353
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28353
A patch to implement the enhancement
Right now Execute uses a static CommandLauncher instance which is
initialize inside the static initializer ("class constructor").
CommandLauncher's responsibility is to create the Process instances.
Currently there isn't a way to make Execute use a different CommandLauncher
I have attached a patch containing the changes I made to Execute java class.
What I have basically done is move the code that initializes the
CommandLauncher from the Execute class to to the CommandLauncher class. I have
made CommandLauncher class public and all the subclasses of it public too. I
have added two static methods
getVMLauncher and getShellLauncher to the CommandLauncher class. These methods
take a Project object as parameter and check if a reference to an existing
CommandLauncher is present in the project. If present then that instance is
returned. Otherwise the method checks if a system property containing the name
of the launcher class has been set. If so then an instance of that class is
created and returned, otherwise the default launcher is returned. I have also
added setVMLauncher and setShellLauncher methods that add reference to a given
CommandLauncher instance to the project.
I have modified the Execute class to use these two methods to get the reference
of the CommandLauncher class. I have also created a CommandLauncherTask class
similar to the PropertyHelperTask that takes an instance of any CommandLauncher
class and adds a reference to it to the project.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.