Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


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 runtime information for multiples runtimes support. Now it contains "device" and "symbol set" information, and a boolean "active" to indicate if this runtime is the current active one.

Each MTJRuntime is stored in the metadata file available in the project this runtime belongs to.
Bellow is a sample on the structure of a MTJRuntime stored in a metadata file.

      <configuration active="true" name="Default device">
         <device group="Microemulator" name="Default device"/>
         <symbolSet>
            <symbol name="CLDC" value="1.1"/>
            <symbol name="MIDP" value="2.0"/>
            <symbol name="JSR135" value="1.0"/>
            <symbol name="JSR75" value="1.0"/>
            <symbol name="JSR120" value="1.0"/>
           <symbol name="JSR82" value="1.1"/>
         </symbolSet>
      </configuration>
 

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_DEVICEGROUP
          The metadata attribute for storing the group from which the device configured in a runtime may be retrieved.
static  String ATTR_DEVICENAME
          The metadata attribute for storing the name of the device associated to a runtime.
static  String ATTR_RUNTIMEACTIVE
          The metadata attribute for storing if one runtime is active.
static  String ATTR_RUNTIMENAME
          The metadata attribute for storing the name of a runtime.
static  String ATTR_SYMBOL_SET_NAME
          The metadata attribute for storing the name of the SymbolSet.
static  String ATTR_SYMBOLNAME
          The metadata attribute for storing the name of a symbol.
static  String ATTR_SYMBOLVALUE
          The metadata attribute for storing the value of a symbol.
static  String ATTR_WORKSPACESYMBOLSETNAME
          The metadata attribute for storing a Workspace SymbolSet exported by the runtime.
static  String ELEM_CONFIGURATION
          The metadata element for storing the runtime.
static  String ELEM_DEVICE
          The metadata element for storing the device configured in a runtime.
static  String ELEM_SYMBOL
          The metadata element for storing a symbol.
static  String ELEM_SYMBOL_SET
          The metadata element for storing the set of symbols associated to a runtime.
static  String ELEM_WORKSPACE_SYMBOLSET
          The metadata element for storing the symbol sets that are publicly available in the workspace.
 
Constructor Summary
MTJRuntime ( Element configElement)
          Construct a runtime from the metadata available in the project holding this runtime.
MTJRuntime ( String name)
          Creates a new instance of MTJRuntime with the given name.
 
Method Summary
 void addMTJRuntimeChangeListener ( IMTJRuntimeChangeListener listener)
          Adds the listener to the collection of listeners who will be notified when the runtime state changes.
 boolean equals ( Object obj)
          Indicates whether some other MTJRuntine is "equal to" this one.
 void fireSymbolSetChanged ()
          Notify listeners that the symbolSet has changed.
  IDevice getDevice ()
          Returns the IDevice instance associated to this runtime.
  String getName ()
          Returns the unique name of this runtime.
  ISymbolSet getSymbolSet ()
          Return the Symbolset associated with this runtime.
  ISymbolSet getSymbolSetForPreprocessing ()
          Return the Symbolset associated with this runtime refactored to be used in preprocessing.
  List< ISymbolSet> getWorkspaceScopeSymbolSets ()
          Returns a list of referenced SymbolSets that are on the workspace level.
 int hashCode ()
           
 boolean isActive ()
          Indicates whenever this runtime is active.
 void removeMTJRuntimeChangeListener ( IMTJRuntimeChangeListener listener)
          Removes the listener from the collection of listeners who will be notified when the runtime state changes.
 void setActive (boolean active)
          Set if the runtime is active or not.
 void setDevice ( IDevice device)
          Sets the IDevice instance associated to the runtime.
 void setName ( String name)
          Sets a new name for the runtime.
 void setSymbolSet ( ISymbolSet symbolSet)
          Set the Symbolset associated with this runtime.
 void setWorkspaceScopeSymbolSets ( List< ISymbolSet> symbolSets)
          Set the list of referenced SymbolSets that are on the workspace level.
  String toString ()
          This method returns a string equal to the value of: "name=" + getName() + "|active=" + isActive() + "|device=" + getDevice() + "|symbolSet=" + getSymbolSet()
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTR_DEVICEGROUP

public static final 
String ATTR_DEVICEGROUP
The metadata attribute for storing the group from which the device configured in a runtime may be retrieved.

See Also:
Constant Field Values

ATTR_DEVICENAME

public static final 
String ATTR_DEVICENAME
The metadata attribute for storing the name of the device associated to a runtime.

See Also:
Constant Field Values

ATTR_RUNTIMEACTIVE

public static final 
String ATTR_RUNTIMEACTIVE
The metadata attribute for storing if one runtime is active.

See Also:
Constant Field Values

ATTR_RUNTIMENAME

public static final 
String ATTR_RUNTIMENAME
The metadata attribute for storing the name of a runtime.

See Also:
Constant Field Values

ATTR_SYMBOL_SET_NAME

public static final 
String ATTR_SYMBOL_SET_NAME
The metadata attribute for storing the name of the SymbolSet.

See Also:
Constant Field Values

ATTR_SYMBOLNAME

public static final 
String ATTR_SYMBOLNAME
The metadata attribute for storing the name of a symbol.

See Also:
Constant Field Values

ATTR_SYMBOLVALUE

public static final 
String ATTR_SYMBOLVALUE
The metadata attribute for storing the value of a symbol.

See Also:
Constant Field Values

ATTR_WORKSPACESYMBOLSETNAME

public static final 
String ATTR_WORKSPACESYMBOLSETNAME
The metadata attribute for storing a Workspace SymbolSet exported by the runtime.

See Also:
Constant Field Values

ELEM_CONFIGURATION

public static final 
String ELEM_CONFIGURATION
The metadata element for storing the runtime.

See Also:
Constant Field Values

ELEM_DEVICE

public static final 
String ELEM_DEVICE
The metadata element for storing the device configured in a runtime.

See Also:
Constant Field Values

ELEM_SYMBOL

public static final 
String ELEM_SYMBOL
The metadata element for storing a symbol.

See Also:
Constant Field Values

ELEM_SYMBOL_SET

public static final 
String ELEM_SYMBOL_SET
The metadata element for storing the set of symbols associated to a runtime.

See Also:
Constant Field Values

ELEM_WORKSPACE_SYMBOLSET

public static final 
String ELEM_WORKSPACE_SYMBOLSET
The metadata element for storing the symbol sets that are publicly available in the workspace.

See Also:
Constant Field Values
Constructor Detail

MTJRuntime

public MTJRuntime(
Element configElement)
           throws 
PersistenceException
Construct a runtime from the metadata available in the project holding this runtime.

This constructor follows the following steps to load the runtime information from the metadata:

  1. Retrieve the instance of the IDevice associated to this runtime from the IDeviceRegistry.
  2. Load the SymbolSets.
  3. Load the SymbolSets from workspace scope using the ISymbolSetRegistry.

Parameters:
configElement - The DOM element containing the runtime data (the ELEM_CONFIGURATION XML element).
Throws:
PersistenceException - if the runtime could not be created. Reasons include:

MTJRuntime

public MTJRuntime(
String name)
Creates a new instance of MTJRuntime with the given name.

The runtime name must be unique in the project scope.

Parameters:
name - the unique name for the new runtime. This is case-sensitive and must not be null or an empty String "".
Method Detail

addMTJRuntimeChangeListener

public void addMTJRuntimeChangeListener(
IMTJRuntimeChangeListener listener)
Adds the listener to the collection of listeners who will be notified when the runtime state changes. The listener is notified by invoking one of methods defined in the IMTJRuntimeChangeListener interface.

Parameters:
listener - the listener that should be notified when the runtime state changes.

equals

public boolean equals(
Object obj)
Indicates whether some other MTJRuntine is "equal to" this one. If the names are equal, then the runtimes are considered equals.

Overrides:
equals in class Object
Parameters:
obj - the reference MTJRuntine with which to compare.
See Also:
Object.equals(java.lang.Object)

fireSymbolSetChanged

public void fireSymbolSetChanged()
Notify listeners that the symbolSet has changed.

This method notifies all listeners that the symbolSet has changed through the invocation of IMTJRuntimeChangeListener.symbolSetChanged().


getDevice

public 
IDevice getDevice()
Returns the IDevice instance associated to this runtime.

Returns:
the IDevice instance associated to this runtime.

getName

public 
String getName()
Returns the unique name of this runtime.

Returns:
the name of the runtime.

getSymbolSet

public 
ISymbolSet getSymbolSet()
Return the Symbolset associated with this runtime.

If no symbolset was previously specified, this method will return a newly created SysbolSet using "Default" as name.

NOTE: 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.
See Also:
getSymbolSetForPreprocessing()

getSymbolSetForPreprocessing

public 
ISymbolSet getSymbolSetForPreprocessing()
Return the Symbolset associated with this runtime refactored to be used in preprocessing.

NOTE: All preprocessing related function must use this method to get the SymbolSet.

The returned SymbolSet contains one more Symbol then SymbolSet returned by getSymbolSet(). (key = the runtime name(With spaces replaced by "_"), value=true)

The name of the generated Symbol set will be the same from the one returned by getSymbolSet() plus the " For Preprocessing" suffix.

Returns:
a version of the runtime symbolset to be used in preprocessing.

getWorkspaceScopeSymbolSets

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

If no workspace SymbolSets were specified, an empty list will be returned.

Returns:
the list of symbol sets on the workspace level or an an empty list in case no workspace SymbolSets were specified.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isActive

public boolean isActive()
Indicates whenever this runtime is active.

Returns:
true if this runtime is active, false otherwise.

removeMTJRuntimeChangeListener

public void removeMTJRuntimeChangeListener(
IMTJRuntimeChangeListener listener)
Removes the listener from the collection of listeners who will be notified when the runtime state changes.

Note:Since instance of MTJRuntime have a long life cycle (as long as the MTJ project), clients should remove listener manually when it no longer used.

Parameters:
listener - the listener that should no longer be notified when the runtime state changes.

setActive

public void setActive(boolean active)
Set if the runtime is active or not.

Parameters:
active - the new activation state. Use true if this runtime must be activated, false otherwise.

setDevice

public void setDevice(
IDevice device)
Sets the IDevice instance associated to the runtime.

This method notifies all listeners after setting the new device, through the invocation of IMTJRuntimeChangeListener.deviceChanged(MTJRuntimeDeviceChangeEvent) .

If the given device is the same as the older one nothing is updated and no event will be fired.

Parameters:
device - the new device to be associated to this runtime.

setName

public void setName(
String name)
Sets a new name for the runtime. The name must be unique in the project scope.

The name is case-sensitive and must not be null or an empty String "".

If the given name is the same as the older one nothing will be updated and no event will be fired.

This method notifies all listeners after changing the name of the runtime through the invocation of IMTJRuntimeChangeListener.nameChanged(MTJRuntimeNameChangeEvent).

Parameters:
name - the new name for the runtime. This is case-sensitive and must not be null or an empty String "".

setSymbolSet

public void setSymbolSet(
ISymbolSet symbolSet)
Set the Symbolset associated with this runtime.

Parameters:
symbolSet - the new Symbolset to be associated with this runtime.

setWorkspaceScopeSymbolSets

public void setWorkspaceScopeSymbolSets(
List<
ISymbolSet> symbolSets)
Set the list of referenced SymbolSets that are on the workspace level. Those SymbolSets are used during the code preprocessing.

This method notifies all listeners after setting the Workspace Scope SymbolSets through the invocation of IMTJRuntimeChangeListener.workspaceScopeSymbolSetsChanged(MTJRuntimeWorkspaceSymbolSetsChangeEvent) .

If the given list of SymbolSets is the same as the older one nothing is updated and no event will be fired.

Parameters:
symbolSets - list of referenced SymbolSets that are on the workspace level.

toString

public 
String toString()
This method returns a string equal to the value of:
 "name=" + 
getName() + "|active=" + 
isActive() + "|device=" + 
getDevice() + "|symbolSet=" + 
getSymbolSet()
 

Overrides:
toString in class Object
See Also:
Object.toString()

Mobile Tools for Java
Release 1.0


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire