APAM/APAM Details/APAM Property Management
Properties are pairs (name, value), name is a string, and value is a typed singleton. Names and values are case sensitive.
Properties are typed; the available types are: string, integer, boolean or enumeration.
A definition is as follows:
<specification name="S1" ….> <definition name="hostName" type="string" /> <definition name="speed" type="int" /> <definition name="location" type="living, kitchen, bedroom" value="bedroom" /> <definition name="OS" type="Linux, Windows, Android, IOS" /> …… </specification>
A definition can include a default value, as for "location" above. An enumeration is a comma separated list of string. Values must not contain coma. White-spaces are ignored around the commas.
A definition in a component is used to set that property to its members. For example the definitions above can be instantiated on any implementation of specification "S1" or on instances of "S1" if the implementation did not instantiate the property, as for example, "hostname", or "location" if that property makes sense only on instances.
A property name cannot be one of the ApAM final properties .
A property i.e. a pair (name, value) can be instantiated on a component C, if the property is defined in the C group, or in any group above of C and not instantiated, and if the value matches the property type.
Instantiation can be performed in the component definition as in the following example, by API calling the method,
C.setProperty (String name, String value)
Or by DSL when creating the component
<implementation name="S1Impl" classname="XY.java" specification="S1" shared="false"> <property name="shared" value="false" /> <property name="location" value="living" /> <definition name="fieldAttr" field="myField" internal="true" type="int" value="2"/> … </implementation>
In this implementation, the attribute "fieldAttr" is associated with the field myField in the java source code of class “XY.java”. By default (internal=”false”) the value of the attribute and the value of the java field are synchronized, both ways (it can be set either by the XY class, assigning a value to the variable, of by the Apam API using the method
setProperty ("fieldAttr", "aValue")
If internal=”true”, only the program can set the attribute value, but the attribute value is visible. If a value is indicated, it will be the initial value of the variable, even if internal.
As an exception, since specification do not have group, the property type is provided in the property itself:
<specification name="S1" interfaces="…" > <property name="S1-Enum" value="v1" type="v1, v2, v3"/> <property name="S1-Attr" value="Hello" type="string"/> … </specification>
In this example, the only valid properties for S1 are S1-Enum and S1-Attr, and they are inherited by all S1 implementations and instances.
As for any characteristics, a component inherits the attributes instantiates on its group (and recursively). An inherited property cannot be set or changed; it is updated if it changes in the group.
Technical Domain properties
The technical domain (i.e. Specification, Implementation, Instances) define a few properties which semantics has been defined by Apam core. These properties are defined at the specification level. If defined with the same syntax as domain specific properties they are the following:
<definition name="shared" type="boolean" value="true" />
share="true" means that the associated instances can have more than one incoming wire. share= “false” means that each instance can have at most one incoming wire.
<definition name="singleton" type="boolean" value="false" />
Singleton=”false” means that each implementaiotn can have more than one instance. singleton=”true” mean that the implementation can have at most one instance.
<definition name="instanciable" type="boolean" value="false" />
instanciable =”false” means that implementations can have more than one instance. instanciable =”true” mean that implementations can have at most one instance.
These properties are indicated in the component tag :
<specification name="S2" singleton="false" instantiable="false" shared="false" interfaces="apam.test….">
For user convenience, these properties, as well as some final properties, are generated as domain specific attributes. It allows users to use these attributes in filters.