renamed 'user platform' to 'project directories'

This commit is contained in:
fros4943 2007-03-23 23:33:54 +00:00
parent 8be4ba53d7
commit 61ab1ed1f3
29 changed files with 458 additions and 466 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MoteDebugger.java,v 1.4 2007/01/09 09:19:23 fros4943 Exp $ * $Id: MoteDebugger.java,v 1.1 2007/03/23 23:33:55 fros4943 Exp $
*/ */
import java.awt.event.*; import java.awt.event.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: app1.c,v 1.1 2006/08/21 12:13:09 fros4943 Exp $ * $Id: app1.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
#include "contiki.h" #include "contiki.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: app2.c,v 1.1 2006/08/21 12:13:09 fros4943 Exp $ * $Id: app2.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
#include "contiki.h" #include "contiki.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: dummy_intf.c,v 1.1 2006/08/21 12:13:13 fros4943 Exp $ * $Id: dummy_intf.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
#include "dummy_intf.h" #include "dummy_intf.h"

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: dummy_intf.h,v 1.1 2006/08/21 12:13:13 fros4943 Exp $ * $Id: dummy_intf.h,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
#ifndef __DUMMY_INTF_H__ #ifndef __DUMMY_INTF_H__

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: DummyInterface.java,v 1.2 2007/01/09 09:19:54 fros4943 Exp $ * $Id: DummyInterface.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
import java.util.*; import java.util.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MyDummyPlugin.java,v 1.2 2007/01/09 10:11:08 fros4943 Exp $ * $Id: MyDummyPlugin.java,v 1.1 2007/03/23 23:33:55 fros4943 Exp $
*/ */
import java.awt.event.*; import java.awt.event.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: DummyRadioMedium.java,v 1.3 2007/02/28 09:51:11 fros4943 Exp $ * $Id: DummyRadioMedium.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
import java.util.Collection; import java.util.Collection;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: UAODVControl.java,v 1.2 2007/01/09 10:09:59 fros4943 Exp $ * $Id: UAODVControl.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
import java.awt.*; import java.awt.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: VisUAODV.java,v 1.3 2007/02/28 09:50:51 fros4943 Exp $ * $Id: VisUAODV.java,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
import java.awt.*; import java.awt.*;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: uaodv-example.c,v 1.2 2006/08/21 15:32:29 fros4943 Exp $ * $Id: uaodv-example.c,v 1.1 2007/03/23 23:33:54 fros4943 Exp $
*/ */
#include <stdio.h> #include <stdio.h>

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: GUI.java,v 1.32 2007/03/23 21:04:19 fros4943 Exp $ * $Id: GUI.java,v 1.33 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -58,7 +58,7 @@ import se.sics.cooja.plugins.*;
* Main file of COOJA Simulator. Typically contains a visualizer for the * Main file of COOJA Simulator. Typically contains a visualizer for the
* simulator, but can also be started without visualizer. * simulator, but can also be started without visualizer.
* *
* This class loads external Java classes (in user platforms), and handles the * This class loads external Java classes (in project directories), and handles the
* COOJA plugins as well as the configuration system. If provides a number of * COOJA plugins as well as the configuration system. If provides a number of
* help methods for the rest of the COOJA system, and is the starting point for * help methods for the rest of the COOJA system, and is the starting point for
* loading and saving simulation configs. * loading and saving simulation configs.
@ -88,14 +88,14 @@ public class GUI {
public static final String LOG_CONFIG_FILE = "log4j_config.xml"; public static final String LOG_CONFIG_FILE = "log4j_config.xml";
/** /**
* Default platform configuration filename. * Default project configuration filename.
*/ */
public static final String PLATFORM_DEFAULT_CONFIG_FILENAME = "/cooja_default.config"; public static final String PROJECT_DEFAULT_CONFIG_FILENAME = "/cooja_default.config";
/** /**
* User platform configuration filename. * User project configuration filename.
*/ */
public static final String PLATFORM_CONFIG_FILENAME = "cooja.config"; public static final String PROJECT_CONFIG_FILENAME = "cooja.config";
/** /**
* File filter only showing saved simulations files (*.csc). * File filter only showing saved simulations files (*.csc).
@ -140,7 +140,7 @@ public class GUI {
"CONTIKI_STANDARD_PROCESSES", "CMD_GREP_PROCESSES", "CONTIKI_STANDARD_PROCESSES", "CMD_GREP_PROCESSES",
"REGEXP_PARSE_PROCESSES", "CMD_GREP_INTERFACES", "REGEXP_PARSE_PROCESSES", "CMD_GREP_INTERFACES",
"REGEXP_PARSE_INTERFACES", "CMD_GREP_SENSORS", "REGEXP_PARSE_SENSORS", "REGEXP_PARSE_INTERFACES", "CMD_GREP_SENSORS", "REGEXP_PARSE_SENSORS",
"CONTIKI_MAIN_TEMPLATE_FILENAME", "DEFAULT_USERPLATFORMS", "CONTIKI_MAIN_TEMPLATE_FILENAME", "DEFAULT_PROJECTDIRS",
"CORECOMM_TEMPLATE_FILENAME", "PATH_JAVAC"}; "CORECOMM_TEMPLATE_FILENAME", "PATH_JAVAC"};
private static final int FRAME_NEW_OFFSET = 30; private static final int FRAME_NEW_OFFSET = 30;
@ -166,12 +166,12 @@ public class GUI {
private Vector<Plugin> startedPlugins = new Vector<Plugin>(); private Vector<Plugin> startedPlugins = new Vector<Plugin>();
// Platform configuration variables // Platform configuration variables
// Maintained via method reparsePlatformConfig() // Maintained via method reparseProjectConfig()
private PlatformConfig platformConfig; private ProjectConfig projectConfig;
private Vector<File> currentUserPlatforms = new Vector<File>(); private Vector<File> currentProjectDirs = new Vector<File>();
private ClassLoader userPlatformClassLoader; private ClassLoader projectDirClassLoader;
private Vector<Class<? extends MoteType>> moteTypeClasses = new Vector<Class<? extends MoteType>>(); private Vector<Class<? extends MoteType>> moteTypeClasses = new Vector<Class<? extends MoteType>>();
@ -202,23 +202,23 @@ public class GUI {
frame.setJMenuBar(createMenuBar()); frame.setJMenuBar(createMenuBar());
} }
// Register default user platforms // Register default project directories
String defaultUserPlatforms = getExternalToolsSetting( String defaultProjectDirs = getExternalToolsSetting(
"DEFAULT_USERPLATFORMS", null); "DEFAULT_PROJECTDIRS", null);
if (defaultUserPlatforms != null) { if (defaultProjectDirs != null) {
String[] defaultUserPlatformsArr = defaultUserPlatforms.split(";"); String[] defaultProjectDirsArr = defaultProjectDirs.split(";");
if (defaultUserPlatformsArr.length > 0) { if (defaultProjectDirsArr.length > 0) {
for (String defaultUserPlatform : defaultUserPlatformsArr) { for (String defaultProjectDir : defaultProjectDirsArr) {
File userPlatform = new File(defaultUserPlatform); File projectDir = new File(defaultProjectDir);
if (userPlatform.exists() && userPlatform.isDirectory()) { if (projectDir.exists() && projectDir.isDirectory()) {
currentUserPlatforms.add(userPlatform); currentProjectDirs.add(projectDir);
} }
} }
} }
} }
// Load extendable parts (using current platform config) // Load extendable parts (using current project config)
reparsePlatformConfig(); reparseProjectConfig();
// Start all standard GUI plugins // Start all standard GUI plugins
for (Class<? extends Plugin> visPluginClass : pluginClasses) { for (Class<? extends Plugin> visPluginClass : pluginClasses) {
@ -511,8 +511,8 @@ public class GUI {
menuItem.addActionListener(guiEventHandler); menuItem.addActionListener(guiEventHandler);
menu.add(menuItem); menu.add(menuItem);
menuItem = new JMenuItem("Manage user platforms"); menuItem = new JMenuItem("Manage project directories");
menuItem.setActionCommand("manage platforms"); menuItem.setActionCommand("manage projects");
menuItem.addActionListener(guiEventHandler); menuItem.addActionListener(guiEventHandler);
menu.add(menuItem); menu.add(menuItem);
@ -572,8 +572,8 @@ public class GUI {
* *
* @param moteTypeID * @param moteTypeID
* Mote type ID (if null "mtype1" will be used) * Mote type ID (if null "mtype1" will be used)
* @param userPlatforms * @param projectDirs
* GUI user platforms * GUI project directories
* @param sensors * @param sensors
* Contiki sensors (if null sensors will be scanned for) * Contiki sensors (if null sensors will be scanned for)
* @param coreInterfaces * @param coreInterfaces
@ -592,13 +592,13 @@ public class GUI {
* @param simulationStartinge * @param simulationStartinge
* Simulation automatically started? * Simulation automatically started?
* @param filename * @param filename
* Main Contiki user process file * Main Contiki process file
* @param contikiPath * @param contikiPath
* Contiki path * Contiki path
* @return True if simulation was quickstarted correctly * @return True if simulation was quickstarted correctly
*/ */
private static boolean quickStartSimulation(String moteTypeID, private static boolean quickStartSimulation(String moteTypeID,
Vector<String> userPlatforms, Vector<String> sensors, Vector<String> projectDirs, Vector<String> sensors,
Vector<String> coreInterfaces, Vector<String> userProcesses, Vector<String> coreInterfaces, Vector<String> userProcesses,
boolean addAutostartProcesses, int numberOfNodes, double areaSideLength, boolean addAutostartProcesses, int numberOfNodes, double areaSideLength,
int delayTime, boolean simulationStarting, String filename, int delayTime, boolean simulationStarting, String filename,
@ -615,7 +615,7 @@ public class GUI {
JDesktopPane desktop = new JDesktopPane(); JDesktopPane desktop = new JDesktopPane();
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
GUI gui = new GUI(desktop); // loads external settings and creates initial GUI gui = new GUI(desktop); // loads external settings and creates initial
// platform config // project config
// Add menu bar // Add menu bar
frame.setSize(700, 700); frame.setSize(700, 700);
@ -630,21 +630,21 @@ public class GUI {
if (contikiPath != null) if (contikiPath != null)
setExternalToolsSetting("PATH_CONTIKI", contikiPath); setExternalToolsSetting("PATH_CONTIKI", contikiPath);
// Parse user platforms and create config // Parse project directories and create config
if (userPlatforms == null) { if (projectDirs == null) {
userPlatforms = new Vector<String>(); projectDirs = new Vector<String>();
userPlatforms.add("."); projectDirs.add(".");
} }
// XXX Should add user prop platforms as well here... // TODO Should add user prop projects as well here...
logger.info("> Reparsing user platforms and creating config"); logger.info("> Reparsing project directories and creating config");
for (String userPlatform : userPlatforms) { for (String projectDir : projectDirs) {
logger.info(">> Adding: " + userPlatform); logger.info(">> Adding: " + projectDir);
gui.currentUserPlatforms.add(new File(userPlatform)); gui.currentProjectDirs.add(new File(projectDir));
} }
boolean parsedPlatforms = gui.reparsePlatformConfig(); boolean parsedProjects = gui.reparseProjectConfig();
if (!parsedPlatforms) { if (!parsedProjects) {
logger.fatal(">> Error when parsing platforms, aborting"); logger.fatal(">> Error when parsing project directories, aborting");
return false; return false;
} }
@ -688,8 +688,8 @@ public class GUI {
logger.info(">> Searching main process file: " logger.info(">> Searching main process file: "
+ mainProcessFile.getAbsolutePath()); + mainProcessFile.getAbsolutePath());
boolean foundFile = false; boolean foundFile = false;
for (String userPlatform : userPlatforms) { for (String projectDir : projectDirs) {
mainProcessFile = new File(userPlatform, filename); mainProcessFile = new File(projectDir, filename);
logger.info(">> Searching main process file: " logger.info(">> Searching main process file: "
+ mainProcessFile.getAbsolutePath()); + mainProcessFile.getAbsolutePath());
if (mainProcessFile.exists()) { if (mainProcessFile.exists()) {
@ -707,22 +707,22 @@ public class GUI {
logger.info("> Setting up compilation arguments"); logger.info("> Setting up compilation arguments");
Vector<File> filesToCompile = new Vector<File>(); Vector<File> filesToCompile = new Vector<File>();
filesToCompile.add(mainProcessFile); // main process file filesToCompile.add(mainProcessFile); // main process file
for (String userPlatform : userPlatforms) for (String projectDir : projectDirs)
// user platforms // project directories
filesToCompile.add(new File(userPlatform)); filesToCompile.add(new File(projectDir));
String[] platformSources = // platform config sources String[] projectSources = // project config sources
gui.getPlatformConfig().getStringArrayValue(ContikiMoteType.class, gui.getProjectConfig().getStringArrayValue(ContikiMoteType.class,
"C_SOURCES"); "C_SOURCES");
for (String platformSource : platformSources) { for (String projectSource : projectSources) {
if (!platformSource.equals("")) { if (!projectSource.equals("")) {
File file = new File(platformSource); File file = new File(projectSource);
if (file.getParent() != null) { if (file.getParent() != null) {
// Find which user platform added this file // Find which project directory added this file
File userPlatform = gui.getPlatformConfig().getUserPlatformDefining( File projectDir = gui.getProjectConfig().getUserProjectDefining(
ContikiMoteType.class, "C_SOURCES", platformSource); ContikiMoteType.class, "C_SOURCES", projectSource);
if (userPlatform != null) { if (projectDir != null) {
// We found a user platform - Add directory // We found a project directory - Add it
filesToCompile.add(new File(userPlatform.getPath(), file filesToCompile.add(new File(projectDir.getPath(), file
.getParent())); .getParent()));
} }
} }
@ -736,10 +736,10 @@ public class GUI {
sensors = new Vector<String>(); sensors = new Vector<String>();
Vector<String[]> scannedSensorInfo = ContikiMoteTypeDialog Vector<String[]> scannedSensorInfo = ContikiMoteTypeDialog
.scanForSensors(contikiCoreDir); .scanForSensors(contikiCoreDir);
for (String userPlatform : userPlatforms) for (String projectDir : projectDirs)
// user platforms // project directories
scannedSensorInfo.addAll(ContikiMoteTypeDialog.scanForSensors(new File( scannedSensorInfo.addAll(ContikiMoteTypeDialog.scanForSensors(new File(
userPlatform))); projectDir)));
for (String[] sensorInfo : scannedSensorInfo) { for (String[] sensorInfo : scannedSensorInfo) {
// logger.info(">> Found and added: " + sensorInfo[1] + " (" + // logger.info(">> Found and added: " + sensorInfo[1] + " (" +
@ -754,10 +754,10 @@ public class GUI {
coreInterfaces = new Vector<String>(); coreInterfaces = new Vector<String>();
Vector<String[]> scannedCoreInterfaceInfo = ContikiMoteTypeDialog Vector<String[]> scannedCoreInterfaceInfo = ContikiMoteTypeDialog
.scanForInterfaces(contikiCoreDir); .scanForInterfaces(contikiCoreDir);
for (String userPlatform : userPlatforms) for (String projectDir : projectDirs)
// user platforms // project directories
scannedCoreInterfaceInfo.addAll(ContikiMoteTypeDialog scannedCoreInterfaceInfo.addAll(ContikiMoteTypeDialog
.scanForInterfaces(new File(userPlatform))); .scanForInterfaces(new File(projectDir)));
for (String[] coreInterfaceInfo : scannedCoreInterfaceInfo) { for (String[] coreInterfaceInfo : scannedCoreInterfaceInfo) {
// logger.info(">> Found and added: " + coreInterfaceInfo[1] + " (" + // logger.info(">> Found and added: " + coreInterfaceInfo[1] + " (" +
@ -768,7 +768,7 @@ public class GUI {
// Scan for mote interfaces // Scan for mote interfaces
logger.info("> Loading mote interfaces"); logger.info("> Loading mote interfaces");
String[] moteInterfaces = gui.getPlatformConfig().getStringArrayValue( String[] moteInterfaces = gui.getProjectConfig().getStringArrayValue(
ContikiMoteType.class, "MOTE_INTERFACES"); ContikiMoteType.class, "MOTE_INTERFACES");
Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>(); Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>();
for (String moteInterface : moteInterfaces) { for (String moteInterface : moteInterfaces) {
@ -791,10 +791,10 @@ public class GUI {
Vector<String> autostartProcesses = new Vector<String>(); Vector<String> autostartProcesses = new Vector<String>();
Vector<String[]> scannedProcessInfo = ContikiMoteTypeDialog Vector<String[]> scannedProcessInfo = ContikiMoteTypeDialog
.scanForProcesses(contikiCoreDir); .scanForProcesses(contikiCoreDir);
for (String userPlatform : userPlatforms) for (String projectDir : projectDirs)
// user platforms // project directories
scannedProcessInfo.addAll(ContikiMoteTypeDialog scannedProcessInfo.addAll(ContikiMoteTypeDialog
.scanForProcesses(new File(userPlatform))); .scanForProcesses(new File(projectDir)));
for (String[] processInfo : scannedProcessInfo) { for (String[] processInfo : scannedProcessInfo) {
if (processInfo[0].equals(mainProcessFile.getName())) { if (processInfo[0].equals(mainProcessFile.getName())) {
@ -885,9 +885,9 @@ public class GUI {
moteType.setDescription("Mote type: " + filename); moteType.setDescription("Mote type: " + filename);
moteType.setContikiBaseDir(contikiBaseDir.getPath()); moteType.setContikiBaseDir(contikiBaseDir.getPath());
moteType.setContikiCoreDir(contikiCoreDir.getPath()); moteType.setContikiCoreDir(contikiCoreDir.getPath());
moteType.setUserPlatformDirs(new Vector<File>()); moteType.setProjectDirs(new Vector<File>());
moteType.setCompilationFiles(filesToCompile); moteType.setCompilationFiles(filesToCompile);
moteType.setConfig(gui.getPlatformConfig()); moteType.setConfig(gui.getProjectConfig());
moteType.setProcesses(userProcesses); moteType.setProcesses(userProcesses);
moteType.setSensors(sensors); moteType.setSensors(sensors);
moteType.setCoreInterfaces(coreInterfaces); moteType.setCoreInterfaces(coreInterfaces);
@ -902,7 +902,7 @@ public class GUI {
simulation.setTickTime(1); simulation.setTickTime(1);
String radioMediumClassName = null; String radioMediumClassName = null;
try { try {
radioMediumClassName = gui.getPlatformConfig().getStringArrayValue( radioMediumClassName = gui.getProjectConfig().getStringArrayValue(
GUI.class, "RADIOMEDIUMS")[0]; GUI.class, "RADIOMEDIUMS")[0];
Class<? extends RadioMedium> radioMediumClass = gui.tryLoadClass(gui, Class<? extends RadioMedium> radioMediumClass = gui.tryLoadClass(gui,
RadioMedium.class, radioMediumClassName); RadioMedium.class, radioMediumClassName);
@ -968,7 +968,7 @@ public class GUI {
return true; return true;
} }
// // PLATFORM CONFIG AND EXTENDABLE PARTS METHODS //// //// PROJECT CONFIG AND EXTENDABLE PARTS METHODS ////
/** /**
* Register new mote type class. * Register new mote type class.
@ -1104,17 +1104,17 @@ public class GUI {
} }
/** /**
* Builds new platform configuration using current user platforms settings. * Builds new project configuration using current project directories settings.
* Reregisters mote types, plugins, IP distributors, positioners and radio * Reregisters mote types, plugins, IP distributors, positioners and radio
* mediums. This method may still return true even if all classes could not be * mediums. This method may still return true even if all classes could not be
* registered, but always returns false if all user platform configuration * registered, but always returns false if all project directory configuration
* files were not parsed correctly. * files were not parsed correctly.
* *
* Any registered temporary plugins will be saved and reregistered. * Any registered temporary plugins will be saved and reregistered.
* *
* @return True if external configuration files were found and parsed OK * @return True if external configuration files were found and parsed OK
*/ */
public boolean reparsePlatformConfig() { public boolean reparseProjectConfig() {
// Backup temporary plugins // Backup temporary plugins
Vector<Class<? extends Plugin>> oldTempPlugins = (Vector<Class<? extends Plugin>>) pluginClassesTemporary Vector<Class<? extends Plugin>> oldTempPlugins = (Vector<Class<? extends Plugin>>) pluginClassesTemporary
.clone(); .clone();
@ -1128,42 +1128,38 @@ public class GUI {
try { try {
// Read default configuration // Read default configuration
platformConfig = new PlatformConfig(true); projectConfig = new ProjectConfig(true);
// logger.info("Loading default platform configuration: " +
// PLATFORM_DEFAULT_CONFIG_FILENAME);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logger.fatal("Could not find default platform config file: " logger.fatal("Could not find default project config file: "
+ PLATFORM_DEFAULT_CONFIG_FILENAME); + PROJECT_DEFAULT_CONFIG_FILENAME);
return false; return false;
} catch (IOException e) { } catch (IOException e) {
logger.fatal("Error when reading default platform config file: " logger.fatal("Error when reading default project config file: "
+ PLATFORM_DEFAULT_CONFIG_FILENAME); + PROJECT_DEFAULT_CONFIG_FILENAME);
return false; return false;
} }
// Append user platform configurations // Append project directory configurations
for (File userPlatform : currentUserPlatforms) { for (File projectDir : currentProjectDirs) {
try { try {
// Append config to general config // Append config to general config
// logger.info("Appending user platform configuration: " + projectConfig.appendProjectDir(projectDir);
// userPlatform);
platformConfig.appendUserPlatform(userPlatform);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
logger.fatal("Could not find platform config file: " + userPlatform); logger.fatal("Could not find project config file: " + projectDir);
return false; return false;
} catch (IOException e) { } catch (IOException e) {
logger logger
.fatal("Error when reading platform config file: " + userPlatform); .fatal("Error when reading project config file: " + projectDir);
return false; return false;
} }
} }
// Create class loader // Create class loader
userPlatformClassLoader = createClassLoader(currentUserPlatforms); projectDirClassLoader = createClassLoader(currentProjectDirs);
// Register mote types // Register mote types
String[] moteTypeClassNames = platformConfig.getStringArrayValue(GUI.class, String[] moteTypeClassNames = projectConfig.getStringArrayValue(GUI.class,
"MOTETYPES"); "MOTETYPES");
if (moteTypeClassNames != null) { if (moteTypeClassNames != null) {
for (String moteTypeClassName : moteTypeClassNames) { for (String moteTypeClassName : moteTypeClassNames) {
@ -1183,7 +1179,7 @@ public class GUI {
registerPlugin(SimControl.class, false); // Not in menu registerPlugin(SimControl.class, false); // Not in menu
registerPlugin(SimInformation.class, false); // Not in menu registerPlugin(SimInformation.class, false); // Not in menu
registerPlugin(MoteTypeInformation.class, false); // Not in menu registerPlugin(MoteTypeInformation.class, false); // Not in menu
String[] pluginClassNames = platformConfig.getStringArrayValue(GUI.class, String[] pluginClassNames = projectConfig.getStringArrayValue(GUI.class,
"PLUGINS"); "PLUGINS");
if (pluginClassNames != null) { if (pluginClassNames != null) {
for (String pluginClassName : pluginClassNames) { for (String pluginClassName : pluginClassNames) {
@ -1212,7 +1208,7 @@ public class GUI {
} }
// Register IP distributors // Register IP distributors
String[] ipDistClassNames = platformConfig.getStringArrayValue(GUI.class, String[] ipDistClassNames = projectConfig.getStringArrayValue(GUI.class,
"IP_DISTRIBUTORS"); "IP_DISTRIBUTORS");
if (ipDistClassNames != null) { if (ipDistClassNames != null) {
for (String ipDistClassName : ipDistClassNames) { for (String ipDistClassName : ipDistClassNames) {
@ -1230,7 +1226,7 @@ public class GUI {
} }
// Register positioners // Register positioners
String[] positionerClassNames = platformConfig.getStringArrayValue( String[] positionerClassNames = projectConfig.getStringArrayValue(
GUI.class, "POSITIONERS"); GUI.class, "POSITIONERS");
if (positionerClassNames != null) { if (positionerClassNames != null) {
for (String positionerClassName : positionerClassNames) { for (String positionerClassName : positionerClassNames) {
@ -1248,7 +1244,7 @@ public class GUI {
} }
// Register radio mediums // Register radio mediums
String[] radioMediumsClassNames = platformConfig.getStringArrayValue( String[] radioMediumsClassNames = projectConfig.getStringArrayValue(
GUI.class, "RADIOMEDIUMS"); GUI.class, "RADIOMEDIUMS");
if (radioMediumsClassNames != null) { if (radioMediumsClassNames != null) {
for (String radioMediumClassName : radioMediumsClassNames) { for (String radioMediumClassName : radioMediumsClassNames) {
@ -1269,21 +1265,21 @@ public class GUI {
} }
/** /**
* Returns the current platform configuration common to the entire simulator. * Returns the current project configuration common to the entire simulator.
* *
* @return Current platform configuration * @return Current project configuration
*/ */
public PlatformConfig getPlatformConfig() { public ProjectConfig getProjectConfig() {
return platformConfig; return projectConfig;
} }
/** /**
* Returns the current user platforms common to the entire simulator. * Returns the current project directories common to the entire simulator.
* *
* @return Current user platforms. * @return Current project directories.
*/ */
public Vector<File> getUserPlatforms() { public Vector<File> getProjectDirs() {
return currentUserPlatforms; return currentProjectDirs;
} }
// // PLUGIN METHODS //// // // PLUGIN METHODS ////
@ -2322,12 +2318,12 @@ public class GUI {
Object[] plugins = startedPlugins.toArray(); Object[] plugins = startedPlugins.toArray();
for (Object plugin : plugins) for (Object plugin : plugins)
removePlugin((Plugin) plugin, false); removePlugin((Plugin) plugin, false);
} else if (e.getActionCommand().equals("manage platforms")) { } else if (e.getActionCommand().equals("manage projects")) {
Vector<File> newPlatforms = UserPlatformsDialog.showDialog(frame, Vector<File> newProjects = ProjectDirectoriesDialog.showDialog(frame,
currentUserPlatforms, null); currentProjectDirs, null);
if (newPlatforms != null) { if (newProjects != null) {
currentUserPlatforms = newPlatforms; currentProjectDirs = newProjects;
reparsePlatformConfig(); reparseProjectConfig();
} }
} else if (e.getActionCommand().equals("start plugin")) { } else if (e.getActionCommand().equals("start plugin")) {
Class<? extends VisPlugin> pluginClass = (Class<? extends VisPlugin>) ((JMenuItem) e Class<? extends VisPlugin> pluginClass = (Class<? extends VisPlugin>) ((JMenuItem) e
@ -2369,8 +2365,8 @@ public class GUI {
} }
try { try {
if (userPlatformClassLoader != null) { if (projectDirClassLoader != null) {
return userPlatformClassLoader.loadClass(className).asSubclass( return projectDirClassLoader.loadClass(className).asSubclass(
classType); classType);
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
@ -2379,57 +2375,57 @@ public class GUI {
return null; return null;
} }
public ClassLoader createUserPlatformClassLoader(Vector<File> platformsList) { public ClassLoader createProjectDirClassLoader(Vector<File> projectsDirs) {
if (userPlatformClassLoader == null) { if (projectDirClassLoader == null) {
reparsePlatformConfig(); reparseProjectConfig();
} }
return createClassLoader(userPlatformClassLoader, platformsList); return createClassLoader(projectDirClassLoader, projectsDirs);
} }
private ClassLoader createClassLoader(Vector<File> currentUserPlatforms) { private ClassLoader createClassLoader(Vector<File> currentProjectDirs) {
return createClassLoader(ClassLoader.getSystemClassLoader(), return createClassLoader(ClassLoader.getSystemClassLoader(),
currentUserPlatforms); currentProjectDirs);
} }
private File findJarFile(File platformPath, String jarfile) { private File findJarFile(File projectDir, String jarfile) {
File fp = new File(jarfile); File fp = new File(jarfile);
if (!fp.exists()) { if (!fp.exists()) {
fp = new File(platformPath, jarfile); fp = new File(projectDir, jarfile);
} }
if (!fp.exists()) { if (!fp.exists()) {
fp = new File(platformPath, "java/" + jarfile); fp = new File(projectDir, "java/" + jarfile);
} }
if (!fp.exists()) { if (!fp.exists()) {
fp = new File(platformPath, "java/lib/" + jarfile); fp = new File(projectDir, "java/lib/" + jarfile);
} }
if (!fp.exists()) { if (!fp.exists()) {
fp = new File(platformPath, "lib/" + jarfile); fp = new File(projectDir, "lib/" + jarfile);
} }
return fp.exists() ? fp : null; return fp.exists() ? fp : null;
} }
private ClassLoader createClassLoader(ClassLoader parent, private ClassLoader createClassLoader(ClassLoader parent,
Vector<File> platformsList) { Vector<File> projectDirs) {
if (platformsList == null || platformsList.isEmpty()) { if (projectDirs == null || projectDirs.isEmpty()) {
return parent; return parent;
} }
// Combine class loader from all user platforms (including any // Combine class loader from all project directories (including any
// specified JAR files) // specified JAR files)
ArrayList<URL> urls = new ArrayList<URL>(); ArrayList<URL> urls = new ArrayList<URL>();
for (int j = platformsList.size() - 1; j >= 0; j--) { for (int j = projectDirs.size() - 1; j >= 0; j--) {
File userPlatform = platformsList.get(j); File projectDir = projectDirs.get(j);
try { try {
urls.add((new File(userPlatform, "java")).toURL()); urls.add((new File(projectDir, "java")).toURL());
// Read configuration to check if any JAR files should be loaded // Read configuration to check if any JAR files should be loaded
PlatformConfig userPlatformConfig = new PlatformConfig(false); ProjectConfig projectConfig = new ProjectConfig(false);
userPlatformConfig.appendUserPlatform(userPlatform); projectConfig.appendProjectDir(projectDir);
String[] platformJarFiles = userPlatformConfig.getStringArrayValue( String[] projectJarFiles = projectConfig.getStringArrayValue(
GUI.class, "JARFILES"); GUI.class, "JARFILES");
if (platformJarFiles != null && platformJarFiles.length > 0) { if (projectJarFiles != null && projectJarFiles.length > 0) {
for (String jarfile : platformJarFiles) { for (String jarfile : projectJarFiles) {
File jarpath = findJarFile(userPlatform, jarfile); File jarpath = findJarFile(projectDir, jarfile);
if (jarpath == null) { if (jarpath == null) {
throw new FileNotFoundException(jarfile); throw new FileNotFoundException(jarfile);
} }
@ -2438,7 +2434,7 @@ public class GUI {
} }
} catch (Exception e) { } catch (Exception e) {
logger.fatal("Error when trying to read JAR-file in " + userPlatform logger.fatal("Error when trying to read JAR-file in " + projectDir
+ ": " + e); + ": " + e);
} }
} }
@ -2497,7 +2493,7 @@ public class GUI {
String filename = args[0].substring("-quickstart=".length()); String filename = args[0].substring("-quickstart=".length());
String moteTypeID = "mtype1"; String moteTypeID = "mtype1";
Vector<String> userPlatforms = null; Vector<String> projectDirs = null;
Vector<String> sensors = null; Vector<String> sensors = null;
Vector<String> coreInterfaces = null; Vector<String> coreInterfaces = null;
Vector<String> userProcesses = null; Vector<String> userProcesses = null;
@ -2514,12 +2510,12 @@ public class GUI {
if (args[i].startsWith("-id=")) { if (args[i].startsWith("-id=")) {
moteTypeID = args[i].substring("-id=".length()); moteTypeID = args[i].substring("-id=".length());
} else if (args[i].startsWith("-platforms=")) { } else if (args[i].startsWith("-projects=")) {
String arg = args[i].substring("-platforms=".length()); String arg = args[i].substring("-projects=".length());
String[] argArray = arg.split(","); String[] argArray = arg.split(",");
userPlatforms = new Vector<String>(); projectDirs = new Vector<String>();
for (String argValue : argArray) for (String argValue : argArray)
userPlatforms.add(argValue); projectDirs.add(argValue);
} else if (args[i].startsWith("-sensors=")) { } else if (args[i].startsWith("-sensors=")) {
String arg = args[i].substring("-sensors=".length()); String arg = args[i].substring("-sensors=".length());
@ -2570,7 +2566,7 @@ public class GUI {
} }
} }
boolean ok = quickStartSimulation(moteTypeID, userPlatforms, sensors, boolean ok = quickStartSimulation(moteTypeID, projectDirs, sensors,
coreInterfaces, userProcesses, addAutostartProcesses, numberOfNodes, coreInterfaces, userProcesses, addAutostartProcesses, numberOfNodes,
areaSideLength, delayTime, startSimulation, filename, contikiPath); areaSideLength, delayTime, startSimulation, filename, contikiPath);
if (!ok) if (!ok)

View file

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: MoteType.java,v 1.3 2007/01/10 14:57:42 fros4943 Exp $ * $Id: MoteType.java,v 1.4 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -86,11 +86,11 @@ public interface MoteType {
public JPanel getTypeVisualizer(); public JPanel getTypeVisualizer();
/** /**
* Returns this mote type's platform configuration. * Returns this mote type's project configuration.
* *
* @return Platform configuration * @return Project configuration
*/ */
public PlatformConfig getConfig(); public ProjectConfig getConfig();
/** /**
* Generates a mote of this mote type. * Generates a mote of this mote type.

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: PlatformConfig.java,v 1.5 2007/01/16 10:32:55 fros4943 Exp $ * $Id: ProjectConfig.java,v 1.1 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -36,13 +36,13 @@ import java.util.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* A platform configuration may hold the configuration for one or several user * A project configuration may hold the configuration for one or several project
* platforms as well as a general simulator configuration. * directories as well as a general simulator configuration.
* *
* The configuration for a user platform may for example consist of which * The configuration for a project directory may for example consist of which
* plugins, interfaces and processes that the specific platform supplies. Each * plugins, interfaces and processes that the specific project directory supplies.
* user platform configuration is read from the property file cooja.config, a * Each project directory configuration is read from the property file cooja.config, a
* file which is required in each user platform. * file which is required in each project directory.
* *
* Values can be fetched as String, Boolean, Integer, Double or String array. * Values can be fetched as String, Boolean, Integer, Double or String array.
* *
@ -67,8 +67,8 @@ import org.apache.log4j.Logger;
* *
* will result in the final value "a b c d e". * will result in the final value "a b c d e".
* *
* The simulator will hold a merged platform configuration, depending on which * The simulator will hold a merged project configuration, depending on which
* user platforms are used. Additionally. each mote type may also have a * project directories are used. Additionally. each mote type may also have a
* configuration of its own, that differs from the general simulator * configuration of its own, that differs from the general simulator
* configuration. * configuration.
* *
@ -83,14 +83,14 @@ import org.apache.log4j.Logger;
* *
* @author Fredrik Osterlind * @author Fredrik Osterlind
*/ */
public class PlatformConfig { public class ProjectConfig {
private static Logger logger = Logger.getLogger(PlatformConfig.class); private static Logger logger = Logger.getLogger(ProjectConfig.class);
private Properties myConfig = null; private Properties myConfig = null;
private Vector<File> myUserPlatformHistory = null; private Vector<File> myProjectDirHistory = null;
/** /**
* Creates new platform configuration. * Creates new project configuration.
* *
* @param useDefault * @param useDefault
* If true the default configuration will be loaded * If true the default configuration will be loaded
@ -99,15 +99,15 @@ public class PlatformConfig {
* @throws IOException * @throws IOException
* Stream read error * Stream read error
*/ */
public PlatformConfig(boolean useDefault) throws IOException, public ProjectConfig(boolean useDefault) throws IOException,
FileNotFoundException { FileNotFoundException {
// Create empty configuration // Create empty configuration
myConfig = new Properties(); myConfig = new Properties();
myUserPlatformHistory = new Vector<File>(); myProjectDirHistory = new Vector<File>();
if (useDefault) { if (useDefault) {
InputStream input = GUI.class InputStream input = GUI.class
.getResourceAsStream(GUI.PLATFORM_DEFAULT_CONFIG_FILENAME); .getResourceAsStream(GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
if (input != null) { if (input != null) {
try { try {
appendConfigStream(input); appendConfigStream(input);
@ -115,37 +115,37 @@ public class PlatformConfig {
input.close(); input.close();
} }
} else { } else {
throw new FileNotFoundException(GUI.PLATFORM_DEFAULT_CONFIG_FILENAME); throw new FileNotFoundException(GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
} }
} }
} }
/** /**
* Appends the given user platform's config file. Thus method also saved a * Appends the given project directory's config file. This method also saves a
* local history of which user platforms has been loaded. * local history of which project directories has been loaded.
* *
* @param userPlatform * @param projectDir
* User platform * Project directory
* @return True if loaded OK * @return True if loaded OK
* @throws FileNotFoundException * @throws FileNotFoundException
* If file was not found * If file was not found
* @throws IOException * @throws IOException
* Stream read error * Stream read error
*/ */
public boolean appendUserPlatform(File userPlatform) public boolean appendProjectDir(File projectDir)
throws FileNotFoundException, IOException { throws FileNotFoundException, IOException {
File userPlatformConfig = new File(userPlatform.getPath(), File projectConfig = new File(projectDir.getPath(),
GUI.PLATFORM_CONFIG_FILENAME); GUI.PROJECT_CONFIG_FILENAME);
myUserPlatformHistory.add(userPlatform); myProjectDirHistory.add(projectDir);
return appendConfigFile(userPlatformConfig); return appendConfigFile(projectConfig);
} }
/** /**
* Returns the user platform earlier appended to this configuration that * Returns the project directory earlier appended to this configuration that
* defined the given key. If the key is of an array format and the given array * defined the given key. If the key is of an array format and the given array
* element is non-null, then the user platform that added this element will be * element is non-null, then the project directory that added this element will be
* returned instead. If no such user platform can be found null is returned * returned instead. If no such project directory can be found null is returned
* instead. * instead.
* *
* @param callingClass * @param callingClass
@ -154,9 +154,9 @@ public class PlatformConfig {
* Key * Key
* @param arrayElement * @param arrayElement
* Value or array element * Value or array element
* @return User platform defining arguments or null * @return Project directory defining arguments or null
*/ */
public File getUserPlatformDefining(Class callingClass, String key, String arrayElement) { public File getUserProjectDefining(Class callingClass, String key, String arrayElement) {
// Check that key really exists in current config // Check that key really exists in current config
if (getStringValue(callingClass, key, null) == null) { if (getStringValue(callingClass, key, null) == null) {
@ -176,30 +176,30 @@ public class PlatformConfig {
} }
} }
// Search in all user platform in reversed order // Search in all project directory in reversed order
try { try {
PlatformConfig remadeConfig = new PlatformConfig(false); ProjectConfig remadeConfig = new ProjectConfig(false);
for (int i=myUserPlatformHistory.size()-1; i >= 0; i--) { for (int i=myProjectDirHistory.size()-1; i >= 0; i--) {
remadeConfig.appendUserPlatform(myUserPlatformHistory.get(i)); remadeConfig.appendProjectDir(myProjectDirHistory.get(i));
if (arrayElement != null) { if (arrayElement != null) {
// Look for array // Look for array
String[] array = remadeConfig.getStringArrayValue(callingClass, key); String[] array = remadeConfig.getStringArrayValue(callingClass, key);
for (int c=0; c < array.length; c++) { for (int c=0; c < array.length; c++) {
if (array[c].equals(arrayElement)) if (array[c].equals(arrayElement))
return myUserPlatformHistory.get(i); return myProjectDirHistory.get(i);
} }
} else { } else {
// Look for key // Look for key
if (remadeConfig.getStringValue(callingClass, key, null) != null) { if (remadeConfig.getStringValue(callingClass, key, null) != null) {
return myUserPlatformHistory.get(i); return myProjectDirHistory.get(i);
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.fatal("Exception when searching in user platform history: " + e); logger.fatal("Exception when searching in project directory history: " + e);
return null; return null;
} }
@ -211,7 +211,7 @@ public class PlatformConfig {
* If a property already exists it will be overwritten, unless the new value * If a property already exists it will be overwritten, unless the new value
* begins with a '+' in which case the old value will be extended. * begins with a '+' in which case the old value will be extended.
* *
* WARNING! The user platform history will not be saved if this method is * WARNING! The project directory history will not be saved if this method is
* called, instead the appendUserPlatform method should be used. * called, instead the appendUserPlatform method should be used.
* *
* @param propertyFile * @param propertyFile
@ -234,7 +234,7 @@ public class PlatformConfig {
* the new value begins with a '+' in which case the old value will be * the new value begins with a '+' in which case the old value will be
* extended. * extended.
* *
* WARNING! The user platform history will not be saved if this method is * WARNING! The project directory history will not be saved if this method is
* called, instead the appendUserPlatform method should be used. * called, instead the appendUserPlatform method should be used.
* *
* @param configFileStream * @param configFileStream
@ -480,11 +480,11 @@ public class PlatformConfig {
return getBooleanValue(callingClass, id, false); return getBooleanValue(callingClass, id, false);
} }
public PlatformConfig clone() { public ProjectConfig clone() {
try { try {
PlatformConfig clone = new PlatformConfig(false); ProjectConfig clone = new ProjectConfig(false);
clone.myConfig = (Properties) this.myConfig.clone(); clone.myConfig = (Properties) this.myConfig.clone();
clone.myUserPlatformHistory = (Vector<File>) this.myUserPlatformHistory.clone(); clone.myProjectDirHistory = (Vector<File>) this.myProjectDirHistory.clone();
return clone; return clone;
} catch (Exception e) { } catch (Exception e) {
return null; return null;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: VisPlugin.java,v 1.4 2007/01/10 14:57:42 fros4943 Exp $ * $Id: VisPlugin.java,v 1.5 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -42,8 +42,8 @@ import org.jdom.Element;
* visualizers. By extending JInternalFrame, the visual apperence is decided by * visualizers. By extending JInternalFrame, the visual apperence is decided by
* the plugin itself. * the plugin itself.
* *
* To add a new plugin to the simulator environment either add it via a user * To add a new plugin to the simulator environment either add it via a project
* platform or by altering the standard configuration files. * directory or by altering the standard configuration files.
* *
* For example how to implement a plugin see plugins SimControl or Visualizer2D. * For example how to implement a plugin see plugins SimControl or Visualizer2D.
* *

View file

@ -26,20 +26,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ContikiMoteType.java,v 1.7 2007/01/09 10:09:19 fros4943 Exp $ * $Id: ContikiMoteType.java,v 1.8 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.contikimote; package se.sics.cooja.contikimote;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.io.*; import java.io.*;
import java.security.*; import java.security.*;
import java.util.*; import java.util.*;
import java.util.regex.*; import java.util.regex.*;
import javax.swing.*; import javax.swing.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jdom.Element; import org.jdom.Element;
@ -52,7 +50,7 @@ import se.sics.cooja.*;
* <p> * <p>
* This type also contains information about which processes, sensors and core * This type also contains information about which processes, sensors and core
* interfaces a mote of this type has, as well as where the Contiki OS, COOJA * interfaces a mote of this type has, as well as where the Contiki OS, COOJA
* core files and an optional user platform are located. * core files and optional mote type specific project directories are located.
* <p> * <p>
* All core communication with the Contiki mote should be via this class. When a * All core communication with the Contiki mote should be via this class. When a
* mote type is created it allocates a CoreComm to be used with this type, and * mote type is created it allocates a CoreComm to be used with this type, and
@ -108,7 +106,7 @@ public class ContikiMoteType implements MoteType {
private String description = null; private String description = null;
private String contikiBaseDir = null; private String contikiBaseDir = null;
private String contikiCoreDir = null; private String contikiCoreDir = null;
private Vector<File> userPlatformDirs = null; private Vector<File> projectDirs = null;
private Vector<File> compilationFiles = null; private Vector<File> compilationFiles = null;
private Vector<String> processes = null; private Vector<String> processes = null;
private Vector<String> sensors = null; private Vector<String> sensors = null;
@ -120,7 +118,7 @@ public class ContikiMoteType implements MoteType {
private Simulation mySimulation = null; private Simulation mySimulation = null;
// Type specific class configuration // Type specific class configuration
private PlatformConfig myConfig = null; private ProjectConfig myConfig = null;
// Core communication variables // Core communication variables
private String libraryClassName = null; private String libraryClassName = null;
@ -834,36 +832,36 @@ public class ContikiMoteType implements MoteType {
} }
/** /**
* Returns user platform directories * Returns mote type specific project directories
* *
* @return User platform directories * @return Project directories
*/ */
public Vector<File> getUserPlatformDirs() { public Vector<File> getProjectDirs() {
return userPlatformDirs; return projectDirs;
} }
/** /**
* Sets user platform directories. * Sets mote type specific project directories.
* *
* @param dirs * @param dirs
* New user platform directories * New project directories
*/ */
public void setUserPlatformDirs(Vector<File> dirs) { public void setProjectDirs(Vector<File> dirs) {
userPlatformDirs = dirs; projectDirs = dirs;
} }
public PlatformConfig getConfig() { public ProjectConfig getConfig() {
return myConfig; return myConfig;
} }
/** /**
* Sets mote type platform configuration. This may differ from the general * Sets mote type project configuration. This may differ from the general
* simulator platform configuration. * simulator project configuration.
* *
* @param moteTypeConfig * @param moteTypeConfig
* Platform configuration * Project configuration
*/ */
public void setConfig(PlatformConfig moteTypeConfig) { public void setConfig(ProjectConfig moteTypeConfig) {
myConfig = moteTypeConfig; myConfig = moteTypeConfig;
} }
@ -1100,10 +1098,10 @@ public class ContikiMoteType implements MoteType {
element.setText(getContikiCoreDir()); element.setText(getContikiCoreDir());
config.add(element); config.add(element);
// User platform directory // User project directory
for (File userPlatform: userPlatformDirs) { for (File projectDir: projectDirs) {
element = new Element("userplatformdir"); element = new Element("projectdir");
element.setText(userPlatform.getPath()); element.setText(projectDir.getPath());
config.add(element); config.add(element);
} }
@ -1152,7 +1150,7 @@ public class ContikiMoteType implements MoteType {
public boolean setConfigXML(Simulation simulation, public boolean setConfigXML(Simulation simulation,
Collection<Element> configXML, boolean visAvailable) { Collection<Element> configXML, boolean visAvailable) {
userPlatformDirs = new Vector<File>(); projectDirs = new Vector<File>();
compilationFiles = new Vector<File>(); compilationFiles = new Vector<File>();
processes = new Vector<String>(); processes = new Vector<String>();
sensors = new Vector<String>(); sensors = new Vector<String>();
@ -1171,8 +1169,8 @@ public class ContikiMoteType implements MoteType {
contikiBaseDir = element.getText(); contikiBaseDir = element.getText();
} else if (name.equals("contikicoredir")) { } else if (name.equals("contikicoredir")) {
contikiCoreDir = element.getText(); contikiCoreDir = element.getText();
} else if (name.equals("userplatformdir")) { } else if (name.equals("projectdir")) {
userPlatformDirs.add(new File(element.getText())); projectDirs.add(new File(element.getText()));
} else if (name.equals("compilefile")) { } else if (name.equals("compilefile")) {
compilationFiles.add(new File(element.getText())); compilationFiles.add(new File(element.getText()));
} else if (name.equals("process")) { } else if (name.equals("process")) {
@ -1197,14 +1195,14 @@ public class ContikiMoteType implements MoteType {
} }
// Create class specific configuration // Create class specific configuration
myConfig = simulation.getGUI().getPlatformConfig().clone(); myConfig = simulation.getGUI().getProjectConfig().clone();
// Merge with all user platform configs (if any) // Merge with all project directory configs (if any)
for (File userPlatform : userPlatformDirs) { for (File projectDir : projectDirs) {
try { try {
myConfig.appendUserPlatform(userPlatform); myConfig.appendProjectDir(projectDir);
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("Error when parsing user platform config: " + ex); logger.fatal("Error when parsing project directory config: " + ex);
return false; return false;
} }
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ContikiMoteTypeDialog.java,v 1.21 2007/03/23 11:16:53 fros4943 Exp $ * $Id: ContikiMoteTypeDialog.java,v 1.22 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.contikimote; package se.sics.cooja.contikimote;
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
import se.sics.cooja.*; import se.sics.cooja.*;
import se.sics.cooja.dialogs.MessageList; import se.sics.cooja.dialogs.MessageList;
import se.sics.cooja.dialogs.UserPlatformsDialog; import se.sics.cooja.dialogs.ProjectDirectoriesDialog;
/** /**
* A dialog for configuring Contiki mote types and compiling Contiki mote type * A dialog for configuring Contiki mote types and compiling Contiki mote type
@ -79,7 +79,7 @@ public class ContikiMoteTypeDialog extends JDialog {
private ContikiMoteType myMoteType = null; private ContikiMoteType myMoteType = null;
private JTextField textID, textOutputFiles, textDescription, textContikiDir, private JTextField textID, textOutputFiles, textDescription, textContikiDir,
textCoreDir, textUserPlatforms; textCoreDir, textProjectDirs;
private JButton createButton, testButton, rescanButton; private JButton createButton, testButton, rescanButton;
private JCheckBox symbolsCheckBox; private JCheckBox symbolsCheckBox;
@ -96,10 +96,8 @@ public class ContikiMoteTypeDialog extends JDialog {
private boolean compilationSucceded = false; // Did compilation succeed? private boolean compilationSucceded = false; // Did compilation succeed?
private boolean libraryCreatedOK = false; // Was a library created? private boolean libraryCreatedOK = false; // Was a library created?
private PlatformConfig newMoteTypeConfig = null; // Mote type platform config private ProjectConfig newMoteTypeConfig = null; // Mote type project config
private Vector<File> moteTypeUserPlatforms = new Vector<File>(); // Mote type private Vector<File> moteTypeProjectDirs = new Vector<File>(); // Mote type project directories
// user
// platforms
private Vector<File> compilationFiles = null; private Vector<File> compilationFiles = null;
@ -210,18 +208,18 @@ public class ContikiMoteTypeDialog extends JDialog {
myDialog.textCoreDir.setText(moteTypeToConfigure.getContikiCoreDir()); myDialog.textCoreDir.setText(moteTypeToConfigure.getContikiCoreDir());
} }
// Set preset user platform directories of mote type // Set preset project directories of mote type
if (moteTypeToConfigure.getUserPlatformDirs() != null) { if (moteTypeToConfigure.getProjectDirs() != null) {
myDialog.moteTypeUserPlatforms = moteTypeToConfigure myDialog.moteTypeProjectDirs = moteTypeToConfigure
.getUserPlatformDirs(); .getProjectDirs();
String userPlatformText = null; String projectText = null;
for (File userPlatform : myDialog.moteTypeUserPlatforms) { for (File projectDir : myDialog.moteTypeProjectDirs) {
if (userPlatformText == null) if (projectText == null)
userPlatformText = "'" + userPlatform.getPath() + "'"; projectText = "'" + projectDir.getPath() + "'";
else else
userPlatformText += ", '" + userPlatform.getPath() + "'"; projectText += ", '" + projectDir.getPath() + "'";
} }
myDialog.textUserPlatforms.setText(userPlatformText); myDialog.textProjectDirs.setText(projectText);
} }
// Set preset "use symbols" // Set preset "use symbols"
@ -580,21 +578,21 @@ public class ContikiMoteTypeDialog extends JDialog {
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); mainPane.add(Box.createRigidArea(new Dimension(0, 5)));
// COOJA user platform dir // COOJA project directory
smallPane = new JPanel(); smallPane = new JPanel();
smallPane.setAlignmentX(Component.LEFT_ALIGNMENT); smallPane.setAlignmentX(Component.LEFT_ALIGNMENT);
smallPane.setLayout(new BoxLayout(smallPane, BoxLayout.X_AXIS)); smallPane.setLayout(new BoxLayout(smallPane, BoxLayout.X_AXIS));
label = new JLabel("Mote type user platforms"); label = new JLabel("Mote type project directories");
label.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT)); label.setPreferredSize(new Dimension(LABEL_WIDTH, LABEL_HEIGHT));
textField = new JTextField(); textField = new JTextField();
textField.setText(""); textField.setText("");
textField.setEditable(false); textField.setEditable(false);
textUserPlatforms = textField; textProjectDirs = textField;
label.setLabelFor(textField); label.setLabelFor(textField);
button = new JButton("Manage"); button = new JButton("Manage");
button.setActionCommand("manageuserplatforms"); button.setActionCommand("manageprojectdirs");
button.addActionListener(myEventHandler); button.addActionListener(myEventHandler);
smallPane.add(label); smallPane.add(label);
@ -1049,24 +1047,24 @@ public class ContikiMoteTypeDialog extends JDialog {
compilationThread = new Thread(new Runnable() { compilationThread = new Thread(new Runnable() {
public void run() { public void run() {
// Add all user platform directories // Add all project directories
compilationFiles = (Vector<File>) myGUI compilationFiles = (Vector<File>) myGUI
.getUserPlatforms().clone(); .getProjectDirs().clone();
compilationFiles.addAll(moteTypeUserPlatforms); compilationFiles.addAll(moteTypeProjectDirs);
// Add source files from platform configs // Add source files from project configs
String[] projectSourceFiles = newMoteTypeConfig.getStringArrayValue( String[] projectSourceFiles = newMoteTypeConfig.getStringArrayValue(
ContikiMoteType.class, "C_SOURCES"); ContikiMoteType.class, "C_SOURCES");
for (String projectSourceFile : projectSourceFiles) { for (String projectSourceFile : projectSourceFiles) {
if (!projectSourceFile.equals("")) { if (!projectSourceFile.equals("")) {
File file = new File(projectSourceFile); File file = new File(projectSourceFile);
if (file.getParent() != null) { if (file.getParent() != null) {
// Find which user platform added this file // Find which project directory added this file
File userPlatform = newMoteTypeConfig.getUserPlatformDefining( File projectDir = newMoteTypeConfig.getUserProjectDefining(
ContikiMoteType.class, "C_SOURCES", projectSourceFile); ContikiMoteType.class, "C_SOURCES", projectSourceFile);
if (userPlatform != null) { if (projectDir != null) {
// We found a user platform - Add directory // We found a project directory; add it to path
compilationFiles.add(new File(userPlatform.getPath(), file compilationFiles.add(new File(projectDir.getPath(), file
.getParent())); .getParent()));
} }
} }
@ -1704,15 +1702,15 @@ public class ContikiMoteTypeDialog extends JDialog {
boolean foundFile = sourceFile.exists(); boolean foundFile = sourceFile.exists();
if (!foundFile) if (!foundFile)
for (File userPlatform : myGUI.getUserPlatforms()) { for (File projectDir : myGUI.getProjectDirs()) {
sourceFile = new File(userPlatform, sourceFilename); sourceFile = new File(projectDir, sourceFilename);
if (foundFile = sourceFile.exists()) if (foundFile = sourceFile.exists())
break; break;
} }
if (!foundFile) if (!foundFile)
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
sourceFile = new File(userPlatform, sourceFilename); sourceFile = new File(projectDir, sourceFilename);
if (foundFile = sourceFile.exists()) if (foundFile = sourceFile.exists())
break; break;
} }
@ -1873,13 +1871,13 @@ public class ContikiMoteTypeDialog extends JDialog {
.setToolTipText("Compilation may not work correctly with spaced paths"); .setToolTipText("Compilation may not work correctly with spaced paths");
} }
// Warn if spaces in a user platform path // Warn if spaces in a project directory path
textUserPlatforms.setBackground(Color.WHITE); textProjectDirs.setBackground(Color.WHITE);
textUserPlatforms.setToolTipText(null); textProjectDirs.setToolTipText(null);
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
if (userPlatform.getPath().contains(" ")) { if (projectDir.getPath().contains(" ")) {
textUserPlatforms.setBackground(Color.ORANGE); textProjectDirs.setBackground(Color.ORANGE);
textUserPlatforms textProjectDirs
.setToolTipText("Compilation may not work correctly with spaced paths"); .setToolTipText("Compilation may not work correctly with spaced paths");
} }
} }
@ -1897,11 +1895,11 @@ public class ContikiMoteTypeDialog extends JDialog {
} }
/** /**
* Scans Contiki base + (optional) user platform for Contiki processes, * Scans Contiki base + (optional) project directories for Contiki processes,
* sensors and core interfaces. The new mote type config is recreated every * sensors and core interfaces. The new mote type config is recreated every
* time this method is run. If a user platform is specified, it looks for a * time this method is run. If any project directories are specified, it reads
* special class config file there, and appends it to the new mote type * the configuration files, and appends it to the new mote type config.
* config. By reading that config all available mote interfaces are parsed - * By reading those configs all available mote interfaces are parsed -
* which will all be selected initially. This method also selects the core * which will all be selected initially. This method also selects the core
* interfaces needed by the mote interfaces. * interfaces needed by the mote interfaces.
* *
@ -1919,7 +1917,7 @@ public class ContikiMoteTypeDialog extends JDialog {
pathErrorFound = true; pathErrorFound = true;
} }
// Check that cooja main platform path is correct // Check that Cooja main platform path is correct
if (!new File(myDialog.textCoreDir.getText()).isDirectory()) { if (!new File(myDialog.textCoreDir.getText()).isDirectory()) {
// Cooja main platform specified does not exist // Cooja main platform specified does not exist
textContikiDir.setBackground(Color.RED); textContikiDir.setBackground(Color.RED);
@ -1929,14 +1927,14 @@ public class ContikiMoteTypeDialog extends JDialog {
pathErrorFound = true; pathErrorFound = true;
} }
// Check that all user platforms are valid // Check that all project directories are valid
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
File userPlatformConfig = new File(userPlatform.getPath(), File userProjectConfig = new File(projectDir.getPath(),
GUI.PLATFORM_CONFIG_FILENAME); GUI.PROJECT_CONFIG_FILENAME);
if (!userPlatformConfig.exists()) { if (!userProjectConfig.exists()) {
textUserPlatforms.setBackground(Color.RED); textProjectDirs.setBackground(Color.RED);
textUserPlatforms.setToolTipText("Invalid user platform: " textProjectDirs.setToolTipText("Invalid project directory: "
+ userPlatform); + projectDir);
pathErrorFound = true; pathErrorFound = true;
} }
} }
@ -2033,7 +2031,7 @@ public class ContikiMoteTypeDialog extends JDialog {
myMoteType.setDescription(textDescription.getText()); myMoteType.setDescription(textDescription.getText());
myMoteType.setContikiBaseDir(textContikiDir.getText()); myMoteType.setContikiBaseDir(textContikiDir.getText());
myMoteType.setContikiCoreDir(textCoreDir.getText()); myMoteType.setContikiCoreDir(textCoreDir.getText());
myMoteType.setUserPlatformDirs(moteTypeUserPlatforms); myMoteType.setProjectDirs(moteTypeProjectDirs);
myMoteType.setCompilationFiles(compilationFiles); myMoteType.setCompilationFiles(compilationFiles);
myMoteType.setConfig(newMoteTypeConfig); myMoteType.setConfig(newMoteTypeConfig);
@ -2099,20 +2097,20 @@ public class ContikiMoteTypeDialog extends JDialog {
} }
createButton.setEnabled(libraryCreatedOK = false); createButton.setEnabled(libraryCreatedOK = false);
pathsWereUpdated(); pathsWereUpdated();
} else if (e.getActionCommand().equals("manageuserplatforms")) { } else if (e.getActionCommand().equals("manageprojectdirs")) {
Vector<File> newPlatforms = UserPlatformsDialog.showDialog( Vector<File> newProjectDirs = ProjectDirectoriesDialog.showDialog(
ContikiMoteTypeDialog.this, moteTypeUserPlatforms, myGUI ContikiMoteTypeDialog.this, moteTypeProjectDirs, myGUI
.getUserPlatforms()); .getProjectDirs());
if (newPlatforms != null) { if (newProjectDirs != null) {
moteTypeUserPlatforms = newPlatforms; moteTypeProjectDirs = newProjectDirs;
String userPlatformText = null; String projectDirText = null;
for (File userPlatform : newPlatforms) { for (File projectDir : newProjectDirs) {
if (userPlatformText == null) if (projectDirText == null)
userPlatformText = "'" + userPlatform.getPath() + "'"; projectDirText = "'" + projectDir.getPath() + "'";
else else
userPlatformText += " + '" + userPlatform.getPath() + "'"; projectDirText += " + '" + projectDir.getPath() + "'";
} }
textUserPlatforms.setText(userPlatformText); textProjectDirs.setText(projectDirText);
createButton.setEnabled(libraryCreatedOK = false); createButton.setEnabled(libraryCreatedOK = false);
pathsWereUpdated(); pathsWereUpdated();
@ -2126,15 +2124,15 @@ public class ContikiMoteTypeDialog extends JDialog {
processes.addAll(ContikiMoteTypeDialog.scanForProcesses(new File( processes.addAll(ContikiMoteTypeDialog.scanForProcesses(new File(
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If project directories exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) { for (File projectDir : myGUI.getProjectDirs()) {
processes processes
.addAll(ContikiMoteTypeDialog.scanForProcesses(userPlatform)); .addAll(ContikiMoteTypeDialog.scanForProcesses(projectDir));
} }
if (moteTypeUserPlatforms != null) { if (moteTypeProjectDirs != null) {
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
processes.addAll(ContikiMoteTypeDialog processes.addAll(ContikiMoteTypeDialog
.scanForProcesses(userPlatform)); .scanForProcesses(projectDir));
} }
} }
@ -2168,13 +2166,13 @@ public class ContikiMoteTypeDialog extends JDialog {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(new File( sensors.addAll(ContikiMoteTypeDialog.scanForSensors(new File(
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If project directories exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) { for (File projectDir : myGUI.getProjectDirs()) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform)); sensors.addAll(ContikiMoteTypeDialog.scanForSensors(projectDir));
} }
if (moteTypeUserPlatforms != null) { if (moteTypeProjectDirs != null) {
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
sensors.addAll(ContikiMoteTypeDialog.scanForSensors(userPlatform)); sensors.addAll(ContikiMoteTypeDialog.scanForSensors(projectDir));
} }
} }
@ -2203,15 +2201,15 @@ public class ContikiMoteTypeDialog extends JDialog {
interfaces.addAll(ContikiMoteTypeDialog.scanForInterfaces(new File( interfaces.addAll(ContikiMoteTypeDialog.scanForInterfaces(new File(
textCoreDir.getText()))); textCoreDir.getText())));
// If user platforms exists, scan those too // If project directories exists, scan those too
for (File userPlatform : myGUI.getUserPlatforms()) { for (File projectDir : myGUI.getProjectDirs()) {
interfaces.addAll(ContikiMoteTypeDialog interfaces.addAll(ContikiMoteTypeDialog
.scanForInterfaces(userPlatform)); .scanForInterfaces(projectDir));
} }
if (moteTypeUserPlatforms != null) { if (moteTypeProjectDirs != null) {
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
interfaces.addAll(ContikiMoteTypeDialog interfaces.addAll(ContikiMoteTypeDialog
.scanForInterfaces(userPlatform)); .scanForInterfaces(projectDir));
} }
} }
@ -2237,14 +2235,14 @@ public class ContikiMoteTypeDialog extends JDialog {
moteInterfacePanel.removeAll(); moteInterfacePanel.removeAll();
// Clone general simulator config // Clone general simulator config
newMoteTypeConfig = myGUI.getPlatformConfig().clone(); newMoteTypeConfig = myGUI.getProjectConfig().clone();
// Merge with all user platform configs (if any) // Merge with all project directory configs (if any)
for (File userPlatform : moteTypeUserPlatforms) { for (File projectDir : moteTypeProjectDirs) {
try { try {
newMoteTypeConfig.appendUserPlatform(userPlatform); newMoteTypeConfig.appendProjectDir(projectDir);
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("Error when parsing user platform config: " + ex); logger.fatal("Error when parsing project directory config: " + ex);
return; return;
} }
} }
@ -2255,7 +2253,7 @@ public class ContikiMoteTypeDialog extends JDialog {
Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>(); Vector<Class<? extends MoteInterface>> moteIntfClasses = new Vector<Class<? extends MoteInterface>>();
ClassLoader classLoader = myGUI ClassLoader classLoader = myGUI
.createUserPlatformClassLoader(moteTypeUserPlatforms); .createProjectDirClassLoader(moteTypeProjectDirs);
// Find and load the mote interface classes // Find and load the mote interface classes
for (String moteInterface : moteInterfaces) { for (String moteInterface : moteInterfaces) {

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: UserPlatformsDialog.java,v 1.7 2007/03/23 21:57:24 fros4943 Exp $ * $Id: ProjectDirectoriesDialog.java,v 1.1 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.dialogs; package se.sics.cooja.dialogs;
@ -42,99 +42,99 @@ import javax.swing.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import se.sics.cooja.GUI; import se.sics.cooja.GUI;
import se.sics.cooja.PlatformConfig; import se.sics.cooja.ProjectConfig;
/** /**
* This dialog allows a user to manage the user platforms configuration. User * This dialog allows a user to manage the project directory configurations. Project
* platforms can be added, removed or reordered. The resulting platform * directories can be added, removed or reordered. The resulting
* configuration can also be viewed. * configuration can also be viewed.
* *
* This dialog reads from the external platform configuration files in each user * This dialog reads from the external project configuration files in each project
* platform, as well as from any specified default configuration files. * directory, as well as from any specified default configuration files.
* *
* @author Fredrik Osterlind * @author Fredrik Osterlind
*/ */
public class UserPlatformsDialog extends JDialog { public class ProjectDirectoriesDialog extends JDialog {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(UserPlatformsDialog.class); private static Logger logger = Logger.getLogger(ProjectDirectoriesDialog.class);
private List changablePlatformsList = new List(); private List changableProjectsList = new List();
private List fixedPlatformsList = null; private List fixedProjectsList = null;
private Vector<File> fixedUserPlatforms = null; private Vector<File> changableProjects = null;
private Vector<File> changableUserPlatforms = null; private Vector<File> fixedProjects = null;
private UserPlatformsDialog myDialog; private ProjectDirectoriesDialog myDialog;
private Frame myParentFrame = null; private Frame myParentFrame = null;
private Dialog myParentDialog = null; private Dialog myParentDialog = null;
/** /**
* Allows user to alter the given user platforms list by adding new, * Allows user to alter the given project directories list by adding new,
* reordering or removing user platforms. Only the changable user platforms * reordering or removing project directories. Only the changable project directories
* may be changed, * can be altered.
* *
* @param parentFrame * @param parentFrame
* Parent frame * Parent frame
* @param changablePlatforms * @param changableProjects
* Changeable user platforms * Changeable project directories
* @param fixedPlatforms * @param fixedProjects
* Fixed user platform * Fixed project directory
* @return Null if dialog aborted, else the new CHANGEABLE user platform list. * @return Null if dialog aborted, else the new CHANGEABLE project directory list.
*/ */
public static Vector<File> showDialog(Frame parentFrame, public static Vector<File> showDialog(Frame parentFrame,
Vector<File> changablePlatforms, Vector<File> fixedPlatforms) { Vector<File> changableProjects, Vector<File> fixedProjects) {
UserPlatformsDialog myDialog = new UserPlatformsDialog(parentFrame, ProjectDirectoriesDialog myDialog = new ProjectDirectoriesDialog(parentFrame,
changablePlatforms, fixedPlatforms); changableProjects, fixedProjects);
myDialog.setLocationRelativeTo(parentFrame); myDialog.setLocationRelativeTo(parentFrame);
if (myDialog != null) { if (myDialog != null) {
myDialog.setVisible(true); myDialog.setVisible(true);
} }
return myDialog.changableUserPlatforms; return myDialog.changableProjects;
} }
/** /**
* Allows user to alter the given user platforms list by adding new, * Allows user to alter the given project directories list by adding new,
* reordering or removing user platforms. Only the changable user platforms * reordering or removing project directories. Only the changable project directories
* may be changed, * may be altered.
* *
* @param parentDialog * @param parentDialog
* Parent dialog * Parent dialog
* @param changablePlatforms * @param changableProjects
* Changeable user platforms * Changeable project directories
* @param fixedPlatforms * @param fixedProjects
* Fixed user platform * Fixed project directory
* @return Null if dialog aborted, else the new CHANGEABLE user platform list. * @return Null if dialog aborted, else the new CHANGEABLE project directory list.
*/ */
public static Vector<File> showDialog(Dialog parentDialog, public static Vector<File> showDialog(Dialog parentDialog,
Vector<File> changablePlatforms, Vector<File> fixedPlatforms) { Vector<File> changableProjects, Vector<File> fixedProjects) {
UserPlatformsDialog myDialog = new UserPlatformsDialog(parentDialog, ProjectDirectoriesDialog myDialog = new ProjectDirectoriesDialog(parentDialog,
changablePlatforms, fixedPlatforms); changableProjects, fixedProjects);
myDialog.setLocationRelativeTo(parentDialog); myDialog.setLocationRelativeTo(parentDialog);
if (myDialog != null) { if (myDialog != null) {
myDialog.setVisible(true); myDialog.setVisible(true);
} }
return myDialog.changableUserPlatforms; return myDialog.changableProjects;
} }
private UserPlatformsDialog(Frame frame, Vector<File> changablePlatforms, private ProjectDirectoriesDialog(Frame frame, Vector<File> changableProjects,
Vector<File> fixedPlatforms) { Vector<File> fixedProjects) {
super(frame, "Manage User Platforms", true); super(frame, "Manage Project Directories", true);
myParentFrame = frame; myParentFrame = frame;
init(changablePlatforms, fixedPlatforms); init(changableProjects, fixedProjects);
} }
private UserPlatformsDialog(Dialog dialog, Vector<File> changablePlatforms, private ProjectDirectoriesDialog(Dialog dialog, Vector<File> changableProjects,
Vector<File> fixedPlatforms) { Vector<File> fixedProjects) {
super(dialog, "Manage User Platforms", true); super(dialog, "Manage Project Directories", true);
myParentDialog = dialog; myParentDialog = dialog;
init(changablePlatforms, fixedPlatforms); init(changableProjects, fixedProjects);
} }
private void init(Vector<File> changablePlatforms, Vector<File> fixedPlatforms) { private void init(Vector<File> changablePlatforms, Vector<File> fixedProjects) {
myDialog = this; myDialog = this;
JPanel mainPane = new JPanel(); JPanel mainPane = new JPanel();
@ -152,7 +152,7 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Cancel"); button = new JButton("Cancel");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
changableUserPlatforms = null; changableProjects = null;
dispose(); dispose();
} }
}); });
@ -163,13 +163,13 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("OK"); button = new JButton("OK");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
changableUserPlatforms = new Vector<File>(); changableProjects = new Vector<File>();
for (String directory : changablePlatformsList.getItems()) { for (String directory : changableProjectsList.getItems()) {
File userPlatform = new File(directory); File projectDir = new File(directory);
if (userPlatform.exists() && userPlatform.isDirectory()) if (projectDir.exists() && projectDir.isDirectory())
changableUserPlatforms.add(userPlatform); changableProjects.add(projectDir);
else else
logger.fatal("Can't find user platform: " + userPlatform); logger.fatal("Can't find project directory: " + projectDir);
} }
dispose(); dispose();
} }
@ -185,15 +185,15 @@ public class UserPlatformsDialog extends JDialog {
JPanel listPane2 = new JPanel(); JPanel listPane2 = new JPanel();
listPane2.setLayout(new BoxLayout(listPane2, BoxLayout.Y_AXIS)); listPane2.setLayout(new BoxLayout(listPane2, BoxLayout.Y_AXIS));
if (fixedPlatforms != null) { if (fixedProjects != null) {
fixedPlatformsList = new List(); fixedProjectsList = new List();
fixedPlatformsList.setEnabled(false); fixedProjectsList.setEnabled(false);
listPane2.add(new JLabel("Fixed:")); listPane2.add(new JLabel("Fixed:"));
listPane2.add(fixedPlatformsList); listPane2.add(fixedProjectsList);
} }
listPane2.add(new JLabel("Changable:")); listPane2.add(new JLabel("Changable:"));
listPane2.add(changablePlatformsList); listPane2.add(changableProjectsList);
listPane.add(listPane2); listPane.add(listPane2);
@ -203,15 +203,15 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Move up"); button = new JButton("Move up");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int selectedIndex = changablePlatformsList.getSelectedIndex(); int selectedIndex = changableProjectsList.getSelectedIndex();
if (selectedIndex <= 0) if (selectedIndex <= 0)
return; return;
File file = new File(changablePlatformsList.getItem(selectedIndex)); File file = new File(changableProjectsList.getItem(selectedIndex));
removeUserPlatform(selectedIndex); removeProjectDir(selectedIndex);
addUserPlatform(file, selectedIndex - 1); addProjectDir(file, selectedIndex - 1);
changablePlatformsList.select(selectedIndex - 1); changableProjectsList.select(selectedIndex - 1);
} }
}); });
smallPane.add(button); smallPane.add(button);
@ -219,16 +219,16 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Move down"); button = new JButton("Move down");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int selectedIndex = changablePlatformsList.getSelectedIndex(); int selectedIndex = changableProjectsList.getSelectedIndex();
if (selectedIndex < 0) if (selectedIndex < 0)
return; return;
if (selectedIndex >= changablePlatformsList.getItemCount() - 1) if (selectedIndex >= changableProjectsList.getItemCount() - 1)
return; return;
File file = new File(changablePlatformsList.getItem(selectedIndex)); File file = new File(changableProjectsList.getItem(selectedIndex));
removeUserPlatform(selectedIndex); removeProjectDir(selectedIndex);
addUserPlatform(file, selectedIndex + 1); addProjectDir(file, selectedIndex + 1);
changablePlatformsList.select(selectedIndex + 1); changableProjectsList.select(selectedIndex + 1);
} }
}); });
smallPane.add(button); smallPane.add(button);
@ -238,10 +238,10 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Remove"); button = new JButton("Remove");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (changablePlatformsList.getSelectedIndex() < 0) if (changableProjectsList.getSelectedIndex() < 0)
return; return;
removeUserPlatform(changablePlatformsList.getSelectedIndex()); removeProjectDir(changableProjectsList.getSelectedIndex());
} }
}); });
smallPane.add(button); smallPane.add(button);
@ -256,25 +256,25 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("View resulting config"); button = new JButton("View resulting config");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PlatformConfig config; ProjectConfig config;
try { try {
// Create default configuration // Create default configuration
config = new PlatformConfig(true); config = new ProjectConfig(true);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
logger.fatal("Could not find default platform config file: " logger.fatal("Could not find default project config file: "
+ GUI.PLATFORM_DEFAULT_CONFIG_FILENAME); + GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
return; return;
} catch (IOException ex) { } catch (IOException ex) {
logger.fatal("Error when reading default platform config file: " logger.fatal("Error when reading default project config file: "
+ GUI.PLATFORM_DEFAULT_CONFIG_FILENAME); + GUI.PROJECT_DEFAULT_CONFIG_FILENAME);
return; return;
} }
// Add the fixed platform configurations // Add the fixed project configurations
if (fixedPlatformsList != null) { if (fixedProjectsList != null) {
for (String userPlatform : fixedPlatformsList.getItems()) { for (String projectDir : fixedProjectsList.getItems()) {
try { try {
config.appendUserPlatform(new File(userPlatform)); config.appendProjectDir(new File(projectDir));
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("Error when merging configurations: " + ex); logger.fatal("Error when merging configurations: " + ex);
return; return;
@ -282,10 +282,10 @@ public class UserPlatformsDialog extends JDialog {
} }
} }
// Add the user platform configurations // Add the project directory configurations
for (String userPlatform : changablePlatformsList.getItems()) { for (String projectDir : changableProjectsList.getItems()) {
try { try {
config.appendUserPlatform(new File(userPlatform)); config.appendProjectDir(new File(projectDir));
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("Error when merging configurations: " + ex); logger.fatal("Error when merging configurations: " + ex);
return; return;
@ -306,11 +306,11 @@ public class UserPlatformsDialog extends JDialog {
button = new JButton("Add manually"); button = new JButton("Add manually");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String newUserPlatformPath = JOptionPane.showInputDialog(myDialog, String newProjectPath = JOptionPane.showInputDialog(myDialog,
"Enter path to user platform", "Enter path", "Enter path to project directory", "Enter path",
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (newUserPlatformPath != null) { if (newProjectPath != null) {
addUserPlatform(new File(newUserPlatformPath)); addProjectDir(new File(newProjectPath));
} }
} }
}); });
@ -324,10 +324,10 @@ public class UserPlatformsDialog extends JDialog {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new java.io.File(".")); fc.setCurrentDirectory(new java.io.File("."));
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.setDialogTitle("Select user platform"); fc.setDialogTitle("Select project directory");
if (fc.showOpenDialog(myDialog) == JFileChooser.APPROVE_OPTION) { if (fc.showOpenDialog(myDialog) == JFileChooser.APPROVE_OPTION) {
addUserPlatform(fc.getSelectedFile()); addProjectDir(fc.getSelectedFile());
} }
} }
}); });
@ -340,48 +340,48 @@ public class UserPlatformsDialog extends JDialog {
contentPane.add(mainPane, BorderLayout.CENTER); contentPane.add(mainPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.SOUTH); contentPane.add(buttonPane, BorderLayout.SOUTH);
// Add fixed user platforms if any // Add fixed project directories if any
if (fixedPlatforms != null) { if (fixedProjects != null) {
for (File userPlatform : fixedPlatforms) { for (File projectDir : fixedProjects) {
fixedPlatformsList.add(userPlatform.getPath()); fixedProjectsList.add(projectDir.getPath());
} }
} }
// Add already existing user platforms // Add already existing project directories
for (File userPlatform : changablePlatforms) { for (File projectDir : changablePlatforms) {
addUserPlatform(userPlatform); addProjectDir(projectDir);
} }
pack(); pack();
} }
private void addUserPlatform(File userPlatform) { private void addProjectDir(File projectDir) {
addUserPlatform(userPlatform, changablePlatformsList.getItemCount()); addProjectDir(projectDir, changableProjectsList.getItemCount());
} }
private void addUserPlatform(File userPlatform, int index) { private void addProjectDir(File projectDir, int index) {
// Check that file exists, is a directory and contains the correct files // Check that file exists, is a directory and contains the correct files
if (!userPlatform.exists()) { if (!projectDir.exists()) {
logger.fatal("Can't find user platform: " + userPlatform); logger.fatal("Can't find project directory: " + projectDir);
return; return;
} }
if (!userPlatform.isDirectory()) { if (!projectDir.isDirectory()) {
logger.fatal("User platform is not a directory: " + userPlatform); logger.fatal("Specified path is not a directory: " + projectDir);
return; return;
} }
File userPlatformConfigFile = new File(userPlatform.getPath(), File projectConfigFile = new File(projectDir.getPath(),
GUI.PLATFORM_CONFIG_FILENAME); GUI.PROJECT_CONFIG_FILENAME);
if (!userPlatformConfigFile.exists()) { if (!projectConfigFile.exists()) {
Object[] options = {"Create", Object[] options = {"Create",
"Cancel"}; "Cancel"};
int n = JOptionPane.showOptionDialog( int n = JOptionPane.showOptionDialog(
this, this,
"No " + GUI.PLATFORM_CONFIG_FILENAME + " file exists in specified directory!" "No " + GUI.PROJECT_CONFIG_FILENAME + " file exists in specified directory!"
+ "\nCreate an empty " + GUI.PLATFORM_CONFIG_FILENAME + " file?", + "\nCreate an empty " + GUI.PROJECT_CONFIG_FILENAME + " file?",
"Create user platform configuration?", "Create project directory configuration?",
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, JOptionPane.QUESTION_MESSAGE,
null, options, options[1]); null, options, options[1]);
@ -390,19 +390,19 @@ public class UserPlatformsDialog extends JDialog {
return; return;
try { try {
userPlatformConfigFile.createNewFile(); projectConfigFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
logger.fatal("Could not create user platform configuration file: " logger.fatal("Could not create project directory configuration file: "
+ userPlatformConfigFile); + projectConfigFile);
return; return;
} }
} }
changablePlatformsList.add(userPlatform.getPath(), index); changableProjectsList.add(projectDir.getPath(), index);
} }
private void removeUserPlatform(int index) { private void removeProjectDir(int index) {
changablePlatformsList.remove(index); changableProjectsList.remove(index);
} }
} }
@ -417,7 +417,7 @@ class ConfigViewer extends JDialog {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(ConfigViewer.class); private static Logger logger = Logger.getLogger(ConfigViewer.class);
public static void showDialog(Frame parentFrame, PlatformConfig config) { public static void showDialog(Frame parentFrame, ProjectConfig config) {
ConfigViewer myDialog = new ConfigViewer(parentFrame, config); ConfigViewer myDialog = new ConfigViewer(parentFrame, config);
myDialog.setLocationRelativeTo(parentFrame); myDialog.setLocationRelativeTo(parentFrame);
myDialog.setAlwaysOnTop(true); myDialog.setAlwaysOnTop(true);
@ -427,7 +427,7 @@ class ConfigViewer extends JDialog {
} }
} }
public static void showDialog(Dialog parentDialog, PlatformConfig config) { public static void showDialog(Dialog parentDialog, ProjectConfig config) {
ConfigViewer myDialog = new ConfigViewer(parentDialog, config); ConfigViewer myDialog = new ConfigViewer(parentDialog, config);
myDialog.setLocationRelativeTo(parentDialog); myDialog.setLocationRelativeTo(parentDialog);
myDialog.setAlwaysOnTop(true); myDialog.setAlwaysOnTop(true);
@ -437,17 +437,17 @@ class ConfigViewer extends JDialog {
} }
} }
private ConfigViewer(Dialog dialog, PlatformConfig config) { private ConfigViewer(Dialog dialog, ProjectConfig config) {
super(dialog, "Current class configuration", true); super(dialog, "Current class configuration", true);
init(config); init(config);
} }
private ConfigViewer(Frame frame, PlatformConfig config) { private ConfigViewer(Frame frame, ProjectConfig config) {
super(frame, "Current class configuration", true); super(frame, "Current class configuration", true);
init(config); init(config);
} }
private void init(PlatformConfig config) { private void init(ProjectConfig config) {
JPanel mainPane = new JPanel(new BorderLayout()); JPanel mainPane = new JPanel(new BorderLayout());
JLabel label; JLabel label;
JButton button; JButton button;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MantisMoteType.java,v 1.2 2007/01/09 10:02:16 fros4943 Exp $ * $Id: MantisMoteType.java,v 1.3 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.mantismote; package se.sics.cooja.mantismote;
@ -346,7 +346,7 @@ public class MantisMoteType implements MoteType {
return panel; return panel;
} }
public PlatformConfig getConfig() { public ProjectConfig getConfig() {
logger.debug("MantisMoteType::getConfig"); logger.debug("MantisMoteType::getConfig");
return null; return null;
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MantisMoteTypeDialog.java,v 1.3 2007/01/10 08:48:39 fros4943 Exp $ * $Id: MantisMoteTypeDialog.java,v 1.4 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.mantismote; package se.sics.cooja.mantismote;
@ -156,7 +156,7 @@ public class MantisMoteTypeDialog extends JDialog {
} }
// Load all mote interface classes // Load all mote interface classes
String[] moteInterfaces = simulation.getGUI().getPlatformConfig().getStringArrayValue(MantisMoteType.class, "MOTE_INTERFACES"); String[] moteInterfaces = simulation.getGUI().getProjectConfig().getStringArrayValue(MantisMoteType.class, "MOTE_INTERFACES");
myDialog.moteInterfaceClasses = new Vector<Class<? extends MoteInterface>>(); myDialog.moteInterfaceClasses = new Vector<Class<? extends MoteInterface>>();
for (String moteInterface : moteInterfaces) { for (String moteInterface : moteInterfaces) {
try { try {

View file

@ -58,7 +58,7 @@ public class DisturberMoteType implements MoteType {
private Vector<Class<? extends MoteInterface>> moteInterfaces = null; private Vector<Class<? extends MoteInterface>> moteInterfaces = null;
// Type specific class configuration // Type specific class configuration
private PlatformConfig myConfig = null; private ProjectConfig myConfig = null;
// Simulation holding this mote type // Simulation holding this mote type
private Simulation mySimulation = null; private Simulation mySimulation = null;
@ -194,7 +194,7 @@ public class DisturberMoteType implements MoteType {
return panel; return panel;
} }
public PlatformConfig getConfig() { public ProjectConfig getConfig() {
return myConfig; return myConfig;
//return null; /* TV */ //return null; /* TV */
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: DummyMoteType.java,v 1.2 2007/01/09 10:01:14 fros4943 Exp $ * $Id: DummyMoteType.java,v 1.3 2007/03/23 23:34:33 fros4943 Exp $
*/ */
package se.sics.cooja.motes; package se.sics.cooja.motes;
@ -116,7 +116,7 @@ public class DummyMoteType implements MoteType {
return null; return null;
} }
public PlatformConfig getConfig() { public ProjectConfig getConfig() {
return null; return null;
} }