Metadata File - aabherve/measure-smm-measure-api GitHub Wiki
The MetaData.xml file contains meta-datas related to the SMM Measure:
- Name and description of the Measure
- Type of the Measure
- Unite 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] | ||
unite | Unite of the Measurement return by the Measure | ||
description | 1 | Description of the Measure | |
scopeProperties | * | A property user to configure the execution of the measure | |
name | Name of the property | ||
defaultValue | Default value of the property | ||
scopeProperties-description | 1 | Description of the property | |
references | * | 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="RandomBinaryMeasure" type="BINARY" unite="Numeric">
<description>A Test Measure delivering colculating the sum of random numbers</description>
<scopeProperties defaultValue="+" name="Operation">
<description>Applied Operation</description>
</scopeProperties>
<references expirationDelay="60000" measureRef="RandomGenerator" number="1">
<role>RandomNumber A</role>
</references>
<references expirationDelay="60000" measureRef="RandomGenerator" number="1">
<role>RandomNumber B</role>
</references>
</Measure>
The MetaData.xml file can be generated using JAXB :
public static void main(String[] args) {
SMMMeasure measure = new SMMMeasure();
measure.setName("RandomBinaryMeasure");
measure.setDescription("A Test Measure delivering colculating the sum of random numbers");
measure.setType(MeasureType.BINARY);
measure.setUnite(MeasureUnite.Numeric);
ScopeProperty minRange = new ScopeProperty();
minRange.setName("Operation");
minRange.setDescription("Applied Operation");
minRange.setDefaultValue("+");
measure.getScopeProperties().add(minRange);
MeasureReference ref1 = new MeasureReference();
ref1.setExpirationDelay(new Long(60000));
ref1.setMeasureRef("RandomGenerator");
ref1.setNumber(1);
ref1.setRole("RandomNumber A");
measure.getReferences().add(ref1);
MeasureReference ref2 = new MeasureReference();
ref2.setExpirationDelay(new Long(60000));
ref2.setMeasureRef("RandomGenerator");
ref2.setNumber(1);
ref2.setRole("RandomNumber B");
measure.getReferences().add(ref2);
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);
}