de.enough.polish.emulator
Class JavaMeSdkEmulator

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

public class JavaMeSdkEmulator
extends Emulator

Configures and starts the Java ME SDK emulator 3.0 and above.

Copyright Enough Software 2011

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
protected  boolean appendXdeviceArgument
           
protected  String[] arguments
           
protected  String[] environmentArguments
           
protected  File workingDirectory
           
 
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
JavaMeSdkEmulator()
          Creates a new emulator
 
Method Summary
 String[] getArguments()
          Retrieves the arguments which are used to start the emulator.
protected  File getEmulatorExcecutable(File sdkHome, String xDevice, Device dev, Environment env)
          Retrieves the executable for the given device.
protected  File getEmulatorExcecutable(String sdkHome, String xDevice, Device dev, Environment env)
          Retrieves the executable for the given device.
protected  String[] getEmulatorSkinNames(Environment env)
           
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.
protected  boolean supportsSecurityDomain()
          Indicates whether this emulator supports "-Xdomain"-parameter.
 
Methods inherited from class de.enough.polish.emulator.Emulator
addDebugArguments, createEmulator, exec, execute, filter, 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
 

Field Detail

arguments

protected String[] arguments

appendXdeviceArgument

protected boolean appendXdeviceArgument

environmentArguments

protected String[] environmentArguments

workingDirectory

protected File workingDirectory
Constructor Detail

JavaMeSdkEmulator

public JavaMeSdkEmulator()
Creates a new emulator

Method Detail

supportsSecurityDomain

protected boolean supportsSecurityDomain()
Indicates whether this emulator supports "-Xdomain"-parameter. Subclasses can override this method for adjustments.

Returns:
true by default, subclasses can change this behavior.

getEmulatorExcecutable

protected File getEmulatorExcecutable(String sdkHome,
                                      String xDevice,
                                      Device dev,
                                      Environment env)
Retrieves the executable for the given device.

Parameters:
sdkHome - the path to the Java ME SDK
xDevice - the name of the skin
dev - the device
env - environment
Returns:
the file which points to the emulator-application

getEmulatorExcecutable

protected File getEmulatorExcecutable(File sdkHome,
                                      String xDevice,
                                      Device dev,
                                      Environment env)
Retrieves the executable for the given device.

Parameters:
sdkHome - the path to the Java ME SDK
xDevice - the name of the skin
dev - the device
env - environment
Returns:
the file which points to the emulator-application

getEmulatorSkinNames

protected String[] getEmulatorSkinNames(Environment env)

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

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.

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.