You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 21:44:27 UTC
[07/16] incubator-taverna-plugin-bioinformatics git commit:
temporarily empty repository
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
deleted file mode 100644
index 43bc61f..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddMobyParseDatatypeEdit.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.MobyParseDatatypeActivity;
-import net.sf.taverna.t2.activities.biomoby.MobyParseDatatypeActivityConfigurationBean;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddMobyParseDatatypeEdit extends AbstractDataflowEdit {
-
- private final BiomobyActivity activity;
- private final String objectName;
- private final boolean isCollection;
- private final String potentialCollectionString;
-
- private Edit<?> compoundEdit = null;
- private Edit<?> linkEdit = null;
-
- private Edits edits;
-
- /**
- * @param dataflow
- */
- public AddMobyParseDatatypeEdit(Dataflow dataflow,
- BiomobyActivity activity, String objectName, boolean isCollection,
- String potentialCollectionString, Edits edits) {
- super(dataflow);
- this.activity = activity;
- this.objectName = objectName;
- this.isCollection = isCollection;
- this.potentialCollectionString = potentialCollectionString;
- this.edits = edits;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#doEditAction(java.lang
- * .Object)
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
-
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
- String defaultName = objectName;
- if (defaultName.indexOf("(") > 0)
- defaultName = defaultName.substring(0, defaultName.indexOf("("));
-
- String name = Tools
- .uniqueProcessorName("Parse Moby Data(" + defaultName + ")",
- dataflow);
-
- String articlename = "";
- if (isCollection) {
- articlename = potentialCollectionString.substring(
- potentialCollectionString.indexOf("('") + 2,
- potentialCollectionString.lastIndexOf("'"));
- } else {
- articlename = objectName.substring(objectName.indexOf("'") + 1,
- objectName.lastIndexOf("'"));
- }
-
- MobyParseDatatypeActivityConfigurationBean bean = new MobyParseDatatypeActivityConfigurationBean();
- bean.setArticleNameUsedByService(articlename);
- bean.setRegistryEndpoint(activity.getConfiguration().getMobyEndpoint());
- bean.setDatatypeName(defaultName);
- MobyParseDatatypeActivity mobyDatatypeActivity = new MobyParseDatatypeActivity();
-
- editList
- .add(edits.getConfigureActivityEdit(mobyDatatypeActivity, bean));
-
- net.sf.taverna.t2.workflowmodel.Processor sinkProcessor = edits
- .createProcessor(name);
-
- editList.add(edits.getDefaultDispatchStackEdit(sinkProcessor));
-
- Edit<?> addActivityToProcessorEdit = edits.getAddActivityEdit(
- sinkProcessor, mobyDatatypeActivity);
- editList.add(addActivityToProcessorEdit);
-
- editList.add(edits.getAddProcessorEdit(dataflow, sinkProcessor));
-
- compoundEdit = new CompoundEdit(editList);
- compoundEdit.doEdit();
-
- Processor sourceProcessor = Tools.getProcessorsWithActivity(dataflow,
- activity).iterator().next();
-
- List<Edit<?>> linkEditList = new ArrayList<Edit<?>>();
-
- String inputName = mobyDatatypeActivity.getInputPorts().iterator()
- .next().getName();
- EventHandlingInputPort sinkPort = getSinkPort(sinkProcessor,
- mobyDatatypeActivity, inputName, linkEditList);
-
-
- String outputPortName;
- if (isCollection) {
- outputPortName = defaultName + "(Collection - '"
- + (articlename.equals("") ? "MobyCollection" : articlename)
- + "' As Simples)";
- }
- else {
- outputPortName = defaultName +"(" + articlename + ")";
- }
- EventForwardingOutputPort sourcePort = getSourcePort(sourceProcessor,
- activity, outputPortName, linkEditList);
- linkEditList.add(Tools.getCreateAndConnectDatalinkEdit(dataflow,
- sourcePort, sinkPort, edits));
- linkEdit = new CompoundEdit(linkEditList);
- linkEdit.doEdit();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractEdit#undoEditAction(java
- * .lang.Object)
- */
- @Override
- protected void undoEditAction(DataflowImpl subjectImpl) {
- if (linkEdit != null && linkEdit.isApplied())
- linkEdit.undo();
- if (compoundEdit != null && compoundEdit.isApplied())
- compoundEdit.undo();
- }
-
- private EventHandlingInputPort getSinkPort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- InputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityInputPort(activity, portName);
- // check if processor port exists
- EventHandlingInputPort input = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorInputPort(processor, activity, activityPort);
- if (input == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorInputPort processorInputPort = edits
- .createProcessorInputPort(processor,
- activityPort.getName(), activityPort.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- input = processorInputPort;
- }
- return input;
- }
-
- private EventForwardingOutputPort getSourcePort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- OutputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityOutputPort(activity, portName);
- // check if processor port exists
- EventForwardingOutputPort output = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorOutputPort(processor, activity, activityPort);
- if (output == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorOutputPort processorOutputPort = edits
- .createProcessorOutputPort(processor, activityPort
- .getName(), activityPort.getDepth(), activityPort
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- output = processorOutputPort;
- }
- return output;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java
deleted file mode 100644
index fea1860..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- *
- */
-package net.sf.taverna.t2.activities.biomoby.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivityConfigurationBean;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author Stuart Owen
- *
- */
-public class AddUpstreamObjectEdit extends AbstractDataflowEdit {
-
- private static Logger logger = Logger.getLogger(AddUpstreamObjectEdit.class);
-
- private final Processor sinkProcessor;
- private final BiomobyObjectActivity activity;
- private Edits edits;
-
- private List<Edit<?>> subEdits = new ArrayList<Edit<?>>();
-
- /**
- * @param dataflow
- */
- public AddUpstreamObjectEdit(Dataflow dataflow, Processor sinkProcessor,
- BiomobyObjectActivity activity, Edits edits) {
- super(dataflow);
- this.sinkProcessor = sinkProcessor;
- this.activity = activity;
- this.edits = edits;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit#doEditAction
- * (net.sf.taverna.t2.workflowmodel.impl.DataflowImpl)
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- subEdits.clear();
-
- for (InputPort inputPort : activity.getInputPorts()) {
- // ignore article name, id, namespace, value
- if (inputPort.getName().equals("namespace")
- || inputPort.getName().equals("id")
- || inputPort.getName().equals("article name")
- || inputPort.getName().equals("value")) {
- continue;
- }
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- String defaultName = inputPort.getName().split("\\(")[0];
-
- String name = Tools
- .uniqueProcessorName(inputPort.getName(), dataflow);
-
- BiomobyObjectActivityConfigurationBean configBean = new BiomobyObjectActivityConfigurationBean();
- configBean.setMobyEndpoint(activity.getConfiguration()
- .getMobyEndpoint());
- configBean.setAuthorityName("");
- configBean.setServiceName(defaultName);
-
- net.sf.taverna.t2.workflowmodel.Processor sourceProcessor = edits
- .createProcessor(name);
- BiomobyObjectActivity boActivity = new BiomobyObjectActivity();
- Edit<?> configureActivityEdit = edits.getConfigureActivityEdit(
- boActivity, configBean);
- editList.add(configureActivityEdit);
-
- editList.add(edits.getDefaultDispatchStackEdit(sourceProcessor));
-
- Edit<?> addActivityToProcessorEdit = edits.getAddActivityEdit(
- sourceProcessor, boActivity);
- editList.add(addActivityToProcessorEdit);
-
-
-
- editList.add(edits.getAddProcessorEdit(dataflow, sourceProcessor));
-
- CompoundEdit compoundEdit = new CompoundEdit(editList);
- subEdits.add(compoundEdit);
- compoundEdit.doEdit();
-
-
- List<Edit<?>> linkEditList = new ArrayList<Edit<?>>();
-
- EventForwardingOutputPort sourcePort = getSourcePort(
- sourceProcessor, boActivity, "mobyData", linkEditList);
- EventHandlingInputPort sinkPort = getSinkPort(sinkProcessor, activity, inputPort.getName(), linkEditList);
- linkEditList.add(Tools.getCreateAndConnectDatalinkEdit(dataflow,
- sourcePort, sinkPort, edits));
- CompoundEdit linkEdit = new CompoundEdit(linkEditList);
- subEdits.add(linkEdit);
- linkEdit.doEdit();
-
- if (!(defaultName.equalsIgnoreCase("Object")
- || name.equalsIgnoreCase("String")
- || name.equalsIgnoreCase("Integer") || name
- .equalsIgnoreCase("DateTime"))) {
- Edit upstreamObjectEdit = new AddUpstreamObjectEdit(dataflow,
- sourceProcessor, boActivity, edits);
- subEdits.add(upstreamObjectEdit);
- upstreamObjectEdit.doEdit();
- }
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * net.sf.taverna.t2.workflowmodel.impl.AbstractDataflowEdit#undoEditAction
- * (net.sf.taverna.t2.workflowmodel.impl.DataflowImpl)
- */
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (subEdits != null && subEdits.size() > 0) {
- for (int i = subEdits.size() - 1; i >= 0; i--) {
- Edit<?> edit = subEdits.get(i);
- if (edit.isApplied())
- edit.undo();
- }
- }
-
-
- }
-
- private EventHandlingInputPort getSinkPort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- InputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityInputPort(activity, portName);
- // check if processor port exists
- EventHandlingInputPort input = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorInputPort(processor, activity, activityPort);
- if (input == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorInputPort processorInputPort = edits
- .createProcessorInputPort(processor,
- activityPort.getName(), activityPort.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- input = processorInputPort;
- }
- return input;
- }
-
- private EventForwardingOutputPort getSourcePort(
- net.sf.taverna.t2.workflowmodel.Processor processor,
- Activity<?> activity, String portName, List<Edit<?>> editList) {
- OutputPort activityPort = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getActivityOutputPort(activity, portName);
- // check if processor port exists
- EventForwardingOutputPort output = net.sf.taverna.t2.workflowmodel.utils.Tools
- .getProcessorOutputPort(processor, activity, activityPort);
- if (output == null) {
- // port doesn't exist so create a processor port and map it
- ProcessorOutputPort processorOutputPort = edits
- .createProcessorOutputPort(processor, activityPort
- .getName(), activityPort.getDepth(), activityPort
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- activityPort.getName(), activityPort.getName()));
- output = processorOutputPort;
- }
- return output;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java
deleted file mode 100644
index cee5420..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.actions.MobyServiceDetailsAction;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workflowmodel.Edits;
-
-public class BiomobyActivityDetailsMenuAction extends
- AbstractConfigureActivityMenuAction<BiomobyActivity> {
-
- private static final String CONFIGURE_BIOMOBY_DETAILS = "Browse Biomoby service details";
- private EditManager editManager;
- private FileManager fileManager;
-
- public BiomobyActivityDetailsMenuAction() {
- super(BiomobyActivity.class);
- }
-
- @Override
- protected Action createAction() {
- MobyServiceDetailsAction configAction = new MobyServiceDetailsAction(
- findActivity(), getParentFrame(), editManager, fileManager);
- configAction.putValue(Action.NAME, CONFIGURE_BIOMOBY_DETAILS);
- addMenuDots(configAction);
- return configAction;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java
deleted file mode 100644
index b760bbc..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.actions.MobyParserAction;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-public class BiomobyActivityParserMenuAction extends
- AbstractConfigureActivityMenuAction<BiomobyActivity> {
-
- private static final String ADD_BIOMOBY_PARSER = "Add Biomoby parser";
-
- private EditManager editManager;
-
- private FileManager fileManager;
-
- public BiomobyActivityParserMenuAction() {
- super(BiomobyActivity.class);
- }
-
- @Override
- protected Action createAction() {
- MobyParserAction configAction = new MobyParserAction(
- findActivity(), getParentFrame(), editManager, fileManager);
- configAction.putValue(Action.NAME, ADD_BIOMOBY_PARSER);
- addMenuDots(configAction);
- return configAction;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java
deleted file mode 100644
index b86df2a..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.actions.BiomobyActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-public class ConfigureBiomobyMenuAction extends
- AbstractConfigureActivityMenuAction<BiomobyActivity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
-
- public ConfigureBiomobyMenuAction() {
- super(BiomobyActivity.class);
- }
-
- @Override
- protected Action createAction() {
- BiomobyActivity a = findActivity();
- Action result = null;
- result = new BiomobyActivityConfigurationAction(a, getParentFrame(), editManager,
- fileManager, activityIconManager);
- result.putValue(Action.NAME, "Configure");
- addMenuDots(result);
- return result;
- }
-
- public boolean isEnabled() {
- BiomobyActivity activity = findActivity();
- return (super.isEnabled() && (activity.getMobyService() != null) && activity
- .containsSecondaries());
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java
deleted file mode 100644
index 2c28c32..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.query;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- *
- * @author Alex Nenadic
- *
- */
-public class BiomobyActivityIcon implements ActivityIconSPI{
-
- public int canProvideIconScore(Activity<?> activity) {
- if (activity.getClass().getName().equals(BiomobyActivity.class.getName()))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(Activity<?> activity) {
- return getBiomobyIcon();
- }
-
- public static Icon getBiomobyIcon() {
- return new ImageIcon(BiomobyActivityIcon.class.getResource("/registry.gif"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java
deleted file mode 100644
index a799280..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.query;
-
-
-public class BiomobyActivityItem /*extends AbstractActivityItem */{
-
- String registryUrl;
- String serviceName;
- String authorityName;
- String registryUri;
- String category;
- String serviceType;
-
- public String getRegistryUri() {
- return registryUri;
- }
-
- public void setRegistryUri(String registryUri) {
- this.registryUri = registryUri;
- }
-
- public String getRegistryUrl() {
- return registryUrl;
- }
-
- public void setRegistryUrl(String registryUrl) {
- this.registryUrl = registryUrl;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getAuthorityName() {
- return authorityName;
- }
-
- public void setAuthorityName(String authorityName) {
- this.authorityName = authorityName;
- }
-
-// @Override
-// public Object getConfigBean() {
-// BiomobyActivityConfigurationBean bean = new BiomobyActivityConfigurationBean();
-// bean.setAuthorityName(getAuthorityName());
-// bean.setServiceName(getServiceName());
-// bean.setMobyEndpoint(getRegistryUrl());
-// return bean;
-// }
-//
-// @Override
-// public Icon getIcon() {
-// return BiomobyActivityIcon.getBiomobyIcon();
-// }
-//
-// @Override
-// public Activity<?> getUnconfiguredActivity() {
-// return new BiomobyActivity();
-// }
-
- public String getType() {
- return "Biomoby";
- }
-
- @Override
- public String toString() {
- return getServiceName();
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java
deleted file mode 100644
index f4575e4..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.query;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- *
- * @author Alex Nenadic
- *
- */
-public class BiomobyObjectActivityIcon implements ActivityIconSPI{
-
- public int canProvideIconScore(Activity<?> activity) {
- if (activity.getClass().getName().equals(BiomobyObjectActivity.class.getName()))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(Activity<?> activity) {
- return new ImageIcon(BiomobyObjectActivityIcon.class.getResource("/biomoby_object.png"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java
deleted file mode 100644
index 1e50d37..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.query;
-
-
-/**
- *
- * @author Alex Nenadic
- * @author Stuart Owen
- *
- */
-public class BiomobyObjectActivityItem /*extends AbstractActivityItem*/ {
-
- String registryUrl;
- String serviceName;
- String authorityName;
- String registryUri;
-
- public String getRegistryUri() {
- return registryUri;
- }
-
- public void setRegistryUri(String registryUri) {
- this.registryUri = registryUri;
- }
-
- public String getRegistryUrl() {
- return registryUrl;
- }
-
- public void setRegistryUrl(String registryUrl) {
- this.registryUrl = registryUrl;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getAuthorityName() {
- return authorityName;
- }
-
- public void setAuthorityName(String authorityName) {
- this.authorityName = authorityName;
- }
-
-// @Override
-// public Object getConfigBean() {
-// BiomobyObjectActivityConfigurationBean bean = new BiomobyObjectActivityConfigurationBean();
-// bean.setAuthorityName(getAuthorityName());
-// bean.setServiceName(getServiceName());
-// bean.setMobyEndpoint(getRegistryUrl());
-// return bean;
-// }
-//
-// @Override
-// public Icon getIcon() {
-// return new ImageIcon(BiomobyObjectActivityItem.class.getResource("/biomoby_object.png"));
-// }
-//
-// @Override
-// public Activity<?> getUnconfiguredActivity() {
-// return new BiomobyObjectActivity();
-// }
-
- public String getType() {
- return "Biomoby Object";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java
deleted file mode 100644
index e22b78c..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.query;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import net.sf.taverna.raven.appconfig.ApplicationRuntime;
-import net.sf.taverna.t2.activities.biomoby.GetOntologyThread;
-import net.sf.taverna.t2.activities.biomoby.datatypedescriptions.BiomobyDatatypeDescription;
-import net.sf.taverna.t2.activities.biomoby.servicedescriptions.BiomobyServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider.FindServiceDescriptionsCallBack;
-
-import org.apache.log4j.Logger;
-import org.biomoby.client.CentralDigestCachedImpl;
-import org.biomoby.client.CentralImpl;
-import org.biomoby.shared.MobyDataType;
-import org.biomoby.shared.MobyException;
-import org.biomoby.shared.MobyService;
-import org.w3c.dom.Document;
-
-public class BiomobyQueryHelper {
-
- private static Logger log = Logger.getLogger(BiomobyQueryHelper.class);
-
- private String registryNamespace;
- private String registryEndpoint;
-
- private CentralDigestCachedImpl central;
-
- private String DEFAULT_REGISTRY_ENDPOINT = CentralImpl.DEFAULT_ENDPOINT;
-
- private String DEFAULT_REGISTRY_NAMESPACE = CentralImpl.DEFAULT_NAMESPACE;
-
- private String remoteDatatypeRdfUrl = null;
-
- private String remoteServiceRdfUrl = null;
-
- private static final String CACHE_NAME = "moby-cache";
-
- private ApplicationRuntime applicationRuntime = ApplicationRuntime
- .getInstance();
-
- public BiomobyQueryHelper(String registryEndpoint, String registryNamespace)
- throws MobyException {
- try {
- if (registryNamespace != null)
- this.registryNamespace = registryNamespace;
- else
- this.registryNamespace = DEFAULT_REGISTRY_NAMESPACE;
- if (registryEndpoint != null)
- this.registryEndpoint = registryEndpoint;
- else
- this.registryEndpoint = DEFAULT_REGISTRY_ENDPOINT;
- String tavernaHome = null;
- if (applicationRuntime.getApplicationHomeDir() != null) {
- tavernaHome = applicationRuntime.getApplicationHomeDir()
- .getAbsolutePath();
- }
- String cacheLoc = tavernaHome;
- if (cacheLoc == null || cacheLoc.trim().length() == 0)
- cacheLoc = "";
- if (!cacheLoc.endsWith(System.getProperty("file.separator")))
- cacheLoc += File.separator;
-
- central = new CentralDigestCachedImpl(this.registryEndpoint,
- this.registryNamespace, cacheLoc + CACHE_NAME);
-
- } catch (MobyException e) {
- //
- log.warn("There was a problem in initializing the caching agent, therefor caching is disabled.",
- e);
- }
- // now we try to speed up the loading of the datatypes ontology
- try {
- new GetOntologyThread(central.getRegistryEndpoint()).start();
- } catch (Exception e) {
- /* don't care if an exception occurs here ... */
- }
- // just call this to ensure that the registry is valid
- // throws exception if it isnt
- central.getResourceRefs();
- }
-
- /**
- *
- * @return an ArrayList of BiomobyActivityItem
- * @throws MobyException
- * if something goes wrong
- */
- public synchronized ArrayList<BiomobyActivityItem> getServices()
- throws MobyException {
- central.updateCache(CentralDigestCachedImpl.CACHE_PART_SERVICES);
- MobyService[] services = central.getServices();
- SortedMap<String, SortedSet<MobyService>> map = new TreeMap<String, SortedSet<MobyService>>();
- for (MobyService service : services) {
- String authority = service.getAuthority();
- SortedSet<MobyService> set;
- if (map.containsKey(authority)) {
- set = map.remove(authority);
- set.add(service);
- map.put(authority, set);
- } else {
- set = new TreeSet<MobyService>(new Comparator<MobyService>() {
- public int compare(MobyService o1, MobyService o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- set.add(service);
- map.put(authority, set);
- }
- }
- ArrayList<BiomobyActivityItem> authorityList = new ArrayList<BiomobyActivityItem>();
- for (String authority_name : map.keySet()) {
- for (MobyService service : map.get(authority_name)) {
- String serviceName = service.getName();
- // if (service.getStatus() != MobyService.UNCHECKED) {
- // f.setAlive((service.getStatus() & MobyService.ALIVE) == 2);
- // }
- BiomobyActivityItem item = makeActivityItem(registryEndpoint,
- registryNamespace, authority_name, serviceName);
- item.setCategory(service.getCategory());
- item.setServiceType(service.getServiceType() == null ? "Service"
- : service.getServiceType().getName());
- authorityList.add(item);
- }
- }
- return authorityList;
-
- }
-
- private BiomobyActivityItem makeActivityItem(String url, String uri,
- String authorityName, String serviceName) {
- BiomobyActivityItem item = new BiomobyActivityItem();
- item.setAuthorityName(authorityName);
- item.setServiceName(serviceName);
- item.setRegistryUrl(url);
- item.setRegistryUri(uri);
- return item;
- }
-
- public String getRemoteDatatypeRdfUrl() {
- return remoteDatatypeRdfUrl;
- }
-
- public String getRemoteServiceRdfUrl() {
- return remoteServiceRdfUrl;
- }
-
- public static Document loadDocument(InputStream input) throws MobyException {
- try {
- DocumentBuilderFactory dbf = (DocumentBuilderFactory) DOCUMENT_BUILDER_FACTORIES
- .get();
- DocumentBuilder db = dbf.newDocumentBuilder();
- return (db.parse(input));
- } catch (Exception e) {
- throw new MobyException("Problem with reading XML input: "
- + e.toString(), e);
- }
- }
-
- public static ThreadLocal<DocumentBuilderFactory> DOCUMENT_BUILDER_FACTORIES = new ThreadLocal<DocumentBuilderFactory>() {
- protected synchronized DocumentBuilderFactory initialValue() {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- return dbf;
- }
- };
-
- public void findServiceDescriptionsAsync(
- FindServiceDescriptionsCallBack callBack) {
- try {
- central.updateCache(CentralDigestCachedImpl.CACHE_PART_SERVICES);
- } catch (MobyException ex) {
- callBack.fail("Can't update the Biomoby cache", ex);
- return;
- }
- MobyService[] services;
- try {
- services = central.getServices();
- } catch (MobyException ex) {
- callBack.fail("Can't get BioMoby services", ex);
- return;
- }
- List<BiomobyServiceDescription> serviceDescriptions = new ArrayList<BiomobyServiceDescription>();
- for (MobyService service : services) {
- BiomobyServiceDescription serviceDesc = new BiomobyServiceDescription();
- serviceDesc.setEndpoint(URI.create(registryEndpoint));
- serviceDesc.setNamespace(URI.create(registryNamespace));
- serviceDesc.setAuthorityName(service.getAuthority());
- serviceDesc.setServiceName(service.getName());
- serviceDesc.setCategory(service.getCategory());
- serviceDesc.setDescription(service.getDescription());
- String lsid = service.getLSID();
- if (lsid != null && lsid.length() > 0) {
- serviceDesc.setLSID(URI.create(lsid));
- }
- serviceDesc.setEmailContact(service.getEmailContact());
- serviceDesc.setServiceType(service.getServiceType() == null ? "Service"
- : service.getServiceType().getName());
- String signatureURL = service.getSignatureURL();
- if (signatureURL != null && signatureURL.length() > 0) {
- serviceDesc.setSignatureURI(URI.create(signatureURL));
- }
- serviceDescriptions.add(serviceDesc);
- }
- callBack.partialResults(serviceDescriptions);
- callBack.partialResults(findDatatypeDescriptions());
- callBack.finished();
- }
-
- public List<BiomobyDatatypeDescription> findDatatypeDescriptions() {
- try {
- central.updateCache(CentralDigestCachedImpl.CACHE_PART_DATATYPES);
- } catch (MobyException ex) {
-
- return new ArrayList<BiomobyDatatypeDescription>();
- }
- MobyDataType[] datatypes;
- try {
- datatypes = central.getDataTypes();
- } catch (MobyException ex) {
-
- return new ArrayList<BiomobyDatatypeDescription>();
- }
- List<BiomobyDatatypeDescription> datatypeDescriptions = new ArrayList<BiomobyDatatypeDescription>();
- for (MobyDataType datatype : datatypes) {
- BiomobyDatatypeDescription dataDesc = new BiomobyDatatypeDescription();
- dataDesc.setAuthorityName(datatype.getAuthority());
- dataDesc.setDatatypeName(datatype.getName());
- dataDesc.setEmailContact(datatype.getEmailContact());
- dataDesc.setEndpoint(URI.create(registryEndpoint));
- dataDesc.setNamespace(URI.create(registryNamespace));
- dataDesc.setParent(datatype.getParentName());
- dataDesc.setDescription(datatype.getDescription());
- String lsid = datatype.getLSID();
- if (lsid != null && lsid.length() > 0) {
- try {
- dataDesc.setLsid(URI.create(lsid));
- } catch (Exception e) {
-
- }
- }
- ArrayList<String> lineage = new ArrayList<String>();
- if (datatype.getParent() == null && !datatype.getName().equals("Object")) {
- lineage.add("Object");
- lineage.add(datatype.getName());
- } else
- for (MobyDataType d : datatype.getLineage())
- if (!d.getName().equals(datatype.getName()))
- lineage.add(d.getName());
- dataDesc.setLineage(lineage.toArray(new String[]{}));
- datatypeDescriptions.add(dataDesc);
- }
- return datatypeDescriptions;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java
deleted file mode 100644
index 37d677e..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*******************************************************************************
- * This file is a component of the Taverna project, and is licensed under the
- * GNU LGPL. Copyright Edward Kawas, The BioMoby Project
- ******************************************************************************/
-/*
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Edward Kawas, Martin Senger, The BioMoby Project
- */
-
-package net.sf.taverna.t2.activities.biomoby.query;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.ConnectException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Comparator;
-
-import org.apache.log4j.Logger;
-import org.biomoby.shared.MobyException;
-
-/**
- * An implementation of {@link org.biomoby.shared.CentralAll}, allowing to
- * cache locally results of the cumulative methods so it does not need to access
- * Moby registry all the time. The other methods of the Central interface do not
- * use the results of the cached cumulative results (their implementation is
- * just passed to the parent class).
- * <p>
- *
- * The caching is done in the file system, not in memory, so the results are
- * permanent (until someone removes the caching directory, or calls
- * {@link #removeFromCache}).
- * <p>
- *
- * This class can be used also without caching - just instantiate it with
- * 'cacheDir' set to null in the constructor.
- * <p>
- *
- * @author <A HREF="mailto:martin.senger@gmail.com">Martin Senger</A>
- * @version $Id: CacheImpl.java,v 1.2 2008/09/04 13:42:16 sowen70 Exp $
- */
-
-public class CacheImpl {
-
- private static Logger log = Logger.getLogger(CacheImpl.class);
-
- // filename for a list of cached entities
- protected static final String LIST_FILE = "__L__S__I__D__S__";
-
- /** An ID used in {@link #removeFromCache} indicating data types part. */
- public static final String CACHE_PART_DATATYPES = "c1";
-
- /** An ID used in {@link #removeFromCache} indicating services part. */
- public static final String CACHE_PART_SERVICES = "c2";
-
- public static final String CACHE_PROP_NAME = "cache-name";
-
- public static final String CACHE_PROP_COUNT = "cache-count";
-
- public static final String CACHE_PROP_OLDEST = "cache-oldest";
-
- public static final String CACHE_PROP_YOUNGEST = "cache-youngest";
-
- public static final String CACHE_PROP_SIZE = "cache-size";
-
- public static final String CACHE_PROP_LOCATION = "cache-loc";
-
- // DEFAULT registry
- private String MOBYCENTRAL_REGISTRY_URL = "http://moby.ucalgary.ca/moby/MOBY-Central.pl";
-
- // Default Endpoint
- private String MOBYCENTRAL_REGISTRY_URI = "http://moby.ucalgary.ca/MOBY/Central";
-
- // cache location
- private String cacheDir; // as defined in the constructor
-
- protected File dataTypesCache;
-
- protected File servicesCache;
-
- public static final String SERVICE_INSTANCE_FILENAME = "SERVICE_INSTANCE.rdf";
-
- private String serviceInstanceRDFLocation = SERVICE_INSTANCE_FILENAME;
-
- public static final String DATATYPE_FILENAME = "DATATYPES.rdf";
-
- private String datatypeRDFLocation = DATATYPE_FILENAME;
-
- // for optimalization
- private String fileSeparator;
-
- /***************************************************************************
- * Create an instance that will access a default Moby registry and will
- * cache results in the 'cacheDir' directory.
- * <p>
- **************************************************************************/
- public CacheImpl(String cacheDir) throws MobyException {
- this(null, null, cacheDir);
- }
-
- /***************************************************************************
- * Create an instance that will access a Moby registry defined by its
- * 'endpoint' and 'namespace', and will cache results in the 'cacheDir'
- * directory. Note that the same 'cacheDir' can be safely used for more Moby
- * registries.
- * <p>
- **************************************************************************/
- public CacheImpl(String endpoint, String namespace, String cacheDir)
- throws MobyException {
- if (endpoint != null && !endpoint.trim().equals(""))
- this.MOBYCENTRAL_REGISTRY_URL = endpoint;
- if (namespace != null && !namespace.trim().equals(""))
- this.MOBYCENTRAL_REGISTRY_URI = namespace;
- fileSeparator = System.getProperty("file.separator");
- this.cacheDir = cacheDir;
- initCache();
- }
-
- // it makes all necessary directories for cache given in the
- // constructor (which is now in global 'cacheDir'); it is
- // separated here because it can be called either from the
- // constructor, or everytime a cache is going to be used but it is
- // not there (somebody removed it)
- protected void initCache() throws MobyException {
- if (cacheDir != null) {
- File cache = createCacheDir(cacheDir, MOBYCENTRAL_REGISTRY_URL);
- dataTypesCache = createSubCacheDir(cache, "datatype_rdf");
- servicesCache = createSubCacheDir(cache, "service_rdf");
- serviceInstanceRDFLocation = servicesCache.getPath()
- + fileSeparator + SERVICE_INSTANCE_FILENAME;
- datatypeRDFLocation = dataTypesCache.getPath() + fileSeparator
- + DATATYPE_FILENAME;
- }
- }
-
- /***************************************************************************
- * Return a directory name representing the current cache. This is the same
- * name as given in constructors.
- * <p>
- *
- * @return current cache directory name
- **************************************************************************/
- public String getCacheDir() {
- return cacheDir;
- }
-
- /***************************************************************************
- * Removes object groups from the cache. If 'id' is null it removes the
- * whole cache (for that Moby registry this instance was initiated for).
- * Otherwise 'id' indicates which part of the cache that will be removed.
- * <p>
- *
- * @param id
- * should be either null, or one of the following:
- * {@link #CACHE_PART_DATATYPES}, {@link #CACHE_PART_SERVICES},
- * {@link #CACHE_PART_SERVICETYPES}, and {@link
- * #CACHE_PART_NAMESPACES}.
- **************************************************************************/
- public void removeFromCache(String id) {
- try {
- if (cacheDir != null) {
- String[] parts = null;
- if (id == null)
- parts = new String[] { "datatype_rdf", "service_rdf" };
- else if (id.equals(CACHE_PART_SERVICES))
- parts = new String[] { "service_rdf" };
- else if (id.equals(CACHE_PART_DATATYPES))
- parts = new String[] { "datatype_rdf" };
- if (parts != null) {
- removeCacheDir(cacheDir, MOBYCENTRAL_REGISTRY_URL, parts);
- }
- }
- } catch (MobyException e) {
- log.error("Removing cache failed: " + e.getMessage());
- }
- }
-
- /**
- * Create a cache directory from 'cacheDirectory' and 'registryId' if it
- * does not exist yet. Make sure that it is writable. Return a File
- * representing created directory.
- *
- * 'registryId' (which may be null) denotes what registry this cache is
- * going to be created for. If null, an endpoint of a default Moby registry
- * is used.
- */
- protected File createCacheDir(String cacheDirectory, String registryId)
- throws MobyException {
- if (registryId == null || registryId.equals(""))
- registryId = MOBYCENTRAL_REGISTRY_URL;
- File cache = new File(cacheDirectory + fileSeparator
- + clean(registryId));
- try {
- if (!cache.exists())
- if (!cache.mkdirs())
- throw new MobyException("Cannot create '"
- + cache.getAbsolutePath() + "'.");
- if (!cache.isDirectory())
- throw new MobyException("Cache location '"
- + cache.getAbsolutePath()
- + "' exists but it is not a directory.");
- if (!cache.canWrite())
- throw new MobyException("Cache location '"
- + cache.getAbsolutePath() + "' is not writable for me.");
- return cache;
- } catch (SecurityException e) {
- throw new MobyException("Cannot handle cache location '"
- + cache.getAbsolutePath() + "'. " + e.toString());
- }
- }
-
- /**
- * Remove cache and all (but given in 'subCacheDirNames') its
- * subdirectories.
- */
- protected void removeCacheDir(String cacheDirectory, String registryId,
- String[] subCacheDirNames) throws MobyException {
- if (registryId == null || registryId.equals(""))
- registryId = MOBYCENTRAL_REGISTRY_URL;
- File cache = new File(cacheDirectory + fileSeparator
- + clean(registryId));
- try {
- if (!cache.exists())
- return;
- if (!cache.isDirectory())
- throw new MobyException("Cache location '"
- + cache.getAbsolutePath()
- + "' exists but it is not a directory.");
- if (!cache.canWrite())
- throw new MobyException("Cache location '"
- + cache.getAbsolutePath() + "' is not writable for me.");
- for (int i = 0; i < subCacheDirNames.length; i++) {
- File cacheSubDir = new File(cache.getAbsolutePath()
- + fileSeparator + clean(subCacheDirNames[i]));
- File[] files = cacheSubDir.listFiles();
- for (int f = 0; f < files.length; f++) {
- if (files[f].isDirectory())
- throw new MobyException("Found a directory '"
- + files[f].getAbsolutePath()
- + "' where no directory should be");
- if (!files[f].delete())
- log.error("Can't delete file '" + files[f] + "'.");
- }
- cacheSubDir.delete();
- }
- cache.delete();
-
- } catch (SecurityException e) {
- throw new MobyException("Cannot handle cache location '"
- + cache.getAbsolutePath() + "'. " + e.toString());
- }
- }
-
- //
- protected File createSubCacheDir(File mainCache, String subCacheDirName)
- throws MobyException {
- File cache = new File(mainCache.getAbsolutePath() + fileSeparator
- + clean(subCacheDirName));
- try {
- if (!cache.exists())
- if (!cache.mkdirs())
- throw new MobyException("Cannot create '"
- + cache.getAbsolutePath() + "'.");
- return cache;
- } catch (SecurityException e) {
- throw new MobyException("Cannot handle cache location '"
- + cache.getAbsolutePath() + "'. " + e.toString());
- }
- }
-
- /***************************************************************************
- * Replace non digit/letter characters in 'toBeCleaned' by their numeric
- * value. If there are more such numeric values side by side, put a dot
- * between them. Return the cleaned string.
- **************************************************************************/
- protected static String clean(String toBeCleaned) {
-
- char[] chars = toBeCleaned.toCharArray();
- int len = chars.length;
- int i = -1;
- while (++i < len) {
- char c = chars[i];
- if (!Character.isLetterOrDigit(c) && c != '_')
- break;
- }
- if (i < len) {
- StringBuffer buf = new StringBuffer(len * 2);
- for (int j = 0; j < i; j++) {
- buf.append(chars[j]);
- }
- boolean lastOneWasDigitalized = false;
- while (i < len) {
- char c = chars[i];
- if (Character.isLetterOrDigit(c) || c == '_') {
- buf.append(c);
- lastOneWasDigitalized = false;
- } else {
- if (lastOneWasDigitalized)
- buf.append('.');
- buf.append((int) c);
- lastOneWasDigitalized = true;
- }
- i++;
- }
- return new String(buf);
- }
- return toBeCleaned;
- }
-
- // create a file and put into it data to be cached
- protected static void store(File cache, String name, String data)
- throws MobyException {
- // File outputFile = new File (cache.getAbsolutePath() + fileSeparator +
- // clean (name));
- File outputFile = new File(cache.getAbsolutePath()
- + System.getProperty("file.separator") + name);
- try {
- PrintWriter fileout = new PrintWriter(new BufferedOutputStream(
- new FileOutputStream(outputFile)));
- fileout.write(data);
- fileout.close();
- } catch (IOException e) {
- throw new MobyException("Cannot write to '"
- + outputFile.getAbsolutePath() + ". " + e.toString());
- }
- }
-
- // create a file from a url
- protected void storeURL(File cache, String name, String url)
- throws MobyException {
- File outputFile = new File(cache.getAbsolutePath() + fileSeparator
- + name);
- try {
- StringBuffer sb = new StringBuffer();
- String newline = System.getProperty("line.separator");
- HttpURLConnection urlConnection = null;
-
- URL rdf_url = new URL(url);
- urlConnection = (HttpURLConnection) rdf_url.openConnection();
- urlConnection.setDefaultUseCaches(false);
- urlConnection.setUseCaches(false);
- urlConnection.setRequestProperty ( "User-agent", "Taverna_BioMOBY/1.5");
- urlConnection.setConnectTimeout(1000*60*5);
-
- BufferedReader in = new BufferedReader(new InputStreamReader(
- urlConnection.getInputStream()));
- String inputLine;
- while ((inputLine = in.readLine()) != null)
- sb.append(inputLine + newline);
- in.close();
-
- PrintWriter fileout = new PrintWriter(new BufferedOutputStream(
- new FileOutputStream(outputFile)));
- fileout.write(sb.toString());
- fileout.close();
- } catch (ConnectException e) {
- throw new MobyException("Cannot read from url '"
- + url + "'. " + e.toString());
- } catch (IOException e) {
- throw new MobyException("Cannot write to '"
- + outputFile.getAbsolutePath() + "'. " + e.toString());
- } catch (Exception e) {
- throw new MobyException("Unexpected Exception caught: " + e.toString());
- }
- }
-
- // remove a file from a cache
- protected void remove(File cache, String name) {
- File file = new File(cache, name);
- // do not throw here an exception because a missing file
- // can be a legitimate status (e.g. for LIST_FILE when we
- // are updating)
- file.delete();
- }
-
- /***************************************************************************
- * Read a cached file
- **************************************************************************/
- protected static String load(File file) throws MobyException {
- try {
- StringBuffer buf = new StringBuffer();
- BufferedReader in = new BufferedReader(new FileReader(file));
- char[] buffer = new char[1024];
- int charsRead;
-
- while ((charsRead = in.read(buffer, 0, 1024)) != -1) {
- buf.append(buffer, 0, charsRead);
- }
-
- return new String(buf);
-
- } catch (Throwable e) { // be prepare for "out-of-memory" error
- throw new MobyException("Serious error when reading from cache. "
- + e.toString());
-
- }
- }
-
- /***************************************************************************
- * Is the given cache empty (meaning: cache directory does not exist, is
- * empty, or contains only files to be ignored)?
- **************************************************************************/
- protected boolean isCacheEmpty(File cache) throws MobyException {
- if (cache == null)
- return true;
- String[] list = cache.list();
- if (list == null || list.length == 0)
- return true;
- for (int i = 0; i < list.length; i++) {
- if (!ignoredForEmptiness(new File(list[i])))
- return false;
- }
- return true;
- }
-
- /***************************************************************************
- * A LIST_FILE is a TOC of a cache object (each cache part has its own
- * LIST_FILE). Read it and return it. If it does not exist, return null.
- **************************************************************************/
- protected static String getListFile(File cache) throws MobyException {
- File listFile = new File(cache, LIST_FILE);
- if (!listFile.exists())
- return null;
- return load(listFile);
- }
-
- /***************************************************************************
- * A LIST_FILE is a TOC of a cache object (each cache part has its own
- * LIST_FILE). Read it and return it. If it does not exist, return null.
- **************************************************************************/
- protected static void storeListFile(File cache, String data)
- throws MobyException {
- CacheImpl.store(cache, LIST_FILE, data);
- }
-
- /***************************************************************************
- * Return a comparator for Files that compares in case-insensitive way.
- **************************************************************************/
- protected static Comparator getFileComparator() {
- return new Comparator() {
- public int compare(Object o1, Object o2) {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- };
- }
-
- /***************************************************************************
- * Some file (when being read from a cache directory) are ignored.
- **************************************************************************/
- protected static boolean ignored(File file) {
- String path = file.getPath();
- return path.endsWith("~") || path.endsWith(LIST_FILE);
- }
-
- /***************************************************************************
- * Some file (when a cache is being tested fir emptyness) are ignored.
- **************************************************************************/
- protected static boolean ignoredForEmptiness(File file) {
- String path = file.getPath();
- return path.endsWith("~");
- }
-
- /***************************************************************************
- *
- **************************************************************************/
- protected static String MSG_CACHE_NOT_DIR(File cache) {
- return "Surprisingly, '" + cache.getAbsolutePath()
- + "' is not a directory. Strange...";
- }
-
- /***************************************************************************
- *
- **************************************************************************/
- protected static String MSG_CACHE_BAD_FILE(File file, Exception e) {
- return "Ignoring '" + file.getPath()
- + "'. It should not be in the cache directory:"
- + e.getMessage();
- }
-
- /***************************************************************************
- * Return age of the current (whole) cache in millis from the beginning of
- * the Epoch; or -1 if cache is empty, or the age is unknown.
- * <p>
- *
- * @return the cache age which is taken as the oldest (but filled) cache
- * part (part is considered e.g. 'services', or 'data types', not
- * their individual entities)
- **************************************************************************/
- public long getCacheAge() {
- try {
- long dataTypesCacheAge = (isCacheEmpty(dataTypesCache) ? Long.MAX_VALUE
- : dataTypesCache.lastModified());
- long servicesCacheAge = (isCacheEmpty(servicesCache) ? Long.MAX_VALUE
- : servicesCache.lastModified());
- long age = Math.min(dataTypesCacheAge, servicesCacheAge);
- return (age == Long.MAX_VALUE ? -1 : age);
- } catch (MobyException e) {
- return -1;
- }
- }
-
- /**
- * @return the serviceInstanceRDFLocation
- */
- public String getServiceInstanceRDFLocation() {
- return serviceInstanceRDFLocation;
- }
-
- /**
- * @param serviceInstanceRDFLocation
- * the serviceInstanceRDFLocation to set
- */
- public void setServiceInstanceRDFLocation(String serviceInstanceRDFLocation) {
- this.serviceInstanceRDFLocation = serviceInstanceRDFLocation;
- }
-
- /**
- * @return the mOBYCENTRAL_REGISTRY_URI
- */
- public String getMOBYCENTRAL_REGISTRY_URI() {
- return MOBYCENTRAL_REGISTRY_URI;
- }
-
- /**
- * @param mobycentral_registry_uri
- * the mOBYCENTRAL_REGISTRY_URI to set
- */
- public void setMOBYCENTRAL_REGISTRY_URI(String mobycentral_registry_uri) {
- MOBYCENTRAL_REGISTRY_URI = mobycentral_registry_uri;
- }
-
- /**
- * @return the MOBYCENTRAL_REGISTRY_URL
- */
- public String getMOBYCENTRAL_REGISTRY_URL() {
- return MOBYCENTRAL_REGISTRY_URL;
- }
-
- /**
- * @param mobycentral_registry_url
- * the MOBYCENTRAL_REGISTRY_URL to set
- */
- public void setMOBYCENTRAL_REGISTRY_URL(String mobycentral_registry_url) {
- MOBYCENTRAL_REGISTRY_URL = mobycentral_registry_url;
- }
-
- /**
- * @return the datatypeRDFLocation
- */
- public String getDatatypeRDFLocation() {
- return datatypeRDFLocation;
- }
-
- /**
- * @param datatypeRDFLocation the datatypeRDFLocation to set
- */
- public void setDatatypeRDFLocation(String datatypeRDFLocation) {
- this.datatypeRDFLocation = datatypeRDFLocation;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java
deleted file mode 100644
index f327e96..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.servicedescriptions;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyActivityIcon;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class BiomobyServiceDescription extends
- ServiceDescription<BiomobyActivityConfigurationBean> {
-
- private String authorityName;
- private String category;
- private String emailContact;
- private URI endpoint;
-
- private URI lsid;
-
- private URI namespace;
- private String serviceName;
- private String serviceType;
- private URI signatureURI;
-
- @Override
- public Class<? extends Activity<BiomobyActivityConfigurationBean>> getActivityClass() {
- return BiomobyActivity.class;
- }
-
- @Override
- public BiomobyActivityConfigurationBean getActivityConfiguration() {
- BiomobyActivityConfigurationBean bean = new BiomobyActivityConfigurationBean();
- bean.setAuthorityName(getAuthorityName());
- bean.setServiceName(getServiceName());
- bean.setMobyEndpoint(getEndpoint().toASCIIString());
- return bean;
- }
-
- public String getAuthorityName() {
- return authorityName;
- }
-
- public String getCategory() {
- return category;
- }
-
- public String getEmailContact() {
- return emailContact;
- }
-
- public URI getEndpoint() {
- return endpoint;
- }
-
- @Override
- public Icon getIcon() {
- return BiomobyActivityIcon.getBiomobyIcon();
- }
-
- public URI getLSID() {
- return lsid;
- }
-
- @Override
- public String getName() {
- return getServiceName();
- }
-
- public URI getNamespace() {
- return namespace;
- }
-
- @Override
- public List<String> getPath() {
- return Arrays.asList("Biomoby @ " + getEndpoint(), getServiceType(), getAuthorityName());
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public URI getSignatureURI() {
- return signatureURI;
- }
-
- public void setAuthorityName(String authorityName) {
- this.authorityName = authorityName;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public void setEmailContact(String emailContact) {
- this.emailContact = emailContact;
- }
-
- public void setEndpoint(URI endpoint) {
- this.endpoint = endpoint;
- }
-
- public void setLSID(URI lsid) {
- this.lsid = lsid;
- }
-
- public void setNamespace(URI namespace) {
- this.namespace = namespace;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public void setSignatureURI(URI signatureURI) {
- this.signatureURI = signatureURI;
- }
-
- @Override
- protected List<Object> getIdentifyingData() {
- return Arrays.<Object>asList(getNamespace(), getEndpoint(), getAuthorityName(), getServiceName());
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java
deleted file mode 100644
index a80c5fb..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.activities.biomoby.servicedescriptions;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyActivityIcon;
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyQueryHelper;
-import net.sf.taverna.t2.activities.biomoby.ui.AddBiomobyDialogue;
-import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-import org.biomoby.client.CentralImpl;
-import org.biomoby.shared.MobyException;
-
-public class BiomobyServiceProvider extends
- AbstractConfigurableServiceProvider<BiomobyServiceProviderConfig> implements
- CustomizedConfigurePanelProvider<BiomobyServiceProviderConfig> {
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/biomoby");
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
- public BiomobyServiceProvider() {
- super(new BiomobyServiceProviderConfig());
- }
-
- public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
- try {
- // constructor throws exception if it cannot communicate
- // with the registry
- BiomobyQueryHelper helper = new BiomobyQueryHelper(getConfiguration().getEndpoint()
- .toASCIIString(), getConfiguration().getNamespace().toASCIIString());
- helper.findServiceDescriptionsAsync(callBack);
- } catch (MobyException ex) {
- callBack.fail("Could not connect to Biomoby endpoint "
- + getConfiguration().getEndpoint(), ex);
- }
- }
-
- @Override
- public List<BiomobyServiceProviderConfig> getDefaultConfigurations() {
-
- List<BiomobyServiceProviderConfig> defaults = new ArrayList<BiomobyServiceProviderConfig>();
-
- // If defaults have failed to load from a configuration file then load them here.
- if (!serviceDescriptionRegistry.isDefaultSystemConfigurableProvidersLoaded()) {
- defaults.add(new BiomobyServiceProviderConfig(CentralImpl.DEFAULT_ENDPOINT,
- CentralImpl.DEFAULT_NAMESPACE));
- } // else return an empty list
-
- return defaults;
- }
-
- public String getName() {
- return "Biomoby service";
- }
-
- public Icon getIcon() {
- return BiomobyActivityIcon.getBiomobyIcon();
- }
-
- @Override
- public String toString() {
- return getName() + " " + getConfiguration().getEndpoint();
- }
-
- @SuppressWarnings("serial")
- public void createCustomizedConfigurePanel(
- final CustomizedConfigureCallBack<BiomobyServiceProviderConfig> callBack) {
- AddBiomobyDialogue addBiomobyDialogue = new AddBiomobyDialogue() {
- @Override
- protected void addRegistry(String registryEndpoint, String registryURI) {
- BiomobyServiceProviderConfig providerConfig = new BiomobyServiceProviderConfig(
- registryEndpoint, registryURI);
- callBack.newProviderConfiguration(providerConfig);
- }
- };
- addBiomobyDialogue.setVisible(true);
- }
-
- @Override
- protected List<? extends Object> getIdentifyingData() {
- List<String> result;
- result = Arrays.asList(getConfiguration().getEndpoint().toString());
- return result;
- }
-
- public String getId() {
- return providerId.toString();
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java
deleted file mode 100644
index 3f568c7..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.servicedescriptions;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
-
-public class BiomobyServiceProviderConfig extends PropertyAnnotated {
-
- private URI endpoint;
-
- private URI namespace;
-
- public BiomobyServiceProviderConfig() {
- }
-
- public BiomobyServiceProviderConfig(String endpoint, String namespace) {
- this.endpoint = URI.create(endpoint.trim());
- this.namespace = URI.create(namespace.trim());
- }
-
- public URI getEndpoint() {
- return endpoint;
- }
-
- public URI getNamespace() {
- return namespace;
- }
-
- public void setEndpoint(URI endpoint) {
- this.endpoint = endpoint;
- }
-
- public void setNamespace(URI namespace) {
- this.namespace = namespace;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/e13e3b74/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java
----------------------------------------------------------------------
diff --git a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java b/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java
deleted file mode 100644
index 99b82f9..0000000
--- a/taverna-biomoby-activity-ui/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package net.sf.taverna.t2.activities.biomoby.ui;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-
-import net.sf.taverna.t2.activities.biomoby.actions.BiomobyScavengerDialog;
-import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-import org.biomoby.client.CentralImpl;
-
-@SuppressWarnings("serial")
-public abstract class AddBiomobyDialogue extends HelpEnabledDialog {
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(AddBiomobyDialogue.class);
-
- private String endpoint = CentralImpl.DEFAULT_ENDPOINT;
-
- private String uri = CentralImpl.DEFAULT_NAMESPACE;
-
- public AddBiomobyDialogue() {
- super(MainWindow.getMainWindow(), "Add BioMoby Registry", true, null);
- initialize();
- setLocationRelativeTo(getParent());
- }
- public void initialize() {
- final BiomobyScavengerDialog msp = new BiomobyScavengerDialog();
- getContentPane().add(msp);
- JButton accept = new JButton(new OKAction(msp));
- JButton cancel = new JButton(new CancelAction());
- msp.add(accept);
- msp.add(cancel);
- setResizable(false);
- getContentPane().add(msp);
- setLocationRelativeTo(null);
- pack();
- }
-
- protected abstract void addRegistry(String registryEndpoint,
- String registryURI);
-
- public class CancelAction extends AbstractAction {
- public CancelAction() {
- super("Cancel");
- }
-
- public void actionPerformed(ActionEvent ae2) {
- if (isVisible()) {
- setVisible(false);
- dispose();
- }
- }
- }
-
- public class OKAction extends AbstractAction {
- private final BiomobyScavengerDialog scavengerDialogue;
-
- private OKAction(BiomobyScavengerDialog msp) {
- super("OK");
- this.scavengerDialogue = msp;
- }
-
- public void actionPerformed(ActionEvent ae2) {
- if (isVisible()) {
- String registryEndpoint = "";
- String registryNamespace = "";
-
- if (scavengerDialogue.getRegistryEndpoint().equals("")) {
- registryEndpoint = endpoint;
- } else {
- registryEndpoint = scavengerDialogue.getRegistryEndpoint();
- }
-
- if (scavengerDialogue.getRegistryEndpoint().equals("")) {
- registryNamespace = uri;
- } else {
- registryNamespace = scavengerDialogue.getRegistryURI();
- }
-
- try {
- addRegistry(registryEndpoint.trim(), registryNamespace.trim());
- } finally {
- setVisible(false);
- dispose();
- }
- }
- }
- }
-
-}