Search in sources :

Example 26 with FrameworkNode

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

the class TaskManager method BuildRemoteMarvinTaskItem.

private RemoteMarvinTask BuildRemoteMarvinTaskItem(String taskID, FrameworkNode taskNode) {
    /**
     * * Example Task
     * <TaskItem Type="MarvinAdmin">
     * <Task ID="TabChange"/>
     * </TaskItem>
     */
    String RemoteTaskID, RemoteMarvinID;
    RemoteTaskID = "";
    RemoteMarvinID = "";
    for (FrameworkNode node : taskNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("Task")) {
            Utility.ValidateAttributes(new String[] { "ID" }, node);
            if (node.hasAttribute("ID")) {
                RemoteTaskID = node.getAttribute("ID");
            } else {
                LOGGER.severe("Invalid MarvinAdminTask with Task ID: " + taskID + " - no ID specified.");
                return null;
            }
        }
        if (node.getNodeName().equalsIgnoreCase("MarvinID")) {
            RemoteMarvinID = node.getTextContent();
        }
    }
    RemoteMarvinTask objTask = new RemoteMarvinTask(RemoteMarvinID, RemoteTaskID);
    return objTask;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 27 with FrameworkNode

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

the class TaskManager method BuildPulseTaskItem.

private PulseTask BuildPulseTaskItem(String taskID, FrameworkNode taskNode) {
    /**
     * * Example Task
     * <TaskItem Type="Pulse">
     * <MarvinDataPoint ID="Text" Namespace="PK Laptop"/>
     * </TaskItem>
     */
    boolean errorLogged = false;
    PulseTask objPulseTask = new PulseTask();
    for (FrameworkNode node : taskNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("MarvinDataPoint")) {
            Utility.ValidateAttributes(new String[] { "Namespace", "ID" }, node);
            if (node.hasAttribute("Namespace") && node.hasAttribute("ID")) {
                objPulseTask.SetNamespaceAndID(node.getAttribute("Namespace"), node.getAttribute("ID"));
            } else {
                LOGGER.severe("Task with ID: " + taskID + " contains an invalid Pulse Task - no Namespace and ID defined in MarvinDataPoint");
                errorLogged = true;
            }
        }
    }
    if (!objPulseTask.isValid()) {
        objPulseTask = null;
        if (!errorLogged) {
            LOGGER.severe("Task with ID: " + taskID + " contains an invalid Pulse Task - no MarvinDataPoint defined");
        }
    }
    return objPulseTask;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 28 with FrameworkNode

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

the class TaskManager method BuildMinionTaskItem.

/**
 * Read the parameters from the xml file for a Minion task
 *
 * @param taskID ID of the task
 * @param taskNode XML node
 * @return A MinionTask object
 */
private MinionTask BuildMinionTaskItem(String taskID, FrameworkNode taskNode) {
    /**
     * * Example Task
     * <TaskItem Type="Minion">
     * <Actor Namespace="fubar" ID="EnableRSS"/>
     * <Param>16</Param>
     */
    MinionTask objMinionTask = new MinionTask();
    objMinionTask.setParams(GetParameters(taskNode));
    if (objMinionTask.getParams() != null && objMinionTask.getParams().size() == 0) {
        // means had problem loading params.
        return null;
    }
    for (FrameworkNode node : taskNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("Actor")) {
            Utility.ValidateAttributes(new String[] { "Namespace", "ID" }, node);
            if (node.hasAttribute("Namespace") && node.hasAttribute("ID")) {
                objMinionTask.setID(node.getAttribute("ID"));
                objMinionTask.setNamespace(node.getAttribute("Namespace"));
            } else {
                LOGGER.severe("Task with ID: " + taskID + " contains an invalid Minion Task");
                return null;
            }
        }
    }
    return objMinionTask;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 29 with FrameworkNode

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

the class TaskManager method BuildMarvinAdminTaskItem.

private MarvinAdminTask BuildMarvinAdminTaskItem(String taskID, FrameworkNode taskNode) {
    /**
     * * Example Task
     * <TaskItem Type="MarvinAdmin">
     * <Task ID="TabChange"  Data="DemoTab-Indicators"/>
     * </TaskItem>
     */
    String ID, Data;
    ID = "";
    Data = "";
    boolean TaskFound = false;
    for (FrameworkNode node : taskNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("Task")) {
            TaskFound = true;
            Utility.ValidateAttributes(new String[] { "Data", "ID" }, node);
            if (node.hasAttribute("ID")) {
                ID = node.getAttribute("ID");
            } else {
                LOGGER.severe("Invalid MarvinAdminTask with Task ID: " + taskID + " - no ID specified.");
                return null;
            }
            if (node.hasAttribute("Data")) {
                Data = node.getAttribute("Data");
            } else {
                Data = "";
            }
        }
    }
    if (!TaskFound) {
        LOGGER.severe("Invalid MarvinAdminTask with Task ID: " + taskID + " - no Task specified.");
        return null;
    }
    MarvinAdminTask objTask = new MarvinAdminTask(taskID, ID, Data);
    return objTask;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Example 30 with FrameworkNode

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

the class TaskManager method BuildOscarTaskItem.

/**
 * Read the parameters from the xml file for a Oscar task
 *
 * @param taskID ID of the task
 * @param taskNode XML node
 * @return A OscarTask object
 */
private OscarTask BuildOscarTaskItem(String taskID, FrameworkNode taskNode) {
    /**
     * * Example Task
     * <TaskItem Type="Oscar">
     * <Task OscarID="Fubar">Load File</Task>
     * <Param>mysave.glk</Param>
     * </TaskItem>
     */
    OscarTask objOscarTask = new OscarTask();
    objOscarTask.setParams(GetParameters(taskNode));
    if (objOscarTask.getParams() != null && objOscarTask.getParams().size() == 0) {
        // means had problem loading params.
        return null;
    }
    for (FrameworkNode node : taskNode.getChildNodes()) {
        if (node.getNodeName().equalsIgnoreCase("Task")) {
            Utility.ValidateAttributes(new String[] { "OscarID" }, node);
            if (node.hasAttribute("OscarID")) {
                objOscarTask.setOscarID(node.getAttribute("OscarID"));
                objOscarTask.setTaskID(node.getTextContent());
            } else {
                LOGGER.severe("Task with ID: " + taskID + " contains an invalid Oscar Task");
                return null;
            }
        }
    }
    return objOscarTask;
}
Also used : FrameworkNode(kutch.biff.marvin.utility.FrameworkNode)

Aggregations

FrameworkNode (kutch.biff.marvin.utility.FrameworkNode)52 NodeList (org.w3c.dom.NodeList)7 ArrayList (java.util.ArrayList)6 IOException (java.io.IOException)5 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)5 SAXException (org.xml.sax.SAXException)5 BaseWidget (kutch.biff.marvin.widget.BaseWidget)4 Document (org.w3c.dom.Document)4 TaskManager (kutch.biff.marvin.task.TaskManager)3 DynamicGridWidget (kutch.biff.marvin.widget.DynamicGridWidget)3 GridWidget (kutch.biff.marvin.widget.GridWidget)3 Node (org.w3c.dom.Node)3 File (java.io.File)2 Menu (javafx.scene.control.Menu)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 SeriesDataSet (kutch.biff.marvin.utility.SeriesDataSet)2 Widget (kutch.biff.marvin.widget.Widget)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 List (java.util.List)1