use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class ConfigurationReader method ReadTaskAndConditionals.
private static boolean ReadTaskAndConditionals(Document doc) {
TaskManager TASKMAN = TaskManager.getTaskManager();
boolean retVal = true;
List<FrameworkNode> taskListNodes = FrameworkNode.GetChildNodes(doc, "TaskList");
if (taskListNodes.size() < 1) {
// LOGGER.info("No Tasks defined in config file.");
return true;
}
for (FrameworkNode taskNode : taskListNodes) {
retVal = ConfigurationReader.ReadTaskList(taskNode);
if (!retVal) {
break;
}
}
if (true == retVal) {
retVal = ReadConditionals(doc);
}
return retVal;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class ConfigurationReader method ReadMenu.
private Menu ReadMenu(String Title, FrameworkNode menuNode) {
Menu objMenu = new Menu(Title);
for (FrameworkNode node : menuNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("MenuItem")) {
Utility.ValidateAttributes(new String[] { "Text", "Task" }, node);
if (node.hasAttribute("Text") && node.hasAttribute("Task")) {
MenuItem objItem = new MenuItem(node.getAttribute("Text"));
if (true == _Configuration.getAllowTasks()) {
objItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
TASKMAN.PerformTask(node.getAttribute("Task"));
}
});
}
objMenu.getItems().add(objItem);
} else {
LOGGER.severe("Invalid Menu with Title of " + Title + " defined");
return null;
}
}
}
return objMenu;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class ConfigurationReader method ReadAppMenu.
private boolean ReadAppMenu(FrameworkNode menuNode, boolean basicInfoOnly) {
if (null != _Configuration.getMenuBar()) {
return true;
}
if (menuNode.hasAttribute("Show")) {
String strVal = menuNode.getAttribute("Show");
if (strVal.equalsIgnoreCase("True")) {
_Configuration.setShowMenuBar(true);
if (!basicInfoOnly) {
LOGGER.config("Show Menu Bar = TRUE");
}
} else {
_Configuration.setShowMenuBar(false);
if (!basicInfoOnly) {
LOGGER.config("Show Menu Bar = FALSE");
}
}
}
if (basicInfoOnly) {
return true;
}
MenuBar objMenuBar = new MenuBar();
for (FrameworkNode node : menuNode.getChildNodes()) {
if (node.getNodeName().equalsIgnoreCase("Menu")) {
Utility.ValidateAttributes(new String[] { "Title" }, node);
if (node.hasAttribute("Title")) {
Menu objMenu = ReadMenu(node.getAttribute("Title"), node);
if (null != objMenu) {
objMenuBar.getMenus().add(objMenu);
} else {
return false;
}
} else {
LOGGER.severe("Invalid Menu defined, no Title");
return false;
}
}
}
_Configuration.setMenuBar(objMenuBar);
return true;
}
use of kutch.biff.marvin.utility.FrameworkNode 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>
*/
TaskManager TASKMAN = TaskManager.getTaskManager();
boolean retVal = true;
NodeList conditionals = doc.getElementsByTagName("Conditional");
if (conditionals.getLength() < 1) {
return true;
}
for (int iLoop = 0; iLoop < conditionals.getLength(); iLoop++) {
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;
}
use of kutch.biff.marvin.utility.FrameworkNode in project Board-Instrumentation-Framework by intel.
the class ReceiveThreadMgr method HandleIncomingOscarPacket.
private void HandleIncomingOscarPacket(Node objNode, InetAddress address) {
FrameworkNode node = new FrameworkNode(objNode);
if (!node.hasAttribute("Type")) {
LOGGER.severe("Received Oscar Packet with not Type attribute");
return;
}
String type = node.getAttribute("Type");
if (type.equalsIgnoreCase("Data")) {
HandleIncomingDatapoint(objNode);
} else if (type.equalsIgnoreCase("ConnectionInformation")) {
HandleIncomingOscarConnectionInfoPacket(objNode, address);
} else {
LOGGER.severe("Received Oscar Packet with unknown Type: " + type);
}
}
Aggregations