Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.project.runtime
Class MTJRuntime

java.lang.Object
  extended by org.eclipse.mtj.core.project.runtime.MTJRuntime

public class MTJRuntime
extends Object

This class contains configuration information for multi-configuration support. Now it contains "device" and "symbol set" information, and a boolean "active" to indicate if this configuration is the current active one. This class may contains more information if need in future.

Since:
1.0
See Also:
ISymbolSet
Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.

Field Summary
static String ATTR_ACTIVE
           
static String ATTR_DEVICEGROUP
           
static String ATTR_DEVICENAME
           
static String ATTR_NAME
           
static String ATTR_VALUE
           
static String ELEM_DEVICE
           
static String ELEM_SYMBOL
           
static String ELEM_SYMBOL_SET
           
static String ELEM_WORKSPACE_SYMBOLSET
           
 
Constructor Summary
MTJRuntime(Element configElement)
          Construct Configuration from meta data XML file.
MTJRuntime(String name)
           
 
Method Summary
 void addMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)
           
 boolean equals(Object obj)
          If name equals, then configuration equals.
 void fireSymbolSetChanged()
           
 IDevice getDevice()
           
 String getName()
           
 ISymbolSet getRuntimeSymbolSet()
          All preprocessing related code should NOT use this method to get ISymbolSet, instead, getSymbolSetForPreprocessing() should be used for preprocessing purpose.
 ISymbolSet getRuntimeSymbolSetForPreprocessing()
          All preprocessing related function should use this method to get SymbolSet.
 List<ISymbolSet> getWorkspaceScopeSymbolSets()
          Returns a list of symbolsets that are on the workspace level.
 int hashCode()
           
 boolean isActive()
           
 void removeMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)
          Note:Since instance of configuration have a long life cycle (as long as the Midlet project), so we should remove listener manually when it no longer used.
 void setActive(boolean active)
           
 void setDevice(IDevice device)
           
 void setName(String name)
           
 void setSymbolSet(ISymbolSet symbolSet)
           
 void setWorkspaceScopeSymbolSets(List<ISymbolSet> symbolSets)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_NAME

public static final String ATTR_NAME
See Also:
Constant Field Values

ATTR_ACTIVE

public static final String ATTR_ACTIVE
See Also:
Constant Field Values

ELEM_DEVICE

public static final String ELEM_DEVICE
See Also:
Constant Field Values

ATTR_DEVICEGROUP

public static final String ATTR_DEVICEGROUP
See Also:
Constant Field Values

ATTR_DEVICENAME

public static final String ATTR_DEVICENAME
See Also:
Constant Field Values

ELEM_SYMBOL_SET

public static final String ELEM_SYMBOL_SET
See Also:
Constant Field Values

ELEM_WORKSPACE_SYMBOLSET

public static final String ELEM_WORKSPACE_SYMBOLSET
See Also:
Constant Field Values

ELEM_SYMBOL

public static final String ELEM_SYMBOL
See Also:
Constant Field Values

ATTR_VALUE

public static final String ATTR_VALUE
See Also:
Constant Field Values
Constructor Detail

MTJRuntime

public MTJRuntime(Element configElement)
           throws PersistenceException
Construct Configuration from meta data XML file.

Parameters:
configElement - - The <configuration> xml element.
Throws:
PersistenceException

MTJRuntime

public MTJRuntime(String name)
Method Detail

addMTJRuntimeChangeListener

public void addMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)

equals

public boolean equals(Object obj)
If name equals, then configuration equals.

Overrides:
equals in class Object

fireSymbolSetChanged

public void fireSymbolSetChanged()

getDevice

public IDevice getDevice()

getName

public String getName()

getRuntimeSymbolSet

public ISymbolSet getRuntimeSymbolSet()
All preprocessing related code should NOT use this method to get ISymbolSet, instead, getSymbolSetForPreprocessing() should be used for preprocessing purpose.

Returns:
Symbol set associated with this runtime

getRuntimeSymbolSetForPreprocessing

public ISymbolSet getRuntimeSymbolSetForPreprocessing()
All preprocessing related function should use this method to get SymbolSet. This method return a SymbolSet for preprocessing. The returned SymbolSet contains one more Symbol than SymbolSet returned by this.getSymbolSet(). (key = * this.SYMBOLKEY_CONFIG_NAME, value=this.getName())

Returns:
symbolset associated to this runtime

getWorkspaceScopeSymbolSets

public List<ISymbolSet> getWorkspaceScopeSymbolSets()
Returns a list of symbolsets that are on the workspace level. Those symbolsets are used during the code preprocessing

Returns:
List of symbol sets on the workspace level

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isActive

public boolean isActive()

removeMTJRuntimeChangeListener

public void removeMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)
Note:Since instance of configuration have a long life cycle (as long as the Midlet project), so we should remove listener manually when it no longer used.

Parameters:
listener -

setActive

public void setActive(boolean active)

setDevice

public void setDevice(IDevice device)
Parameters:
device -

setName

public void setName(String name)
Parameters:
name -

setSymbolSet

public void setSymbolSet(ISymbolSet symbolSet)

setWorkspaceScopeSymbolSets

public void setWorkspaceScopeSymbolSets(List<ISymbolSet> symbolSets)

toString

public String toString()
Overrides:
toString in class Object

Mobile Tools for Java
Release 1.0