[kepler-code] r28824 - in trunk/modules/workflow-scheduler-gui/src/org/kepler: module/workflowschedulergui workflowscheduler/gui
tao at ecoinformatics.org
tao at ecoinformatics.org
Thu Oct 20 16:06:36 PDT 2011
Author: tao
Date: 2011-10-20 16:06:36 -0700 (Thu, 20 Oct 2011)
New Revision: 28824
Modified:
trunk/modules/workflow-scheduler-gui/src/org/kepler/module/workflowschedulergui/Initialize.java
trunk/modules/workflow-scheduler-gui/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java
Log:
Initalize will read the workflow engine list from configuration file.
Modified: trunk/modules/workflow-scheduler-gui/src/org/kepler/module/workflowschedulergui/Initialize.java
===================================================================
--- trunk/modules/workflow-scheduler-gui/src/org/kepler/module/workflowschedulergui/Initialize.java 2011-10-20 23:00:04 UTC (rev 28823)
+++ trunk/modules/workflow-scheduler-gui/src/org/kepler/module/workflowschedulergui/Initialize.java 2011-10-20 23:06:36 UTC (rev 28824)
@@ -33,7 +33,9 @@
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
import org.kepler.build.modules.Module;
import org.kepler.configuration.ConfigurationManager;
@@ -42,6 +44,7 @@
import org.kepler.configuration.RootConfigurationProperty;
import org.kepler.module.ModuleInitializer;
import org.kepler.util.DotKeplerManager;
+import org.kepler.workflowscheduler.gui.WorkflowRunEngine;
/** Module initializer for workflow-scheduler-gui.
@@ -52,13 +55,17 @@
public class Initialize implements ModuleInitializer
{
private static final String SCHEDULER = "scheduler";
+ private static final String WORKFLOWRUNENGINELIST = "workflowRunEngineList";
+ private static final String WORKFLOWRUNENGINE = "workflowRunEngine";
+ private static final String NAME = "name";
private static final String URL = "url";
private static final String CURRENTMODULENAME = "workflow-scheduler-gui";
private static ConfigurationProperty workflowSchedulerGUIProperty = null;
private static ConfigurationManager cm = ConfigurationManager.getInstance();
private static String schedulerURL = null;
private static String configFileLocation = null;
-
+ private static Vector<WorkflowRunEngine> workflowRunEngineList = new Vector<WorkflowRunEngine>();
+
/** Perform any module-specific initializations. */
public void initializeModule()
{
@@ -66,6 +73,7 @@
addLocalProperties("workflow-scheduler-gui", "uiMenuMappings", "gui");
workflowSchedulerGUIProperty = cm.getProperty(ConfigurationManager.getModule(CURRENTMODULENAME));
schedulerURL = getSchedulerURLFromConfig();
+ getWorkflowRunEngineListFromConfig();
copyConfigToPersistentDir();
}
@@ -125,6 +133,44 @@
{
return schedulerURL;
}
+
+ /**
+ * Get the list of workflow run engine.
+ * @return the list of workfow run engine.
+ */
+ public static Vector<WorkflowRunEngine> getWorkflowRunEngineList()
+ {
+ return workflowRunEngineList;
+ }
+
+ /**
+ * If user configured the schedulerURL on the configuration file.
+ * @return true if schedulerURL was configured; false otherwise.
+ */
+ public static boolean isSchedulerURLConfigured()
+ {
+ return (schedulerURL != null && !schedulerURL.trim().equals(""));
+ }
+
+
+ /**
+ * If user configured the workflow run engine part on the configuration file.
+ * @return true if use did configure the workflow run engine part; false otherwise.
+ */
+ public static boolean isWorkflowRunEngineConfigured()
+ {
+ return (workflowRunEngineList.size() >= 1);
+ }
+
+
+ /**
+ * Get the path of the configuration file on KeplerData directory
+ * @return the path of the configuration file
+ */
+ public static String getConfigFilePath()
+ {
+ return configFileLocation;
+ }
/*
* Get scheduler url from configuration file
@@ -233,6 +279,46 @@
}
+ /*
+ * Get the name list of the workflow run engines
+ */
+ private void getWorkflowRunEngineListFromConfig()
+ {
+ ConfigurationProperty sensorViewConfiguration = Initialize.getCurrentModuleProperty();
+ if(sensorViewConfiguration != null)
+ {
+ ConfigurationProperty workflowRunEngineListProperty = sensorViewConfiguration.getProperty(WORKFLOWRUNENGINELIST);
+ if(workflowRunEngineListProperty != null)
+ {
+ List<ConfigurationProperty> workflowRunEngineProperties =workflowRunEngineListProperty.getProperties(WORKFLOWRUNENGINE);
+ if(workflowRunEngineProperties != null)
+ {
+ Iterator<ConfigurationProperty> iterator = workflowRunEngineProperties.iterator();
+ while(iterator.hasNext())
+ {
+ ConfigurationProperty workflowRunEngine = iterator.next();
+ if(workflowRunEngine != null)
+ {
+ ConfigurationProperty nameProperty = workflowRunEngine.getProperty(NAME);
+ ConfigurationProperty urlProperty = workflowRunEngine.getProperty(URL);
+ if(nameProperty != null && urlProperty != null)
+ {
+ String name = nameProperty.getValue();
+ //System.out.println("name is =========="+name);
+ String url = urlProperty.getValue();
+ //System.out.println("url is =========="+url);
+ WorkflowRunEngine engine = new WorkflowRunEngine(name);
+ engine.setURL(url);
+ workflowRunEngineList.add(engine);
+ }
+ }
+ }
+ }
+
+ }
+
+ }
+ }
}
Modified: trunk/modules/workflow-scheduler-gui/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java
===================================================================
--- trunk/modules/workflow-scheduler-gui/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java 2011-10-20 23:00:04 UTC (rev 28823)
+++ trunk/modules/workflow-scheduler-gui/src/org/kepler/workflowscheduler/gui/WorkflowSchedulerPanel.java 2011-10-20 23:06:36 UTC (rev 28824)
@@ -91,9 +91,6 @@
private static final int UINTCOMBOXWIDTH = 100;
private static final String WARNING = "Warning";
private static final String TIMESTAMPFORMAT = "MM/dd/yy HH:mm:ss";
- private static final String WORKFLOWRUNENGINELIST = "workflowRunEngineList";
- private static final String WORKFLOWRUNENGINE = "workflowRunEngine";
- private static final String NAME = "name";
private static final String URL = "url";
private static final String NOTE = "Schedule the selected workflow by filling in "+
"the fields below, choosing an execution engine, and the "+
@@ -290,7 +287,7 @@
addLeadingSpace(schedulerPanel, gridbag);
JLabel workflowRunEngineLabel = new JLabel("Workflow Run Engine ");
addComponent(schedulerPanel, workflowRunEngineLabel, gridbag, labelConstraint);
- getWorkflowRunEngineList();
+ workflowRunEngineList = Initialize.getWorkflowRunEngineList();
workflowRunEngineBox = new JComboBox(workflowRunEngineList);
workflowRunEngineBox.setRenderer(new RepositoryAndRunEngineComboBoxRenderer(WORKFLOWRUNENGINECOMBOBOX));
addFixWidthComponent(schedulerPanel, workflowRunEngineBox, gridbag, textFieldConstraint);
@@ -538,46 +535,7 @@
return valid;
}
- /*
- * Get the name list of the workflow run engines
- */
- private void getWorkflowRunEngineList()
- {
- ConfigurationProperty sensorViewConfiguration = Initialize.getCurrentModuleProperty();
- if(sensorViewConfiguration != null)
- {
- ConfigurationProperty workflowRunEngineListProperty = sensorViewConfiguration.getProperty(WORKFLOWRUNENGINELIST);
- if(workflowRunEngineListProperty != null)
- {
- List<ConfigurationProperty> workflowRunEngineProperties =workflowRunEngineListProperty.getProperties(WORKFLOWRUNENGINE);
- if(workflowRunEngineProperties != null)
- {
- Iterator<ConfigurationProperty> iterator = workflowRunEngineProperties.iterator();
- while(iterator.hasNext())
- {
- ConfigurationProperty workflowRunEngine = iterator.next();
- if(workflowRunEngine != null)
- {
- ConfigurationProperty nameProperty = workflowRunEngine.getProperty(NAME);
- ConfigurationProperty urlProperty = workflowRunEngine.getProperty(URL);
- if(nameProperty != null && urlProperty != null)
- {
- String name = nameProperty.getValue();
- //System.out.println("name is =========="+name);
- String url = urlProperty.getValue();
- //System.out.println("url is =========="+url);
- WorkflowRunEngine engine = new WorkflowRunEngine(name);
- engine.setURL(url);
- workflowRunEngineList.add(engine);
- }
- }
- }
- }
-
- }
-
- }
- }
+
/*
* Set the kar source eporsitory name.
More information about the Kepler-cvs
mailing list