de.enough.polish.emulator
Class BlackBerryEmulator

java.lang.Object
  extended by de.enough.polish.Extension
      extended by de.enough.polish.emulator.Emulator
          extended by de.enough.polish.emulator.BlackBerryEmulator
All Implemented Interfaces:
OutputFilter, Runnable

public class BlackBerryEmulator
extends Emulator

Invokes a specific BlackBerry simulator.

 history
        29-Dec-2009 - David refactored JDE detection
                    - Better linux support, Wine can be specified  by wine.cmd
        30-Dec-2009 - David Blackberry Emultors work completely in wine now.
        07-April-2010 - David improved BB coded by using BlackBerryUtils.
 

Author:
Robert Virkus, David Rubin TODO: filter out wine noise fixme: and error: by config

Field Summary
 
Fields inherited from class de.enough.polish.emulator.Emulator
device, emulatorSetting, isFinished
 
Fields inherited from class de.enough.polish.Extension
antProject, autoStartCondition, environment, extensionDefinition, extensionManager, extensionSetting, extensionTypeDefinition, isBuildStarted
 
Constructor Summary
BlackBerryEmulator()
           
 
Method Summary
protected  int exec(String[] args, String info, boolean wait, OutputFilter filter, File execDir)
          Executes the actual emulator.
 void filter(String logMessage, PrintStream output)
          Filters the given message.
 String[] getArguments()
          Retrieves the arguments which are used to start the emulator.
 File getEmulator(Device dev, Environment env)
          Retrieves the emulator executable
protected  File getExecutionDir()
          Retrieves the directory in which the emulator should be executed.
 boolean init(Device dev, EmulatorSetting setting, Environment env)
          Starts the emulator for the given device.
 
Methods inherited from class de.enough.polish.emulator.Emulator
addDebugArguments, createEmulator, execute, getParameter, getParameters, getParameterValue, isFinished, run, run, supportsDebugger, writeProperties
 
Methods inherited from class de.enough.polish.Extension
configure, executeAntTarget, executeAntTarget, finalize, getAntProject, getAutoStartCondition, getEnvironment, getExtensionDefinition, getExtensionSetting, getInstance, getParameterValue, getType, init, initialize, isConditionFulfilled, notifyBuildEnd, notifyBuildStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlackBerryEmulator

public BlackBerryEmulator()
Method Detail

init

public boolean init(Device dev,
                    EmulatorSetting setting,
                    Environment env)
Description copied from class: Emulator
Starts the emulator for the given device.

Specified by:
init in class Emulator
Parameters:
dev - the current device
setting - the setting
env - all Ant- and polish-properties for the parameter-values
Returns:
true when an emulator could be detected

getArguments

public String[] getArguments()
Description copied from class: Emulator
Retrieves the arguments which are used to start the emulator.

Specified by:
getArguments in class Emulator
Returns:
an array with the arguments for starting the emulator.

getExecutionDir

protected File getExecutionDir()
Description copied from class: Emulator
Retrieves the directory in which the emulator should be executed.

Overrides:
getExecutionDir in class Emulator
Returns:
null when the emulator should be started from the current directory or a file pointing to the actual needed execution dir.

exec

protected int exec(String[] args,
                   String info,
                   boolean wait,
                   OutputFilter filter,
                   File execDir)
            throws IOException
Description copied from class: Emulator
Executes the actual emulator.

Overrides:
exec in class Emulator
Parameters:
args - all command line arguments
info - the info block for output messages
wait - true when the current thread should block
filter - the output filter
execDir - the director for executing the emulator
Returns:
the result code from the emulator
Throws:
IOException - when the emulator process could not be invoked

filter

public void filter(String logMessage,
                   PrintStream output)
Description copied from class: Emulator
Filters the given message.

Specified by:
filter in interface OutputFilter
Overrides:
filter in class Emulator
Parameters:
logMessage - the message
output - the stream to which the message should be written (if not filtered)

getEmulator

public File getEmulator(Device dev,
                        Environment env)
Retrieves the emulator executable

Parameters:
dev - the current device
env - the environment
Returns:
a file pointing to the executable