AntSvc.I Interface

com.bea.ide.build
AntSvc.I Interface

public static interface AntSvc.I

This service is useful for exploring, manipulating and executing an ant build script in its native object structure. Ant is maintained by the Jakarta project at apache.org.

The startTarget methods return a java.lang.Thread that contains the executing target. If the target needs to be stopped, call Thread.interrupt() and the thread will stop at a safe point. Copyright (c) 2002 BEA Systems, Inc.

Related Topics

Ant website

Enclosing class

AntSvc

Method Summary

public Project
getProject(URI antURI)
Returns an org.apache.tools.ant.Project for the given URI.
public Project
getProject(Reader antIn)
Returns an org.apache.tools.ant.Project for the given Reader.
public Project
getProject(String antScript)
Returns an org.apache.tools.ant.Project for the given String.
public Project
getProject(URI antURI, AntSvc.AntProjectConfigurator conf)
Same as getProject(URI), with the added parameter of an AntProjectConfigurator.
public Project
getProject(Reader antIn, AntSvc.AntProjectConfigurator conf)
Same as getProject(Reader), with the added parameter of an AntProjectConfigurator.
public Project
getProject(String antScript, AntSvc.AntProjectConfigurator conf)
Same as getProject(String), with the added parameter of an AntProjectConfigurator.
public AntSvc.AntTargetKey
getTargetKey(Project project, String targetName)
Returns a target key for a given Ant Project and target name.
public AntSvc.AntTargetKey
startTarget(Project project, String target)
Begins the execution of the specified ant target.
public AntSvc.AntTargetKey
startTarget(Project project, String target, OutputSvc.IOutputWindow window)
Same as startTarget, except the output gets sent to the specified IOutputWindow.
public AntSvc.AntTargetKey
startTarget(Project project, String target, PrintStream out, PrintStream err)
Begins the execution of an ant target in the given project, with output going to the out and err PrintStreams specified.
public void
stopTarget(AntSvc.AntTargetKey targetKey)
Stops the running target identified by the targetKey.
public boolean
waitForCompletion(AntSvc.AntTargetKey targetKey)
Once a target has been started with startTarget, this call can be used to wait for it to finish.

Method Detail

getProject(URI) Method

public Project getProject(URI antURI)
Returns an org.apache.tools.ant.Project for the given URI. The URI must point to a valid ant build.xml file, though the file can have any name.

Parameters

antURI
a URI pointing to an ant build.xml

Returns

an ant Project object. Returns null if antFile does not exist or the content cannot be parsed.

getProject(Reader) Method

public Project getProject(Reader antIn)
Returns an org.apache.tools.ant.Project for the given Reader. The Reader must point to a valid ant xml stream. This method should only be used when the encoding of the Reader matches the declared encoding header in the xml. The default encoding is "UTF-8", so if in doubt, and the URI of the xml content is not known, create an InputStreamReader with UTF-8 as the encoding choice.

Parameters

antIn
a Reader pointing to an ant xml stream.

Returns

an ant Project object. Returns null if content cannot be parsed.

getProject(String) Method

public Project getProject(String antScript)
Returns an org.apache.tools.ant.Project for the given String. The String must contain valid ant xml content.

Parameters

antScript
a String containing ant xml content.

Returns

an ant Project object. Returns null if content cannot be parsed.

getProject(URI, AntSvc.AntProjectConfigurator) Method

public Project getProject(URI antURI, 
                          AntSvc.AntProjectConfigurator conf)
Same as getProject(URI), with the added parameter of an AntProjectConfigurator. This method is not normally used. See AntProjectConfigurator for details.

Related Topics

AntSvc.AntProjectConfigurator
AntSvc.I.getProject(URI)


getProject(Reader, AntSvc.AntProjectConfigurator) Method

public Project getProject(Reader antIn, 
                          AntSvc.AntProjectConfigurator conf)
Same as getProject(Reader), with the added parameter of an AntProjectConfigurator. This method is not normally used. See AntProjectConfigurator for details.

Related Topics

AntSvc.AntProjectConfigurator
AntSvc.I.getProject(Reader)


getProject(String, AntSvc.AntProjectConfigurator) Method

public Project getProject(String antScript, 
                          AntSvc.AntProjectConfigurator conf)
Same as getProject(String), with the added parameter of an AntProjectConfigurator. This method is not normally used. See AntProjectConfigurator for details.

Related Topics

AntSvc.AntProjectConfigurator
AntSvc.I.getProject(String)


getTargetKey(Project, String) Method

public AntSvc.AntTargetKey getTargetKey(Project project, 
                                        String targetName)
Returns a target key for a given Ant Project and target name. This key is need for executing the StopAntAction action or for calling stopTarget.

Parameters

project
The Ant project to find the target in.
targetName
The name of the target to be identified.

Related Topics

StopAntAction
AntSvc.I.stopTarget(AntSvc.AntTargetKey)


startTarget(Project, String) Method

public AntSvc.AntTargetKey startTarget(Project project, 
                                       String target)
Begins the execution of the specified ant target. Execution is in a separate Thread. Output will be sent to the Ant output window. All dependent targets will be executed before the target itelf.

Parameters

project
the ant Target object to execute.

Returns

the target key that identifies the running target.

startTarget(Project, String, OutputSvc.IOutputWindow) Method

public AntSvc.AntTargetKey startTarget(Project project, 
                                       String target, 
                                       OutputSvc.IOutputWindow window)
Same as startTarget, except the output gets sent to the specified IOutputWindow.

Related Topics

AntSvc.I.startTarget(Project, String)
OutputSvc.IOutputWindow


startTarget(Project, String, PrintStream, PrintStream) Method

public AntSvc.AntTargetKey startTarget(Project project, 
                                       String target, 
                                       PrintStream out, 
                                       PrintStream err)
Begins the execution of an ant target in the given project, with output going to the out and err PrintStreams specified. Execution is in a separate Thread. All dependent targets will be executed before the target itself.

Parameters

project
The ant Project object in which the target is located.
target
The name of the target to execute.
out
the PrintStream where ant standard output should go.
err
the PrintStream where ant error output should go.

Returns

the target key that identifies the running target.

stopTarget(AntSvc.AntTargetKey) Method

public void stopTarget(AntSvc.AntTargetKey targetKey)
Stops the running target identified by the targetKey. This call blocks until the target is stopped successfully. The targetKey can be obtained by calling getTargetKey().

Related Topics

AntSvc.I.getTargetKey(Project, String)


waitForCompletion(AntSvc.AntTargetKey) Method

public boolean waitForCompletion(AntSvc.AntTargetKey targetKey)
Once a target has been started with startTarget, this call can be used to wait for it to finish. The return value signifies if it was interrupted.

Returns

If true, target completed without interruption. False means it was cancelled or stopped.