server

Clone or download

Working toggle actions

Modified Files

--- 'a/src/main/java/com/stream_pi/server/action/ExternalPlugins.java'
+++ b/src/main/java/com/stream_pi/server/action/ExternalPlugins.java
@@ -185,9 +185,11 @@ public class ExternalPlugins
String name;
Version version;
+ ActionType actionType;
try
{
name = XMLConfigHelper.getStringProperty(eachActionElement, "module-name");
+ actionType = ActionType.valueOf(XMLConfigHelper.getStringProperty(eachActionElement, "type"));
version = new Version(XMLConfigHelper.getStringProperty(eachActionElement, "version"));
}
catch (Exception e)
@@ -229,7 +231,7 @@ public class ExternalPlugins
}
}
- Action action = new Action(ActionType.NORMAL);
+ Action action = new Action(actionType);
action.setModuleName(name);
action.setVersion(version);
@@ -458,26 +460,30 @@ public class ExternalPlugins
{
XMLConfigHelper.removeChilds(getActionsElement());
- for(ExternalPlugin normalAction : externalPlugins)
+ for(ExternalPlugin externalPlugin : externalPlugins)
{
Element actionElement = document.createElement("action");
getActionsElement().appendChild(actionElement);
Element moduleNameElement = document.createElement("module-name");
- moduleNameElement.setTextContent(normalAction.getModuleName());
+ moduleNameElement.setTextContent(externalPlugin.getModuleName());
actionElement.appendChild(moduleNameElement);
Element versionElement = document.createElement("version");
- versionElement.setTextContent(normalAction.getVersion().getText());
+ versionElement.setTextContent(externalPlugin.getVersion().getText());
actionElement.appendChild(versionElement);
+ Element actionTypeElement = document.createElement("type");
+ actionTypeElement.setTextContent(externalPlugin.getActionType().toString());
+ actionElement.appendChild(actionTypeElement);
+
Element propertiesElement = document.createElement("properties");
actionElement.appendChild(propertiesElement);
- for(String key : normalAction.getServerProperties().getNames())
+ for(String key : externalPlugin.getServerProperties().getNames())
{
- for(Property eachProperty : normalAction.getServerProperties().getMultipleProperties(key))
+ for(Property eachProperty : externalPlugin.getServerProperties().getMultipleProperties(key))
{
Element propertyElement = document.createElement("property");
propertiesElement.appendChild(propertyElement);
--- 'a/src/main/java/com/stream_pi/server/connection/ClientConnection.java'
+++ b/src/main/java/com/stream_pi/server/connection/ClientConnection.java
@@ -503,6 +503,8 @@ public class ClientConnection extends Th
//action toBeAdded = null;
+ logger.info("Module nAMe : "+r[4]+" __ "+actionType);
+
if(actionType == ActionType.NORMAL || actionType == ActionType.TOGGLE)
{
ExternalPlugin actionCopy = ExternalPlugins.getInstance().getPluginByModuleName(r[4]);
@@ -569,7 +571,7 @@ public class ClientConnection extends Th
a.add(action.getID());
a.add(action.getActionType()+"");
- if(action.getActionType() == ActionType.NORMAL)
+ if(action.getActionType() == ActionType.NORMAL || action.getActionType() == ActionType.TOGGLE)
{
a.add(action.getVersion().getText());
System.out.println("VERSION :sdd "+action.getVersion().getText());
@@ -580,7 +582,7 @@ public class ClientConnection extends Th
}
- if(action.getActionType() == ActionType.NORMAL)
+ if(action.getActionType() == ActionType.NORMAL || action.getActionType() == ActionType.TOGGLE)
{
a.add(action.getModuleName());
}