This repository has been archived by the owner on Nov 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Metadata File
Antonin Abherve edited this page Nov 10, 2017
·
4 revisions
The MetaData.xml file contains meta-datas related to the SMM Measure:
- Name, description, catgory and provider of the Measure
- Type of the Measure
- Unite (data model) of the measure
- List of properties of the measure
- List of references for Derived Measure (inputs form others measures)
Element | Cardianlity | Attribute | Description |
---|---|---|---|
Measure | 1 | The Measure | |
name | Name / Id of the Measure | ||
type | SMM Type of the measure : [DIRECT,COLLECTIVE,RACKING,GRADE,BINARY,COUNTING,ESCALED,RATIO] | ||
category | Classification of the measure by category | ||
provider | People / Entity which developed the measure | ||
description | 1 (Measure) | Description of the Measure | |
unite | 1 (Measure) | DataModel of measurements returned by the measure | |
fields | * (unite) | A Field of the measure unite | |
fieldName | Name of the field | ||
fieldType | Type of the field : [u_text,u_integer,u_long,u_date,u_boolean,u_float,u_geo_point,...] | ||
scopeProperties | * (Measure) | A property user to configure the execution of the measure | |
name | Name of the property | ||
defaultValue | Default value of the property | ||
type | Type of the property :[STRING,INTEGER,FLOAT,DATE,ENUM,PASSWORD,DESABLE] | ||
description | 1(scopeProperties ) | Description of the scope property | |
enumType | 1(scopeProperties) | Emum definition for scopeProperties of type ENUM | |
enumvalue | *(enumType) | Emum values | |
label | label of the enum entry | ||
value | value of the enum entry | ||
references | * (Measure) | References to inputs required by Derived Measures | |
measureRef | Name of the required measure | ||
number | Default Number of instance of this input required | ||
expirationDelay | Filter old measurement | ||
references-role | 1 | Role of the imput in current Measurement. This role allow to identifyseveral instance of the same Measure in a DerivedMeasure. |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Measure name="RandomMeasure" type="DIRECT">
<description>Return a random measure and his variation</description>
<scopeProperties defaultValue="100" name="MaxRange" type="INTEGER">
<description>MaxRange</description>
</scopeProperties>
<scopeProperties defaultValue="0" name="MinRange" type="FLOAT">
<description>MinRange</description>
</scopeProperties>
<scopeProperties defaultValue="0" name="PreviousValue" type="DESABLE">
<description>PreviousValue</description>
</scopeProperties>
<scopeProperties defaultValue="Borned" name="Kind" type="ENUM">
<description>Kind</description>
<enumType>
<enumvalue label="Is Borrned" value="Borned"/>
<enumvalue label="Not Borrned" value="UnBorned"/>
</enumType>
</scopeProperties>
<scopeProperties name="TestDate" type="DATE">
<description>TestDate</description>
</scopeProperties>
<scopeProperties name="TestPassword" type="PASSWORD">
<description>TestPassword</description>
</scopeProperties>
<scopeProperties name="TestString" type="STRING">
<description>TestString</description>
</scopeProperties>
<unit name="RandomMeasurement">
<fields fieldName="FinalValue4" fieldType="u_double"/>
<fields fieldName="Variation4" fieldType="u_integer"/>
<fields fieldName="myDate" fieldType="u_date"/>
</unit>
</Measure>
The MeasureMetaData.xml file can be generated using JAXB :
public static void main(String[] args) {
SMMMeasure measure = new SMMMeasure();
measure.setName("RandomGenerator");
measure.setDescription("A Test Measure delivering a random number at each execution");
measure.setType(MeasureType.DIRECT);
measure.setCategory("Test");
measure.setProvider("Softeam");
MeasureUnit unit = new MeasureUnit();
MeasureUnitField f1 = new MeasureUnitField();
f1.setFieldName("postDate");
f1.setFieldType(FieldType.u_date);
unit.getFields().add(f1);
MeasureUnitField f2 = new MeasureUnitField();
f2.setFieldName("myValue");
f2.setFieldType(FieldType.u_double);
unit.getFields().add(f2);
measure.setUnit(unit);
ScopeProperty minRange = new ScopeProperty();
minRange.setName("MinRange");
minRange.setDescription("Min range of RandomGenerator");
minRange.setDefaultValue("0");
minRange.setType(ScopePropertyType.INTEGER);
ScopeProperty maxRange = new ScopeProperty();
maxRange.setName("MaxRange");
maxRange.setDescription("Max range of RandomGenerator");
maxRange.setDefaultValue("100");
maxRange.setType(ScopePropertyType.INTEGER);
ScopeProperty delta = new ScopeProperty();
delta.setName("Delta");
delta.setDescription("Delta max between 2 value ");
delta.setDefaultValue("5");
delta.setType(ScopePropertyType.INTEGER);
ScopeProperty previous = new ScopeProperty();
previous.setName("PreviousValue");
previous.setDefaultValue("0");
previous.setType(ScopePropertyType.DESABLE);
measure.getScopeProperties().add(minRange);
measure.getScopeProperties().add(maxRange);
measure.getScopeProperties().add(delta);
measure.getScopeProperties().add(previous);
File xmlTmpFile = File.createTempFile("SMMMeasure", "xml");
JAXBContext context = JAXBContext.newInstance(SMMMeasure.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.marshal(measure, xmlTmpFile);
}