|
@@ -12,6 +12,7 @@ import java.util.LinkedList;
|
|
import javax.tools.JavaCompiler;
|
|
import javax.tools.JavaCompiler;
|
|
import javax.tools.ToolProvider;
|
|
import javax.tools.ToolProvider;
|
|
|
|
|
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.ImportConfiguration;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Link;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Link;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Connection;
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Connection;
|
|
@@ -26,6 +27,7 @@ import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
|
|
public class ImportController {
|
|
public class ImportController {
|
|
Model model;
|
|
Model model;
|
|
Controller controller;
|
|
Controller controller;
|
|
|
|
+ ImportConfiguration importConf;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Creates a new ImportController
|
|
* Creates a new ImportController
|
|
@@ -38,6 +40,7 @@ public class ImportController {
|
|
public ImportController(Model model, Controller controller) {
|
|
public ImportController(Model model, Controller controller) {
|
|
this.model = model;
|
|
this.model = model;
|
|
this.controller = controller;
|
|
this.controller = controller;
|
|
|
|
+ this.importConf = controller.getControllerConfiguration().getConfigurationManager().getImportConfiguration();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -49,7 +52,7 @@ public class ImportController {
|
|
*/
|
|
*/
|
|
public boolean addLink(Class<? extends Link> Link) {
|
|
public boolean addLink(Class<? extends Link> Link) {
|
|
if (isValidLink(Link))
|
|
if (isValidLink(Link))
|
|
- model.addLinkClass(Link);
|
|
|
|
|
|
+ importConf.addLinkClass(Link);
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
return true;
|
|
return true;
|
|
@@ -63,7 +66,7 @@ public class ImportController {
|
|
* Link to be removed
|
|
* Link to be removed
|
|
*/
|
|
*/
|
|
public void removeLink(Class<? extends Link> Link) {
|
|
public void removeLink(Class<? extends Link> Link) {
|
|
- model.removeLinkClass(Link);
|
|
|
|
|
|
+ importConf.removeLinkClass(Link);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -72,7 +75,7 @@ public class ImportController {
|
|
* @return available links
|
|
* @return available links
|
|
*/
|
|
*/
|
|
public LinkedList<Class<? extends Link>> getLinks() {
|
|
public LinkedList<Class<? extends Link>> getLinks() {
|
|
- return model.getLinkClasses();
|
|
|
|
|
|
+ return importConf.getLinkClasses();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -110,7 +113,7 @@ public class ImportController {
|
|
*/
|
|
*/
|
|
public boolean addProtocol(Class<? extends Protocol> protocol) {
|
|
public boolean addProtocol(Class<? extends Protocol> protocol) {
|
|
if (isValidProtocol(protocol))
|
|
if (isValidProtocol(protocol))
|
|
- model.addProtocolClass(protocol);
|
|
|
|
|
|
+ importConf.addProtocolClass(protocol);
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
return true;
|
|
return true;
|
|
@@ -124,7 +127,7 @@ public class ImportController {
|
|
* protocol to be removed
|
|
* protocol to be removed
|
|
*/
|
|
*/
|
|
public void removeProtocol(Class<? extends Protocol> protocol) {
|
|
public void removeProtocol(Class<? extends Protocol> protocol) {
|
|
- model.removeProtocolClass(protocol);
|
|
|
|
|
|
+ importConf.removeProtocolClass(protocol);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -133,7 +136,7 @@ public class ImportController {
|
|
* @return available protocols
|
|
* @return available protocols
|
|
*/
|
|
*/
|
|
public LinkedList<Class<? extends Protocol>> getProtocols() {
|
|
public LinkedList<Class<? extends Protocol>> getProtocols() {
|
|
- return model.getProtocolClasses();
|
|
|
|
|
|
+ return importConf.getProtocolClasses();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -177,7 +180,7 @@ public class ImportController {
|
|
*/
|
|
*/
|
|
public boolean addConnection(Class<? extends Connection> connection) {
|
|
public boolean addConnection(Class<? extends Connection> connection) {
|
|
if (isValidConnection(connection))
|
|
if (isValidConnection(connection))
|
|
- model.addConnectionClass(connection);
|
|
|
|
|
|
+ importConf.addConnectionClass(connection);
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
return true;
|
|
return true;
|
|
@@ -191,7 +194,7 @@ public class ImportController {
|
|
* Connection to be removed
|
|
* Connection to be removed
|
|
*/
|
|
*/
|
|
public void removeConnection(Class<? extends Connection> connection) {
|
|
public void removeConnection(Class<? extends Connection> connection) {
|
|
- model.removeConnectionClass(connection);
|
|
|
|
|
|
+ importConf.removeConnectionClass(connection);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -200,7 +203,7 @@ public class ImportController {
|
|
* @return available Connections
|
|
* @return available Connections
|
|
*/
|
|
*/
|
|
public LinkedList<Class<? extends Connection>> getConnections() {
|
|
public LinkedList<Class<? extends Connection>> getConnections() {
|
|
- return model.getConnectionClasses();
|
|
|
|
|
|
+ return importConf.getConnectionClasses();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -238,7 +241,7 @@ public class ImportController {
|
|
*/
|
|
*/
|
|
public boolean addSmartDevice(Class<? extends SmartDevice> smartDevice) {
|
|
public boolean addSmartDevice(Class<? extends SmartDevice> smartDevice) {
|
|
if (isValidSmartDevice(smartDevice))
|
|
if (isValidSmartDevice(smartDevice))
|
|
- model.addSmartDeviceClass(smartDevice);
|
|
|
|
|
|
+ importConf.addSmartDeviceClass(smartDevice);
|
|
else
|
|
else
|
|
return false;
|
|
return false;
|
|
return true;
|
|
return true;
|
|
@@ -252,7 +255,7 @@ public class ImportController {
|
|
* SmartDevice to be removed
|
|
* SmartDevice to be removed
|
|
*/
|
|
*/
|
|
public void removeSmartDevice(Class<? extends SmartDevice> smartDevice) {
|
|
public void removeSmartDevice(Class<? extends SmartDevice> smartDevice) {
|
|
- model.removeSmartDeviceClass(smartDevice);
|
|
|
|
|
|
+ importConf.removeSmartDeviceClass(smartDevice);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -261,7 +264,7 @@ public class ImportController {
|
|
* @return available SmartDevices
|
|
* @return available SmartDevices
|
|
*/
|
|
*/
|
|
public LinkedList<Class<? extends SmartDevice>> getSmartDevices() {
|
|
public LinkedList<Class<? extends SmartDevice>> getSmartDevices() {
|
|
- return model.getSmartDeviceClasses();
|
|
|
|
|
|
+ return importConf.getSmartDeviceClasses();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|