The module-include.xml file for a .sjar synthetic module contains the full definition of each type, used by the framework to create on-demand java
bytecode classes. For this reason the syntax extends upon the standard module-include elements to include the additional details
required to generate the class. Each Niagara type is represented by a <type> element, which has three required attributes, and two optional attributes.
class
A required string value containing the full type name, which is made up of the package name and the class name.
name
A required string value containing the name of the Niagara type, which is the Class name without the preceding "B".
extends
A required string value containing the full type name of the superclass, made up of the superclass's package name and the class name.
final
An optional boolean value ("true", or is default "false") which defines whether the class created can be extended by other classes. If the final attribute is "true" the class created can not be the superclass of other types.
abstract
An optional boolean value (default is "true", or "false") which defines whether the class created can not be instantiated and must be extended by other classes. If the abstract attribute is "true" the class can not be added to a station, and must be the superclass of other types.
Types which extend from BComplex can define their frozen slots using the <slots> element. Currently only properties is supported, through use of the <property> element. Figure 13 shows an example of creating a new BOfficeUser type which extends BUser. This new type is final, so it cannot be further
extended, and adds two new BInteger properties named "fingers" and "toes".
The <property> element has three required attributes, and two optional attributes.
name
A required string value containing the name of the property slot in its parent.
type
A required string value containing the type spec.
value
A required string value containing a representationof the property slot's default value. For properties containing a BSimple type, this is the string encoding of their value. For properties whose value is a BComplex, this is the BOG encoding of their value (TODO!)
flags
An optional integer value (default is "0") containing the default flags for this property slot in its parent.
facets
An optional string value (default is BFacets.DEFAULT encoded as "") contains the string encoding of the slots BFacets.
The <action> element has one additional optional attribute.
return
An optional string value containing the type spec of the action's return value, or null, made up of the superclass's package name and the class name.
Types can be registered as Agents on other types. This allows the registry to manage relationships between the current class,
and those this type is an agent on. Proper use of agents requires that the type also implement the BIAgent interface, which
can be seen below using the <interfaces> and <interface> elements, specific to synthetic types.
The example shown in Figure 14 creates a new ComponentView type which extends PxView. The type is final, so it can not be the superclass of other types. A single "pxFile" property is defined, which overrides a property of the same name already defined on the PxView superclass. This new type then implements BIAgent, and is registered as an agent on BComponent. This example type registers the specified "ComponentView.px" file as a view on all BIService instances within the station
The ComponentView type can be used to create types which extend BFrozenEnum, for defining enumerations as synthetic types.
These types must directly extend from BFrozenEnum, and be declared final. The definition for enumerations is similar to what
is used for types extending BComplex, except for the use of the <entries> and <entry> elements. Each <entry> element has two required attributes for defining the enumeration value.
name
A required string value containing the name of the enumeration value.
ordinal
A required integer value containing the numeric representation of the enumeration value.
Figure 15 shows an example, the type definition below creates a new FloorType enumeration with three possible values: carpet, tile, and cement.
Copyright © 2000-2014 Tridium Inc. All rights reserved.