[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Wed Nov 23 02:48:40 UTC 2005
senger
Tue Nov 22 21:48:40 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv14926/src/main/org/biomoby/service/dashboard
Modified Files:
AntModel.java DashboardProperties.java DeploymentTable.java
GeneratorPanel.java NOTES
Log Message:
moby-live/Java/src/main/org/biomoby/service/dashboard AntModel.java,1.4,1.5 DashboardProperties.java,1.20,1.21 DeploymentTable.java,1.1,1.2 GeneratorPanel.java,1.8,1.9 NOTES,1.30,1.31
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AntModel.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AntModel.java 2005/11/22 18:03:28 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AntModel.java 2005/11/23 02:48:40 1.5
@@ -27,6 +27,8 @@
import java.util.Vector;
import java.util.Enumeration;
import java.util.Properties;
+import java.util.Map;
+import java.util.Iterator;
import java.io.File;
/**
@@ -212,35 +214,17 @@
public void mosesDeploy()
throws MobyException {
-// boolean toGenerate = propertyChannel.getBoolean (DP_USE_DT_GEN, true);
-// boolean toCompile = propertyChannel.getBoolean (DP_USE_DT_COMP, true);
-// boolean toJavadoc = propertyChannel.getBoolean (DP_USE_DT_DOC, true);
-// boolean toJar = propertyChannel.getBoolean (DP_USE_DT_JAR, true);
-
-// // build a set of properties for Ant
-// Properties props = new Properties();
-// addRegistryProps (props);
-// addGeneratorProps (props);
-
-// // build a set of Ant targets
-// Vector v = new Vector();
-// if (toGenerate && toCompile && toJavadoc && toJar) {
-// v.addElement ("moses-datatypes");
-// } else {
-// if (toGenerate)
-// v.addElement ("generate-datatypes");
-// if (toJavadoc)
-// v.addElement ("moses-docs");
-// if (toJar)
-// v.addElement ("jar-datatypes");
-// if (toCompile && ! toJavadoc && ! toJar)
-// v.addElement ("moses-compile");
-// }
-// String[] targets = new String [v.size()];
-// v.copyInto (targets);
+ // build a set of properties for Ant
+ Properties props = new Properties();
+ addDeploymentProps (props);
+ add (props, "users.lib.dir", DP_USER_JARS);
+ add (props, "wsdd.template", DP_WSDD_TEMPL);
-// // run it...
-// runAnt (targets, props);
+ // run it...
+ if (propertyChannel.getBoolean (DP_LOCAL_DEPLOY, true))
+ runAnt (new String[] { "deploy-services" }, props);
+ else
+ runAnt (new String[] { "deploy-remote" }, props);
}
/*********************************************************************
@@ -248,6 +232,14 @@
********************************************************************/
public void mosesUndeploy()
throws MobyException {
+
+ // build a set of properties for Ant
+ Properties props = new Properties();
+ addDeploymentProps (props);
+
+ // run it...
+ if (propertyChannel.getBoolean (DP_LOCAL_DEPLOY, true))
+ runAnt (new String[] { "undeploy-services" }, props);
}
/*********************************************************************
@@ -394,6 +386,26 @@
}
/*********************************************************************
+ * Add properties shared by deployment and undeployment...
+ ********************************************************************/
+ protected void addDeploymentProps (Properties props) {
+ add (props, "catalina.home", DP_TOMCAT_HOME);
+ add (props, "axis.relative.path", DP_AXIS_IN_TOMCAT);
+ add (props, "tomcat.host", DP_HOSTNAME);
+ add (props, "tomcat.port", DP_PORT);
+ add (props, "axis.admin.url", DP_AXIS_ADMIN);
+
+ Map services = (Map)propertyChannel.get (DP_DEPL_SERVICES);
+ if (services == null) return;
+ for (Iterator it = services.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = (Map.Entry)it.next();
+ String serviceName = (String)entry.getKey();
+ String className = (String)entry.getValue();
+ props.put ("service." + serviceName, className);
+ }
+ }
+
+ /*********************************************************************
* Take a property 'channelPropName' from the property channel,
* and if it is not empty, add it to 'props' under the name
* 'antPropName'.
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/11/22 18:03:28 1.20
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/11/23 02:48:40 1.21
@@ -46,6 +46,7 @@
static final String DP_SEL_SERVICES = "selectedServices"; // type: Vector with service/authority name
static final String DP_SEL_AUTHORITIES = "selectedAuthorities"; // type: Vector with authority name
+ static final String DP_DEPL_SERVICES = "servicesToDeploy"; // type: Map with serviceName => className
static final String DP_LOCAL_DEPLOY = "use-local-deploy";
static final String DP_TOMCAT_HOME = "tomcatHome";
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DeploymentTable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DeploymentTable.java 2005/11/22 18:03:28 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DeploymentTable.java 2005/11/23 02:48:40 1.2
@@ -12,6 +12,8 @@
import javax.swing.table.TableColumn;
import java.util.Enumeration;
import java.util.Vector;
+import java.util.Map;
+import java.util.HashMap;
/**
* A swing JTable that collects names of services that are going to be
@@ -39,13 +41,28 @@
}
/*********************************************************************
- *
+ * Add data representing one row to this table.
********************************************************************/
public void addData (String serviceName, String className) {
((DeploymentTableModel)tableModel).addData (serviceName, className);
}
/*********************************************************************
+ * Return all data currently available in the table. The keys are
+ * service names, the values are class names (representing classes
+ * that will implement these services).
+ ********************************************************************/
+ public Map getData() {
+ Vector v = tableModel.getData();
+ Map result = new HashMap (v.size() + 1);
+ for (Enumeration en = v.elements(); en.hasMoreElements(); ) {
+ TableDataBag bag = (TableDataBag)en.nextElement();
+ result.put (bag.serviceName, bag.className);
+ }
+ return result;
+ }
+
+ /*********************************************************************
* Ignored.
********************************************************************/
public void setData (org.biomoby.shared.MobyData[] newData) { }
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/GeneratorPanel.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/GeneratorPanel.java 2005/11/22 18:03:28 1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/GeneratorPanel.java 2005/11/23 02:48:40 1.9
@@ -50,6 +50,8 @@
import java.io.ByteArrayOutputStream;
import java.util.Enumeration;
import java.util.Vector;
+import java.util.Map;
+import java.util.Iterator;
/**
* A panel allowing to generate Java code for new services using the
@@ -90,6 +92,19 @@
"You can also select one or more authorities\n" +
"(then code for all their services will be made).\n\n";
+ protected static final String NODEPL_ERROR =
+ "Sorry, you need first to select some services\n" +
+ "which you wish to be deployed (or undeployed).\n\n" +
+
+ "You can select several (or even many) of them\n" +
+ "by using CTRL and SHIFT when selecting them.\n" +
+ "You can also select one or more authorities\n" +
+ "(it will add all their services to the list).\n\n";
+
+ protected static final String NOIMPL_ERROR =
+ "Sorry, each service that is going to be deployed\n" +
+ "needs to have assigned a class that implements it.\n\n";
+
// associated models working behind the scene
AntModel antModel;
RegistryModel registryModel;
@@ -109,6 +124,7 @@
JTextFieldWithHistory pattern;
DeploymentTable dTable;
JCheckBox copyBySelect;
+ JRadioButton locally;
// shared icons
protected static Icon genDTIcon, genDTIconDis;
@@ -172,22 +188,20 @@
antModel.setErrorStream (new ConsoleStream (console, true));
antModel.setMsgOutputLevel (AntModel.MSG_INFO);
- // service tree panel
+ // three major parts
JPanel selection = getServicesSelectionPanel();
-
- // code generators panel
JPanel generators = getGeneratorsPanel();
+ JPanel deployment = getDeploymentPanel();
- // deployment panel
- JPanel deploy = getDeploymentPanel();
+ JPanel fields = new JPanel (new GridBagLayout());
+ SwingUtils.addComponent (fields, generators, 0, 0, 1, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (fields, deployment, 1, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
// split it into moving panels
- JSplitPane split = vSplit (selection, console, 0.5);
-
- // put all together
- SwingUtils.addComponent (pComponent, split, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
- SwingUtils.addComponent (pComponent, generators, 1, 0, 1, 1, HORI, NWEST, 0.0, 0.0);
- SwingUtils.addComponent (pComponent, deploy, 2, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
+ JSplitPane split = hSplit (vSplit (selection,
+ console, 0.5),
+ fields, 0.5);
+ SwingUtils.addComponent (pComponent, split, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
return pComponent;
}
@@ -422,12 +436,12 @@
boolean deployLocally = getPrefValue (DP_LOCAL_DEPLOY, true);
propertyChannel.put (DP_LOCAL_DEPLOY, new Boolean (deployLocally).toString());
- JRadioButton locally = new JRadioButton ("On local machine", deployLocally);
+ locally = new JRadioButton ("On local machine", deployLocally);
locally.setActionCommand ("true");
locally.addActionListener (deployListener);
- JRadioButton remotely = new JRadioButton ("On remote machine", deployLocally);
- locally.setActionCommand ("false");
- locally.addActionListener (deployListener);
+ JRadioButton remotely = new JRadioButton ("On remote machine", ! deployLocally);
+ remotely.setActionCommand ("false");
+ remotely.addActionListener (deployListener);
ButtonGroup group = new ButtonGroup();
group.add (locally);
@@ -537,7 +551,6 @@
});
deployButton.setIcon (deployIcon);
deployButton.setDisabledIcon (deployIconDis);
- deployButton.setEnabled (false); // temporarily
undeployButton =
createButton (" Undeploy ",
@@ -551,9 +564,9 @@
});
undeployButton.setIcon (undeployIcon);
undeployButton.setDisabledIcon (undeployIconDis);
+ undeployButton.setEnabled (locally.isSelected());
undeployButton.setEnabled (false); // temporarily
-
// put all together
Component glue2 = Box.createHorizontalGlue();
SwingUtils.addComponent (p, pDeploy, 0, 0, 3, 1, HORI, NWEST, 0.0, 0.0);
@@ -566,12 +579,17 @@
return p;
}
- //
+ // this is used both for 'locally' and 'remotelly' radio buttons;
+ // 'locally' button has an action command "true" and 'remotely'
+ // button has an action command "false"
private ActionListener deployListener = new ActionListener() {
public void actionPerformed (ActionEvent e) {
String local = e.getActionCommand();
- setPrefValue (DP_LOCAL_DEPLOY, UUtils.is (local));
+ boolean isLocal = UUtils.is (local);
+ setPrefValue (DP_LOCAL_DEPLOY, isLocal);
propertyChannel.put (DP_LOCAL_DEPLOY, local);
+ undeployButton.setEnabled (isLocal);
+ undeployButton.setEnabled (false); // temporarily
}
};
@@ -815,6 +833,19 @@
* Deploy services...
**************************************************************************/
protected void onDeploy() {
+ if (! onCheckData()) return;
+ Map data = dTable.getData();
+ for (Iterator it = data.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = (Map.Entry)it.next();
+ String className = (String)entry.getValue();
+ if (UUtils.isEmpty (className)) {
+ String msg = NOIMPL_ERROR.replaceAll ("\\\\n", "<br>");
+ error ("<html>" + msg);
+ return;
+ }
+ }
+
+ // ...and let Ant to deploy it
final SwingWorker worker = new SwingWorker() {
MobyException exception = null;
public Object construct() {
@@ -847,6 +878,7 @@
* Undeploy services...
**************************************************************************/
protected void onUndeploy() {
+ if (! onCheckData()) return;
final SwingWorker worker = new SwingWorker() {
MobyException exception = null;
public Object construct() {
@@ -876,6 +908,22 @@
}
/**************************************************************************
+ * Get data from a deployment table; check if there are some
+ * (report error if not) and put them in the property
+ * channel. Return accordingly.
+ **************************************************************************/
+ protected boolean onCheckData() {
+ Map data = dTable.getData();
+ if (data.size() == 0) {
+ String msg = NODEPL_ERROR.replaceAll ("\\\\n", "<br>");
+ error ("<html>" + msg);
+ return false;
+ }
+ propertyChannel.put (DP_DEPL_SERVICES, data);
+ return true;
+ }
+
+ /**************************************************************************
* Disable/enable Ant-processing buttons...
**************************************************************************/
protected void setEnabledAntButtons (boolean enabled) {
@@ -884,8 +932,8 @@
bothButton.setEnabled (enabled);
dtclsButton.setEnabled (enabled);
sclsButton.setEnabled (enabled);
-// deployButton.setEnabled (enabled);
-// undeployButton.setEnabled (enabled);
+ deployButton.setEnabled (enabled);
+// undeployButton.setEnabled (enabled && locally.isSelected()); // temporarily
}
/**************************************************************************
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/22 18:03:28 1.30
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/23 02:48:40 1.31
@@ -25,13 +25,18 @@
* BUG: the BuildDataTree does not paint itself always well
+* Not yet ready: Undeploy: too many messages...
+
Should be done:
---------------
* right-click
- if nothing selected, it should take what is under the
mouse (selected first), otherwise it is annoying
+* Implement ConsoleStream better
+
* documentation (both pages and help documents)
+ - also to start Moses/Dashboard FAQs (with Eddie's one to start)
* More testing:
- interrupting loading
@@ -51,6 +56,8 @@
* more attention for the various encodings
+* current registry in the window title... "Connected to..."
+
Later:
------
* WARN: How would an authority with characters 'http://' cope as a
More information about the MOBY-guts
mailing list