|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.mtj.core.project.runtime.MTJRuntime
public class MTJRuntime
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>
ISymbolSet
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 |
---|
public static final String ATTR_DEVICEGROUP
public static final String ATTR_DEVICENAME
public static final String ATTR_RUNTIMEACTIVE
public static final String ATTR_RUNTIMENAME
public static final String ATTR_SYMBOL_SET_NAME
public static final String ATTR_SYMBOLNAME
public static final String ATTR_SYMBOLVALUE
public static final String ATTR_WORKSPACESYMBOLSETNAME
public static final String ELEM_CONFIGURATION
public static final String ELEM_DEVICE
public static final String ELEM_SYMBOL
public static final String ELEM_SYMBOL_SET
public static final String ELEM_WORKSPACE_SYMBOLSET
Constructor Detail |
---|
public MTJRuntime(Element configElement) throws PersistenceException
This constructor follows the following steps to load the runtime information from the metadata:
IDeviceRegistry
.ISymbolSetRegistry
.
configElement
- The DOM element containing the runtime data (the
ELEM_CONFIGURATION
XML element).
PersistenceException
- if the runtime could not be created. Reasons
include:
IDeviceRegistry
.ISymbolSetRegistry
.public MTJRuntime(String name)
The runtime name must be unique in the project scope.
name
- the unique name for the new runtime. This is case-sensitive
and must not be null
or an empty String
""
.Method Detail |
---|
public void addMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)
IMTJRuntimeChangeListener
interface.
listener
- the listener that should be notified when the runtime
state changes.public boolean equals(Object obj)
equals
in class Object
obj
- the reference MTJRuntine with which to compare.Object.equals(java.lang.Object)
public void fireSymbolSetChanged()
This method notifies all listeners that the symbolSet has changed through
the invocation of IMTJRuntimeChangeListener.symbolSetChanged()
.
public IDevice getDevice()
public String getName()
public ISymbolSet getSymbolSet()
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.
getSymbolSetForPreprocessing()
public ISymbolSet getSymbolSetForPreprocessing()
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.
public List<ISymbolSet> getWorkspaceScopeSymbolSets()
If no workspace SymbolSets were specified, an empty list will be returned.
public int hashCode()
hashCode
in class Object
public boolean isActive()
true
if this runtime is active, false
otherwise.public void removeMTJRuntimeChangeListener(IMTJRuntimeChangeListener listener)
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.
listener
- the listener that should no longer be notified when the
runtime state changes.public void setActive(boolean active)
active
- the new activation state. Use true
if this
runtime must be activated, false
otherwise.public void setDevice(IDevice device)
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.
device
- the new device to be associated to this runtime.public void setName(String name)
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)
.
name
- the new name for the runtime. This is case-sensitive and must
not be null
or an empty String ""
.public void setSymbolSet(ISymbolSet symbolSet)
symbolSet
- the new Symbolset to be associated with this runtime.public void setWorkspaceScopeSymbolSets(List<ISymbolSet> symbolSets)
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.
symbolSets
- list of referenced SymbolSets that are on the workspace
level.public String toString()
"name=" +getName()
+ "|active=" +isActive()
+ "|device=" +getDevice()
+ "|symbolSet=" +getSymbolSet()
toString
in class Object
Object.toString()
|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |