Search in sources :

Example 1 with Conditional

use of kutch.biff.marvin.utility.Conditional in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadConditional.

private static Conditional ReadConditional(FrameworkNode condNode) {
    String strType = null;
    boolean CaseSensitive = false;
    Utility.ValidateAttributes(new String[] { "CaseSensitive", "Type" }, condNode);
    if (!condNode.hasAttribute("type")) {
        LOGGER.severe("Conditional defined with no Type");
        return null;
    }
    if (condNode.hasAttribute("CaseSensitive")) {
        CaseSensitive = condNode.getBooleanAttribute("CaseSensitive");
    }
    strType = condNode.getAttribute("type");
    Conditional.Type type = Conditional.GetType(strType);
    if (type == Conditional.Type.Invalid) {
        LOGGER.severe("Conditional defined with invalid type: " + strType);
        return null;
    }
    Conditional objConditional = Conditional.BuildConditional(type, condNode, true);
    if (null != objConditional) {
        objConditional.setCaseSensitive(CaseSensitive);
    }
    return objConditional;
}
Also used : Conditional(kutch.biff.marvin.utility.Conditional)

Example 2 with Conditional

use of kutch.biff.marvin.utility.Conditional in project Board-Instrumentation-Framework by intel.

the class ConfigurationReader method ReadConditionals.

private static boolean ReadConditionals(Document doc) {
    /*
	 * <Conditional type='IF_EQ' CaseSensitive="True"> <MinionSrc ID="myID"
	 * Namespace="myNS"/> <Value> <MinionSrc ID="myID" Namespace="myNS"/> </Value>
	 * or <Value>44</Value>
	 * 
	 * <Then>Task12</Then> <Else>Task3</Else> </Conditional>
	 */
    boolean retVal = true;
    // NodeList conditionals = doc.getElementsByTagName("Conditional");
    List<FrameworkNode> conditionals = FrameworkNode.GetChildNodes(doc, "Conditional");
    if (conditionals.size() < 1) {
        return true;
    }
    for (// int iLoop = 0; iLoop < conditionals.getLength(); iLoop++)
    FrameworkNode condNode : // int iLoop = 0; iLoop < conditionals.getLength(); iLoop++)
    conditionals) {
        // FrameworkNode condNode = new FrameworkNode(conditionals.item(iLoop));
        Conditional objCond = ReadConditional(condNode);
        if (null == objCond) {
            retVal = false;
        } else {
            if (_conditionalMap.containsKey(objCond)) {
                LOGGER.config("Duplicate conditional found.  Might want to check for multiple inclusions of same conditional. Conditional Information: " + objCond.toString());
            } else {
                _conditionalMap.put(objCond, objCond);
            }
            objCond.Enable();
        }
    }
    return retVal;
}
Also used : Conditional(kutch.biff.marvin.utility.Conditional) FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Aggregations

Conditional (kutch.biff.marvin.utility.Conditional)2 FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)1