|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.toolforge.karma.core.cmd.CommandContext
The command context is the class that provides a runtime for commands to run in. The command context maintains
access to the current manifest and all commands that are valid. A CommandContext
must be initialized
through its init(nl.toolforge.karma.core.cmd.CommandResponseHandler, boolean)
method so it can initialize all resources it requires to properly run commands. The
init
method can only be run once.
Constructor Summary | |
CommandContext(WorkingContext workingContext)
Constructs a CommandContext , in which commands are run. |
Method Summary | |
void |
changeCurrentManifest(Manifest newManifest)
Changes the current manifest for this context. |
void |
changeCurrentManifest(java.lang.String manifestName)
Changes the current manifest for this context. |
void |
execute(Command command)
Exceutes command . |
void |
execute(java.lang.String commandLine)
Executes a command. |
java.util.Collection |
getAllManifests()
Gets all manifests. |
Manifest |
getCurrentManifest()
Gets the currently active manifest. |
java.io.File |
getLocalPath(Module module)
Some module-types (e.g. |
WorkingContext |
getWorkingContext()
|
void |
init(CommandResponseHandler handler,
boolean updateStores)
Initializes the context to run commands. |
boolean |
isManifestLoaded()
Checks if a manifest is active for this context. |
void |
process()
Implementation of the ChangeListener interface. |
(package private) void |
register()
Registers this CommandContext for automatic manifest file update changes. |
void |
setWorkingContext(WorkingContext workingContext)
Sets the workingContext for this command context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandContext(WorkingContext workingContext)
CommandContext
, in which commands are run.
Method Detail |
public WorkingContext getWorkingContext()
public void init(CommandResponseHandler handler, boolean updateStores) throws CommandException
CommandContext
.
handler
- The CommandResponseHandler
object that will be passed to all commands run through this
context.updateStores
- If this paramter is true, the CommandContext will update the local manifest and location store
with the latest manifests and locations.
CommandException
public void process()
ChangeListener
interface. This method reloads the
current manifest to allow changes to be reflected without having to restart Karma.
process
in interface nl.toolforge.core.util.listener.ChangeListener
public Manifest getCurrentManifest()
null
when no manifest is current.public void changeCurrentManifest(java.lang.String manifestName) throws ManifestException, LocationException
manifestName
name.
manifestName
-
ManifestException
- When the manifest could not be changed. See ManifestException.MANIFEST_LOAD_ERROR
.
LocationException
public void changeCurrentManifest(Manifest newManifest)
newManifest
- void register()
CommandContext
for automatic manifest file update changes.
public java.util.Collection getAllManifests()
ManifestLoader.getAllManifests()
.public void execute(java.lang.String commandLine) throws CommandException
Executes a command. Interface applications should use this method to actually execute a command. When a
KarmaException
is thrown an interface applications should *** NOT *** quit program execution as
a result of this exception. It should be handled nicely.
commandLine
- The command to execute. A full command line is passed as a parameter.
CommandException
- A whole lot. Interface applications should *** NOT *** quit program execution as a
result of this exception. It should be handled nicely.public void execute(Command command) throws CommandException
command
.
command
- The command to execute.
CommandException
public boolean isManifestLoaded()
true
if a manifest is active for the context, or false
if no manifest is active.public java.io.File getLocalPath(Module module)
Some module-types (e.g. source modules) have a physical location on disk where the module can be located. This
method returns a valid reference to that location. When the module-root is located at
/home/jensen/dev/modules/CORE-conversion
, getLocalPath()
will return a File
handle to that directory.
module
- The module for which the local path should be retrieved.
File
handle to the module directory on a local disk.
todo consider moving it to Module.public void setWorkingContext(WorkingContext workingContext)
workingContext
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |