Skip to content
Snippets Groups Projects
Commit 7e53598d authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Fix for reloading app on the fly / hotswapping

parent 5d60f930
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,6 @@ public class CyActivator extends AbstractCyActivator { ...@@ -117,7 +117,6 @@ public class CyActivator extends AbstractCyActivator {
props.setProperty(COMMAND, YoshikoCommand.PERFORM_ALGORITHM.toString()); props.setProperty(COMMAND, YoshikoCommand.PERFORM_ALGORITHM.toString());
props.setProperty(COMMAND_DESCRIPTION,"TEST PERFORM ALGORITHM"); props.setProperty(COMMAND_DESCRIPTION,"TEST PERFORM ALGORITHM");
registerService(context, commandTaskFactory, TaskFactory.class, props); registerService(context, commandTaskFactory, TaskFactory.class, props);
System.out.println(props.toString());
//Initialize and register main panel //Initialize and register main panel
MainPanel mainPanel = new MainPanel(); MainPanel mainPanel = new MainPanel();
......
package de.hhu.ba.yoshikoWrapper.core; package de.hhu.ba.yoshikoWrapper.core;
import org.cytoscape.model.CyColumn; import org.cytoscape.model.CyColumn;
import org.cytoscape.work.Tunable;
public class ParameterSet { public class ParameterSet {
public int timeLimit; @Tunable(description="Time Limit for the ILP mode", context="nogui")
public int timeLimit = -1;
@Tunable(description="A column in the edge table containing weights", context="nogui")
public CyColumn weightColumn; public CyColumn weightColumn;
public CyColumn permanentColumn; public CyColumn permanentColumn;
public CyColumn forbiddenColumn; public CyColumn forbiddenColumn;
public double defaultInsertionCost; public double defaultInsertionCost;
......
...@@ -39,7 +39,6 @@ public class YoshikoLoader { ...@@ -39,7 +39,6 @@ public class YoshikoLoader {
private static Logger logger = YoshikoLogger.getInstance().getLogger(); private static Logger logger = YoshikoLogger.getInstance().getLogger();
public static void loadLibrary(String libPath) { public static void loadLibrary(String libPath) {
//Attempt to load from a previously stored path //Attempt to load from a previously stored path
File f = new File (libPath); File f = new File (libPath);
if (!f.exists()) { if (!f.exists()) {
...@@ -49,15 +48,19 @@ public class YoshikoLoader { ...@@ -49,15 +48,19 @@ public class YoshikoLoader {
try { try {
logger.info("Attempting to load library @: "+libPath); logger.info("Attempting to load library @: "+libPath);
//Verify version ending
if (!libPath.substring(0,libPath.lastIndexOf(".")).endsWith(REQUIRED_VERSION)) { if (!libPath.substring(0,libPath.lastIndexOf(".")).endsWith(REQUIRED_VERSION)) {
throw new Exception(LocalizationManager.get("libFail")+" "+REQUIRED_VERSION); logger.info(LocalizationManager.get("libFail")+" "+REQUIRED_VERSION);
return;
} }
//Perform actual loading
System.load(libPath); System.load(libPath);
} }
catch(Exception e) { catch(UnsatisfiedLinkError e) {
//This might happen as Java doesn't unload native libs
//One such case might be reloading the Cytoscape app on-the-fly
logger.error(e.getMessage()); logger.error(e.getMessage());
logger.info(LocalizationManager.get("libFail")+" "+REQUIRED_VERSION);
return; return;
} }
LibraryInterface.setVerbosity(3); LibraryInterface.setVerbosity(3);
......
...@@ -37,7 +37,7 @@ public class LanguageSwitcherPanel extends BasicCollapsiblePanel{ ...@@ -37,7 +37,7 @@ public class LanguageSwitcherPanel extends BasicCollapsiblePanel{
super(LocalizationManager.get("switchLanguage")); super(LocalizationManager.get("switchLanguage"));
final LanguageSwitcher switcher; final LanguageSwitcher switcher;
//final BasicCollapsiblePanel ret = new BasicCollapsiblePanel(); //final BasicCollapsiblePanel ret = new BasicCollapsiblePanel();
getContentPane().setLayout(new BoxLayout(getContentPane(),BoxLayout.X_AXIS)); //getContentPane().setLayout(new BoxLayout(getContentPane(),BoxLayout.X_AXIS));
//SWING COMPONENTS INIT //SWING COMPONENTS INIT
switcher = new LanguageSwitcher(); switcher = new LanguageSwitcher();
......
...@@ -11,5 +11,15 @@ public enum YoshikoCommand { ...@@ -11,5 +11,15 @@ public enum YoshikoCommand {
*/ */
CREATE_CLUSTER_VIEW, CREATE_CLUSTER_VIEW,
CREATE_META_GRAPH, CREATE_META_GRAPH,
PERFORM_ALGORITHM PERFORM_ALGORITHM;
@Override
public String toString() {
if (this==PERFORM_ALGORITHM) {
return "cluster"; //TODO: Dynamic
}
return "null";
}
} }
...@@ -31,6 +31,7 @@ import org.cytoscape.application.swing.CytoPanelState; ...@@ -31,6 +31,7 @@ import org.cytoscape.application.swing.CytoPanelState;
import org.cytoscape.model.CyNetwork; import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode; import org.cytoscape.model.CyNode;
import org.cytoscape.work.AbstractTask; import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.ContainsTunables;
import org.cytoscape.work.TaskMonitor; import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.Tunable; import org.cytoscape.work.Tunable;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -65,11 +66,15 @@ public class AlgorithmTask extends AbstractTask { ...@@ -65,11 +66,15 @@ public class AlgorithmTask extends AbstractTask {
private final Window statusWindow; //TODO: Make tunable? private final Window statusWindow; //TODO: Make tunable?
//Parameters //Parameters
@Tunable(description="Parameter Set determining the operation mode for Yoshiko", context="nogui")
private final ParameterSet parameterSet; /**The ParameterSet specifying how the algorithm is to be performed
*
*/
@ContainsTunables
public ParameterSet parameterSet = null;
@Tunable(description="Network to analyze for clusters", context="nogui") @Tunable(description="Network to analyze for clusters", context="nogui")
private final CyNetwork net; public CyNetwork net;
//Temps, pointing to and need to be freed in C++ //Temps, pointing to and need to be freed in C++
private LibraryInput input; private LibraryInput input;
...@@ -78,6 +83,12 @@ public class AlgorithmTask extends AbstractTask { ...@@ -78,6 +83,12 @@ public class AlgorithmTask extends AbstractTask {
private ResultPanel resultPanel; private ResultPanel resultPanel;
/**
* Default constructor, creates a new AlgorithmTask
* @param statusWindow The Window in which the status-bar is to be shown, can be null
* @param net The network that is to be clustered
* @param parameterSet The parameter set specifying the clustering mode
*/
public AlgorithmTask( public AlgorithmTask(
Window statusWindow, Window statusWindow,
CyNetwork net, CyNetwork net,
......
...@@ -10,6 +10,7 @@ import org.cytoscape.work.ObservableTask; ...@@ -10,6 +10,7 @@ import org.cytoscape.work.ObservableTask;
import org.cytoscape.work.Task; import org.cytoscape.work.Task;
import org.cytoscape.work.TaskMonitor; import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.TaskObserver; import org.cytoscape.work.TaskObserver;
import org.cytoscape.work.Tunable;
import de.hhu.ba.yoshikoWrapper.core.CyCore; import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
...@@ -18,9 +19,8 @@ import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster; ...@@ -18,9 +19,8 @@ import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster;
public class CreateClusterViews implements Task { public class CreateClusterViews implements Task {
//TODO: Merge redundant code with CreateMetaGraphTask @Tunable
public ArrayList<YoshikoCluster> clusters;
private ArrayList<YoshikoCluster> clusters;
private boolean isTerminated; private boolean isTerminated;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment