PlanParser.addCreateUpload(digester, "*/experiment/results/result", null, DigitalObject.class);
PlanParser.addCreateUpload(digester, "*/result/xcdlDescription", "setXcdlDescription", XcdlDescription.class);
// call function addUpload of ExperimentWrapper
CallMethodRule r = new CallMethodRule(1, "addResult", 2); // method
// with
// two
// params
// every time */experiment/uploads/upload is encountered
digester.addRule("*/experiment/results/result", r);
// use attribute "key" as first param
digester.addCallParam("*/experiment/results/result", 0, "key");
// and the object on stack (DigitalObject) as the second
digester.addCallParam("*/experiment/results/result", 1, true);
// addCreateUpload(digester,
// "*/experiment/xcdlDescriptions/xcdlDescription", null,
// XcdlDescription.class);
// // call function addXcdlDescription of ExperimentWrapper
// r = new CallMethodRule(1, "addXcdlDescription", 2); //method with
// two
// params
// // every time */experiment/xcdlDescriptions/xcdlDescription is
// encountered
// digester.addRule("*/experiment/xcdlDescriptions/xcdlDescription",
// r);
// // use attribute "key" as first param
// digester.addCallParam("*/experiment/xcdlDescriptions/xcdlDescription",
// 0 , "key");http://fue.onb.ac.at/abo/data
// // and the object on stack (DigitalObject) as the second
// digester.addCallParam("*/experiment/xcdlDescriptions/xcdlDescription",1,true);
digester.addObjectCreate("*/experiment/detailedInfos/detailedInfo", DetailedExperimentInfo.class);
digester.addSetProperties("*/experiment/detailedInfos/detailedInfo");
digester.addBeanPropertySetter("*/experiment/detailedInfos/detailedInfo/programOutput");
digester.addBeanPropertySetter("*/experiment/detailedInfos/detailedInfo/cpr");
// call function "addDetailedInfo" of ExperimentWrapper
r = new CallMethodRule(1, "addDetailedInfo", 2); // method with two
// params
// every time */experiment/detailedInfos/detailedInfo is encountered
digester.addRule("*/experiment/detailedInfos/detailedInfo", r);
// use attribute "key" as first param
digester.addCallParam("*/experiment/detailedInfos/detailedInfo", 0, "key");
// and the object on stack as second parameter
digester.addCallParam("*/experiment/detailedInfos/detailedInfo", 1, true);
// read contained measurements:
digester.addObjectCreate("*/detailedInfo/measurements/measurement", Measurement.class);
digester.addSetProperties("*/detailedInfo/measurements/measurement");
digester.addSetNext("*/detailedInfo/measurements/measurement", "put");
// values are defined with wild-cards, and therefore set
// automatically
/*
* for each value type a set of rules because of FreeStringValue we need
* to store the value as XML-element instead of an attribute naming them
* "ResultValues" wasn't nice too
*/
PlanParser.addCreateValue(digester, BooleanValue.class, "setValue");
PlanParser.addCreateValue(digester, FloatRangeValue.class, "setValue");
PlanParser.addCreateValue(digester, IntegerValue.class, "setValue");
PlanParser.addCreateValue(digester, IntRangeValue.class, "setValue");
PlanParser.addCreateValue(digester, OrdinalValue.class, "setValue");
PlanParser.addCreateValue(digester, PositiveFloatValue.class, "setValue");
PlanParser.addCreateValue(digester, PositiveIntegerValue.class, "setValue");
PlanParser.addCreateValue(digester, YanValue.class, "setValue");
PlanParser.addCreateValue(digester, FreeStringValue.class, "setValue");
// go no go decision
digester.addObjectCreate("*/plan/decision", Decision.class);
digester.addSetProperties("*/plan/decision");
digester.addSetNext("*/plan/decision", "setDecision");
digester.addCallMethod("*/plan/decision/actionNeeded", "setActionNeeded", 0);
digester.addCallMethod("*/plan/decision/reason", "setReason", 0);
digester.addFactoryCreate("*/plan/decision/goDecision", GoDecisionFactory.class);
digester.addSetNext("*/plan/decision/goDecision", "setDecision");
// evaluation
digester.addObjectCreate("*/plan/evaluation", Evaluation.class);
digester.addSetProperties("*/plan/evaluation");
digester.addSetNext("*/plan/evaluation", "setEvaluation");
digester.addCallMethod("*/plan/evaluation/comment", "setComment", 0);
// importance weighting
digester.addObjectCreate("*/plan/importanceWeighting", ImportanceWeighting.class);
digester.addSetProperties("*/plan/importanceWeighting");
digester.addSetNext("*/plan/importanceWeighting", "setImportanceWeighting");
digester.addCallMethod("*/plan/importanceWeighting/comment", "setComment", 0);
// recommendation
digester.addObjectCreate("*/plan/recommendation", RecommendationWrapper.class);
digester.addSetProperties("*/plan/recommendation");
digester.addSetNext("*/plan/recommendation", "setRecommendation");
digester.addCallMethod("*/plan/recommendation/reasoning", "setReasoning", 0);
digester.addCallMethod("*/plan/recommendation/effects", "setEffects", 0);
// transformation
digester.addObjectCreate("*/plan/transformation", Transformation.class);
digester.addSetProperties("*/plan/transformation");
digester.addSetNext("*/plan/transformation", "setTransformation");
digester.addCallMethod("*/plan/transformation/comment", "setComment", 0);
// Tree
/*
* Some rules for tree parsing are necessary for importing templates
* too, that's why they are added by this static method.
*/
PlanParser.addTreeParsingRulesToDigester(digester);
digester.addObjectCreate("*/leaf/evaluation", HashMap.class);
digester.addSetNext("*/leaf/evaluation", "setValueMap");
/*
* The valueMap has an entry for each (considered) alternative ... and
* for each alternative there is a list of values, one per SampleObject.
* Note: The digester uses a stack, therefore the rule to put the list
* of values to the valueMap must be added after the rule for adding the
* values to the list.
*/
/*
* 2. and for each alternative there is a list of values, one per
* SampleObject
*/
digester.addObjectCreate("*/leaf/evaluation/alternative", Values.class);
digester.addCallMethod("*/leaf/evaluation/alternative/comment", "setComment", 0);
/*
* for each result-type a set of rules they are added to the valueMap by
* the rules above
*/
PlanParser.addCreateResultValue(digester, BooleanValue.class);
PlanParser.addCreateResultValue(digester, FloatValue.class);
PlanParser.addCreateResultValue(digester, FloatRangeValue.class);
PlanParser.addCreateResultValue(digester, IntegerValue.class);
PlanParser.addCreateResultValue(digester, IntRangeValue.class);
PlanParser.addCreateResultValue(digester, OrdinalValue.class);
PlanParser.addCreateResultValue(digester, PositiveFloatValue.class);
PlanParser.addCreateResultValue(digester, PositiveIntegerValue.class);
PlanParser.addCreateResultValue(digester, YanValue.class);
PlanParser.addCreateResultValue(digester, FreeStringValue.class);
/*
* 1. The valueMap has an entry for each (considered) alternative ...
*/
// call put of the ValueMap (HashMap)
r = new CallMethodRule(1, "put", 2);
digester.addRule("*/leaf/evaluation/alternative", r);
digester.addCallParam("*/leaf/evaluation/alternative", 0, "key");
digester.addCallParam("*/leaf/evaluation/alternative", 1, true);
// digester.addObjectCreate("*/plan/executablePlan/planWorkflow",