com.artenum.jyconsole.command
Class Command

java.lang.Object
  extended bycom.artenum.jyconsole.command.Command
All Implemented Interfaces:
java.lang.Runnable

public class Command
extends java.lang.Object
implements java.lang.Runnable

 Project ref           : JyConsole project
 Copyright and license : See relevant sections
 Status                : under development
 Creation              : 23/06/2006
 Modification          :

 Description  : A command is either a single line of Jython or a file of commands. The
                        isRunning() method is a condition variable so you can synchronize on
                        completion of the command.

 
Version numberAuthor (name, e-mail)Corrections/Modifications
0.1Colin Crist, colincrist@hermesjms.comContribution integrated by Sebastien Jourdain, jourdain@artenum.com

Version:
0.1
Author:
Colin Crist, colincrist@hermesjms.com, Sebastien Jourdain

Constructor Summary
Command(JInteractiveInterpreter pythonInterpreter, java.io.File commandFile)
          Run a script from a file.
Command(JInteractiveInterpreter pythonInterpreter, java.lang.String command)
          Run a single line of Jython.
 
Method Summary
 boolean isRunning()
          Is the command currently running?
 void run()
          Actually performs the command.
 void stop()
          If the command is running stop it.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

public Command(JInteractiveInterpreter pythonInterpreter,
               java.io.File commandFile)
Run a script from a file.

Parameters:
pythonInterpreter -
commandFile -

Command

public Command(JInteractiveInterpreter pythonInterpreter,
               java.lang.String command)
Run a single line of Jython.

Parameters:
pythonInterpreter -
command -
Method Detail

isRunning

public boolean isRunning()
Is the command currently running? If you synchronize on the object you can use this method as a condition variable and be notified when the command finishes. i.e. (without exception handling...) synchronized (command) { if (command.isRunning()) { command.wait() ; } }

Returns:

stop

public void stop()
If the command is running stop it.


run

public void run()
Actually performs the command.

Specified by:
run in interface java.lang.Runnable

toString

public java.lang.String toString()


 (c) Copyright: Artenum SARL, 101-103 Boulevard Mac Donald, 
                75019, Paris, France 2005.
                http://www.artenum.com
 
 License:

  This program is free software; you can redistribute it 
  and/or modify it under the terms of the Q Public License; 
  either version 1 of the License.

  This program is distributed in the hope that it will be
  useful, but WITHOUT ANY WARRANTY; without even the implied
  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  PURPOSE. See the Q Public License for more details.

  You should have received a copy of the Q Public License 
  License along with this program; 
  if not, write to:
    Artenum SARL, 101-103 Boulevard Mac Donald,
    75019, PARIS, FRANCE, e-mail: contact@artenum.com