|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.devices.PolishComponent
public class PolishComponent
Provides common functionalities for PolishProject, Vendor, DeviceGroup and Device.
Copyright Enough Software 2004 - 2011
| Field Summary | |
|---|---|
protected HashMap<String,String> |
capabilities
|
protected CapabilityManager |
capabilityManager
|
protected String |
description
|
protected HashMap<String,Boolean> |
features
|
protected String |
identifier
|
protected HashMap<String,Boolean> |
implicitGroupsByName
|
protected PolishComponent |
parent
|
protected boolean |
supportsPolishGui
|
| Constructor Summary | |
|---|---|
PolishComponent(org.jdom.Element definition)
Creates a new component. |
|
PolishComponent(PolishComponent parent,
CapabilityManager capabilityManager,
org.jdom.Element definition)
Creates a new component. |
|
| Method Summary | |
|---|---|
void |
addCapability(String name,
String value)
Adds a capability to this component. |
void |
addComponent(PolishComponent component)
Adds a sub-component to this component, replacing or appending to existing capabilities during the process. |
void |
addDirectCapability(String name,
String value)
Adds a capability without changing its name to this component. |
void |
addDirectCapability(Variable capability)
Adds a capability without changing its name to this component. |
void |
addDirectFeature(String name)
Adds a feature without inserting a ".polish" before the feature-name. |
void |
addFeature(String name)
Adds a feature this this component. |
protected void |
addImplicitGroups(String value)
|
int |
compareTo(PolishComponent o)
|
HashMap<String,String> |
getCapabilities()
Retrieves all preprocessing-variables of this component and its parent component. |
String |
getCapability(String name)
Retrieves a specific capability of this component. |
String |
getDescription()
Retrieves the description of this component. |
HashMap<String,Boolean> |
getFeatures()
Retrieves all preprocessing-symbols of this component and its parent component. |
String |
getFeaturesAsString()
Retrieves the defined features of this component. |
String |
getIdentifier()
Retrieves the identifier or name of this component. |
boolean |
hasFeature(String name)
Checks if this component has a specific feature. |
protected void |
loadCapabilities(org.jdom.Element definition,
String componentName,
String fileName)
Loads all found capabilities of this component. |
protected String[] |
loadGroups(org.jdom.Element definition,
DeviceGroupManager groupManager,
String invalidGroupMessage)
Loads all groups to which this component belongs to and sets the capabilities accordingly. |
protected void |
removeComponent(PolishComponent component)
Removes a component: |
protected String |
stripText(String string)
Converts new lines, tabs and successive whitespace to a single whitespace. |
boolean |
supportsPolishGui()
Determines whether this device supports the polish-gui-framework. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String identifier
protected PolishComponent parent
protected boolean supportsPolishGui
protected HashMap<String,Boolean> features
protected HashMap<String,String> capabilities
protected CapabilityManager capabilityManager
protected final HashMap<String,Boolean> implicitGroupsByName
protected String description
| Constructor Detail |
|---|
public PolishComponent(org.jdom.Element definition)
definition - the XML definition, can be null
public PolishComponent(PolishComponent parent,
CapabilityManager capabilityManager,
org.jdom.Element definition)
parent - the parent, e.g. is the parent of a vendor a project,
the parent of a device is a vendor.capabilityManager - knows about how to deal with capabilitiesdefinition - the XML definition, can be null| Method Detail |
|---|
protected String stripText(String string)
string - the string to strip. May be null.
protected void loadCapabilities(org.jdom.Element definition,
String componentName,
String fileName)
throws InvalidComponentException
definition - The xml definition.componentName - The name of the component, e.g. "Nokia/3650" for a device.fileName - The name of the source-file, e.g. "devices.xml".
InvalidComponentException - when the defintion contains errors.
protected String[] loadGroups(org.jdom.Element definition,
DeviceGroupManager groupManager,
String invalidGroupMessage)
throws InvalidComponentException
definition - the xml definitiongroupManager - the manager of groupsinvalidGroupMessage - the message for the InvalidComponentException when a group name is not valid.
{0} is for the identifier, {1} for the group name.
InvalidComponentException - when a group name is not validpublic void addComponent(PolishComponent component)
component - The component which definitions should be addedprotected void removeComponent(PolishComponent component)
component - public HashMap<String,Boolean> getFeatures()
if (map.get( "symbol-name") != null) { // symbol is defined.
Symbols can be retrieved in different ways:
public HashMap<String,String> getCapabilities()
String value = (String) map.get("variable-name").
Variables which are defined in the device-database all start with "polish.":
public void addCapability(String name,
String value)
name - the name of the capabilityvalue - the value of the capabilityprotected void addImplicitGroups(String value)
value - public void addDirectCapability(Variable capability)
capability - The capability which should be added
public void addDirectCapability(String name,
String value)
name - The name of the capability.value - The value of the capability.public void addFeature(String name)
name - the name of the featurepublic void addDirectFeature(String name)
name - The feature which should be added.public boolean hasFeature(String name)
name - the feature which should be defined, e.g. "hardware.camera"
public boolean supportsPolishGui()
public String getCapability(String name)
name - the name of the capability.
public String getIdentifier()
public String getDescription()
public String getFeaturesAsString()
public int compareTo(PolishComponent o)
compareTo in interface Comparable<PolishComponent>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||