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 12:46:58 UTC

[31/50] [abbrv] incubator-taverna-plugin-bioinformatics git commit: taverna-biomoby-activity-ui/

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/edits/AddUpstreamObjectEdit.java
deleted file mode 100644
index fea1860..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityDetailsMenuAction.java
deleted file mode 100644
index cee5420..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/BiomobyActivityParserMenuAction.java
deleted file mode 100644
index b760bbc..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/menu/ConfigureBiomobyMenuAction.java
deleted file mode 100644
index b86df2a..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityIcon.java
deleted file mode 100644
index 2c28c32..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyActivityItem.java
deleted file mode 100644
index a799280..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityIcon.java
deleted file mode 100644
index f4575e4..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyObjectActivityItem.java
deleted file mode 100644
index 1e50d37..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/BiomobyQueryHelper.java
deleted file mode 100644
index e22b78c..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/query/CacheImpl.java
deleted file mode 100644
index 37d677e..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceDescription.java
deleted file mode 100644
index f327e96..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProvider.java
deleted file mode 100644
index a80c5fb..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/servicedescriptions/BiomobyServiceProviderConfig.java
deleted file mode 100644
index 3f568c7..0000000
--- a/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/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/AddBiomobyDialogue.java
deleted file mode 100644
index 99b82f9..0000000
--- a/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();
-				}
-			}
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/fd2e9765/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/BiomobyObjectTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/BiomobyObjectTree.java b/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/BiomobyObjectTree.java
deleted file mode 100644
index 7ca2578..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/biomoby/ui/BiomobyObjectTree.java
+++ /dev/null
@@ -1,635 +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.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.swing.ImageIcon;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTextField;
-import javax.swing.JTree;
-import javax.swing.ToolTipManager;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivity;
-import net.sf.taverna.t2.activities.biomoby.BiomobyObjectActivityConfigurationBean;
-import net.sf.taverna.t2.activities.biomoby.actions.MobyPanel;
-import net.sf.taverna.t2.activities.biomoby.datatypedescriptions.BiomobyDatatypeDescription;
-import net.sf.taverna.t2.activities.biomoby.edits.AddUpstreamObjectEdit;
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyObjectActivityItem;
-import net.sf.taverna.t2.activities.biomoby.query.BiomobyQueryHelper;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-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.Edits;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-import org.apache.log4j.Logger;
-import org.biomoby.client.CentralImpl;
-import org.biomoby.shared.MobyException;
-
-/**
- * Creates a Datatype tree for any BioMOBY registry. The tree allows the user to
- * add nodes to the workflow. Includes the ability to search for datatypes too.
- *
- * @author Eddie Kawas, The BioMoby Project
- *
- */
-public class BiomobyObjectTree {
-
-	private static Logger logger = Logger
-	.getLogger(BiomobyObjectTree.class);
-
-	private JTree tree;
-	private String registryEndpoint = "";
-	private String registryNamespace = "";
-	private static String SEARCH_DATATYPE_TEXT = "Type to search!";
-	private FilterTreeModel model;
-	private final EditManager editManager;
-	private final FileManager fileManager;
-
-	/**
-	 * Default constructor. Creates a BiomobyObjectTree for the default Biomoby
-	 * registry
-	 */
-	public BiomobyObjectTree(EditManager editManager, FileManager fileManager) {
-		this(CentralImpl.DEFAULT_ENDPOINT, CentralImpl.DEFAULT_NAMESPACE, editManager, fileManager);
-	}
-
-	/**
-	 *
-	 * @param url
-	 *            the Biomoby registry endpoint URL to build a tree for
-	 * @param uri
-	 *            the Biomoby registry namespace URI to build a tree for
-	 */
-	public BiomobyObjectTree(String url, String uri, EditManager editManager, FileManager fileManager) {
-		this.registryEndpoint = url;
-		this.registryNamespace = uri;
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-	}
-
-	/*
-	 * method that inserts our BiomobyDatatypeDescription object into our tree
-	 */
-	private void insertDescriptionIntoTree(
-			BiomobyDatatypeDescription description,
-			HashMap<String, FilterTreeNode> nodeMap,
-			HashMap<String, BiomobyDatatypeDescription> descriptionMap) {
-		FilterTreeNode node = nodeMap.containsKey(description.getName()) ? nodeMap
-				.get(description.getName())
-				: new FilterTreeNode(description);
-
-		String parent = description.getParent();
-		if (parent.equals(""))
-			parent = "Object";
-		FilterTreeNode pNode = nodeMap.containsKey(parent) ? nodeMap
-				.get(parent) : new FilterTreeNode(descriptionMap.get(parent));
-		pNode.add(node);
-		nodeMap.put(description.getName(), node);
-		nodeMap.put(parent, pNode);
-	}
-
-	/**
-	 *
-	 * @return a Tree containing the datatype ontology for the specified biomoby
-	 *         registry
-	 * @throws MobyException
-	 *             if there is a problem comunicating with the specified biomoby
-	 *             registry
-	 */
-	public Component getDatatypeTree() throws MobyException {
-		BiomobyQueryHelper bqh = new BiomobyQueryHelper(getRegistryEndpoint(),
-				getRegistryNamespace());
-		List<BiomobyDatatypeDescription> descriptions = bqh
-				.findDatatypeDescriptions();
-
-		// create a tree from all of the nodes
-		HashMap<String, BiomobyDatatypeDescription> descriptionMap = new HashMap<String, BiomobyDatatypeDescription>();
-		HashMap<String, FilterTreeNode> nodeMap = new HashMap<String, FilterTreeNode>();
-		for (BiomobyDatatypeDescription d : descriptions) {
-			// PRECONDITION: datatype names are unique across the ontology
-			descriptionMap.put(d.getDatatypeName(), d);
-		}
-
-		nodeMap.put("Object", new FilterTreeNode(descriptionMap.get("Object")));
-		for (BiomobyDatatypeDescription d : descriptions) {
-			if (!d.getName().equals("Object"))
-				insertDescriptionIntoTree(d, nodeMap, descriptionMap);
-		}
-		// construct a new tree with our root node
-		tree = new JTree(nodeMap.get("Object"));
-
-		// only allow one node to be selected at once
-		tree.getSelectionModel().setSelectionMode(
-				TreeSelectionModel.SINGLE_TREE_SELECTION);
-		model = new FilterTreeModel((FilterTreeNode) tree.getModel().getRoot());
-		tree.setModel(model);
-
-		// set up the icon and tooltips for the nodes in the tree
-		ImageIcon icon = new ImageIcon(BiomobyObjectActivityItem.class
-				.getResource("/biomoby_object.png"));
-		if (icon != null) {
-			DefaultTreeCellRenderer renderer = new DatatypeTreeRenderer();
-			renderer.setLeafIcon(icon);
-			renderer.setOpenIcon(icon);
-			renderer.setClosedIcon(icon);
-			renderer.setIcon(icon);
-			tree.setCellRenderer(renderer);
-		}
-
-		// add a mouse listener to catch context clicks
-		// the listener adds the selected datatype to the workflow
-		// it also adds the datatype's container relationships
-		tree.addMouseListener(new BiomobyObjectTreeMouseListener());
-		// clear the hashmaps to clear some memory
-		nodeMap.clear();
-		descriptionMap.clear();
-		// register our tree for tool tips
-		ToolTipManager.sharedInstance().registerComponent(tree);
-		// insert the tree into a scrollpane
-		JScrollPane treeView = new JScrollPane(tree);
-		treeView.setSize(getFrameSize());
-
-		// create a new panel to hold the scrollpane and a search box
-		JPanel panel = new JPanel(new BorderLayout());
-		panel.add(treeView, BorderLayout.CENTER);
-		JTextField search = new JTextField(SEARCH_DATATYPE_TEXT);
-		panel.add(search, BorderLayout.PAGE_END);
-		search.addKeyListener(new KeyListener() {
-			public void keyPressed(KeyEvent e) {
-				if (e.getSource() instanceof JTextField) {
-					JTextField field = (JTextField) e.getSource();
-					if (field.getText().trim().equals(
-							BiomobyObjectTree.SEARCH_DATATYPE_TEXT)) {
-						field.setText("");
-					}
-				}
-			}
-
-			public void keyReleased(KeyEvent e) {
-				if (e.getSource() instanceof JTextField) {
-					JTextField field = (JTextField) e.getSource();
-					if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
-						field.setText(SEARCH_DATATYPE_TEXT);
-						model.setFilter(null);
-						return;
-					}
-					// filter our tree
-					if (!field.getText().trim().equals(
-							BiomobyObjectTree.SEARCH_DATATYPE_TEXT)) {
-						// does our filter tree model exist yet?
-						model.setFilter(field.getText().trim());
-					}
-				}
-			}
-
-			public void keyTyped(KeyEvent e) {
-
-			}
-		});
-		search.addFocusListener(new FocusListener() {
-
-			public void focusGained(FocusEvent e) {
-				if (e.getSource() instanceof JTextField) {
-					JTextField field = (JTextField) e.getSource();
-					if (field.getText().trim().equals(
-							BiomobyObjectTree.SEARCH_DATATYPE_TEXT)) {
-						field.setText("");
-					}
-				}
-			}
-
-			public void focusLost(FocusEvent e) {
-				if (e.getSource() instanceof JTextField) {
-					JTextField field = (JTextField) e.getSource();
-					if (field.getText().trim().equals("")) {
-						field.setText(SEARCH_DATATYPE_TEXT);
-					}
-				}
-			}
-		});
-		// done
-		panel.setToolTipText("Datatype Viewer for " + getRegistryEndpoint().toString());
-		return panel;
-	}
-
-	/**
-	 *
-	 * @param registryEndpoint
-	 *            the endpoint to set
-	 */
-	public void setRegistryEndpoint(String registryEndpoint) {
-		this.registryEndpoint = registryEndpoint;
-	}
-
-	/**
-	 *
-	 * @param registryNamespace
-	 *            the namespace to set
-	 */
-	public void setRegistryNamespace(String registryNamespace) {
-		this.registryNamespace = registryNamespace;
-	}
-
-	/**
-	 *
-	 * @return the registry endpoint that this tree is using
-	 */
-	public String getRegistryEndpoint() {
-		return registryEndpoint;
-	}
-
-	/**
-	 *
-	 * @return the registry namespace that this tree is using
-	 */
-	public String getRegistryNamespace() {
-		return registryNamespace;
-	}
-
-	/**
-	 * returns the frame size as a dimension for the content pane housing this
-	 * action
-	 */
-	public Dimension getFrameSize() {
-		return new Dimension(550, 450);
-	}
-
-	/*
-	 * A mouse listener for our datatype tree
-	 */
-	private class BiomobyObjectTreeMouseListener implements MouseListener {
-		public void mouseClicked(MouseEvent me) {
-		}
-
-		public void mousePressed(MouseEvent me) {
-			mouseReleased(me);
-		}
-
-		public void mouseReleased(MouseEvent me) {
-			if (me.isPopupTrigger()) // right click, show popup menu
-			{
-				TreePath path = tree.getPathForLocation(me.getX(), me.getY());
-				if (path == null)
-					return;
-
-				DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
-						.getLastSelectedPathComponent();
-				if (node == null)
-					return;
-
-				final String selectedObject = node.toString();
-				final BiomobyDatatypeDescription bdd = (BiomobyDatatypeDescription) node
-						.getUserObject();
-				final JPopupMenu menu = new JPopupMenu();
-				// Create and add a menu item for adding to the
-				// item to the workflow
-				JMenuItem item = new JMenuItem("Add Datatype - '"
-						+ selectedObject + "' to the workflow?");
-
-				item.addActionListener(new ActionListener() {
-
-					public void actionPerformed(ActionEvent ae) {
-
-						try {
-							Dataflow dataflow = fileManager.getCurrentDataflow();
-							List<Edit<?>> compoundEdits = new ArrayList<Edit<?>>();
-							List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
-							String name = Tools.uniqueProcessorName(
-									selectedObject, dataflow);
-
-							BiomobyObjectActivityConfigurationBean configBean = new BiomobyObjectActivityConfigurationBean();
-							configBean.setMobyEndpoint(bdd
-									.getActivityConfiguration()
-									.getMobyEndpoint());
-							configBean.setAuthorityName("");
-							configBean.setServiceName(selectedObject);
-
-							Edits edits = editManager.getEdits();
-							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);
-							compoundEdits.add(compoundEdit);
-							compoundEdit.doEdit();
-
-							// process relationships
-							Edit<?> edit = new AddUpstreamObjectEdit(dataflow,
-									sourceProcessor, boActivity, edits);
-							editManager.doDataflowEdit(dataflow, edit);
-
-						} catch (Exception e) {
-							logger.error("Could not add datatype", e);
-						}
-					}
-				});
-				item.setIcon(MobyPanel.getIcon("/Add24.gif"));
-
-				// add the components to the menus
-				menu.add(new JLabel("Add to workflow ... ", JLabel.CENTER));
-				menu.add(new JSeparator());
-				menu.add(item);
-				// show the window
-				menu.show(me.getComponent(), me.getX(), me.getY());
-			}
-		}
-
-		public void mouseEntered(MouseEvent me) {
-		}
-
-		public void mouseExited(MouseEvent me) {
-		}
-	}
-
-	private static class DatatypeTreeRenderer extends DefaultTreeCellRenderer {
-
-		private static final long serialVersionUID = 7287097980554656834L;
-
-		// the max tool tip length
-		private static int MAX_TOOLTIP_LENGTH = 300;
-
-		@Override
-		public Component getTreeCellRendererComponent(JTree tree, Object value,
-				boolean sel, boolean expanded, boolean leaf, int row,
-				boolean hasFocus) {
-			if (value instanceof DefaultMutableTreeNode) {
-				if (((DefaultMutableTreeNode) value).getUserObject() instanceof BiomobyDatatypeDescription) {
-					BiomobyDatatypeDescription desc = (BiomobyDatatypeDescription) ((DefaultMutableTreeNode) value)
-							.getUserObject();
-					String d = desc.getDescription().trim();
-					// we only keep MAX_TOOLTIP_LENGTH characters of the string
-					if (d.length() > MAX_TOOLTIP_LENGTH)
-						d = d.substring(0, MAX_TOOLTIP_LENGTH) + "...";
-					setToolTipText("<html><body><div style='width:200px;'><span>"
-							+ d + "</span></div></body></html>");
-
-					ToolTipManager.sharedInstance().setDismissDelay(
-							Integer.MAX_VALUE);
-				}
-			}
-			return super.getTreeCellRendererComponent(tree, value, sel,
-					expanded, leaf, row, hasFocus);
-		}
-	}
-
-	/*
-	 * Shamelessly stolen from t2. Made the Filter a simple string filter and
-	 * modified the code a bit to make it relevant to my tree
-	 */
-	private final class FilterTreeModel extends DefaultTreeModel {
-
-		private static final long serialVersionUID = 8446366558654481274L;
-		String currentFilter;
-
-		/**
-		 *
-		 * @param node
-		 *            the node to apply filtering to
-		 */
-		public FilterTreeModel(FilterTreeNode node) {
-			this(node, null);
-		}
-
-		/**
-		 *
-		 * @param node
-		 *            the node to apply filtering to
-		 * @param filter
-		 *            the actual filter we will apply
-		 */
-		public FilterTreeModel(FilterTreeNode node, String filter) {
-			super(node);
-			currentFilter = filter;
-			node.setFilter(filter);
-		}
-
-		/**
-		 *
-		 * @param filter
-		 *            the filter to set and apply to our node
-		 */
-		public void setFilter(String filter) {
-			if (root != null) {
-				currentFilter = filter;
-				((FilterTreeNode) root).setFilter(filter);
-				Object[] path = { root };
-				fireTreeStructureChanged(this, path, null, null);
-			}
-		}
-
-		/*
-		 * (non-Javadoc)
-		 *
-		 * @see
-		 * javax.swing.tree.DefaultTreeModel#getChildCount(java.lang.Object)
-		 */
-		public int getChildCount(Object parent) {
-			if (parent instanceof FilterTreeNode) {
-				return (((FilterTreeNode) parent).getChildCount());
-			}
-			return 0;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 *
-		 * @see javax.swing.tree.DefaultTreeModel#getChild(java.lang.Object,
-		 * int)
-		 */
-		public Object getChild(Object parent, int index) {
-			if (parent instanceof FilterTreeNode) {
-				return (((FilterTreeNode) parent).getChildAt(index));
-			}
-			return null;
-		}
-
-		/**
-		 * Getter
-		 *
-		 * @return the filter that we are currently using
-		 */
-		public String getCurrentFilter() {
-			return currentFilter;
-		}
-	}
-
-	private class FilterTreeNode extends DefaultMutableTreeNode {
-
-		private static final long serialVersionUID = -5269485070471940445L;
-		private String filter;
-		private boolean passed = true;
-		private List<FilterTreeNode> filteredChildren = new ArrayList<FilterTreeNode>();
-
-		public FilterTreeNode(Object userObject) {
-			super(userObject);
-		}
-
-		public String getFilter() {
-			return filter;
-		}
-
-		public void setFilter(String filter) {
-			this.filter = filter == null ? "" : filter;
-			passed = false;
-			filteredChildren.clear();
-			if (filter == null) {
-				passed = true;
-				passFilterDown(null);
-			} else if (pass(this)) {
-				passed = true;
-				passFilterDown(filter);
-			} else {
-				passFilterDown(filter);
-				passed = filteredChildren.size() != 0;
-			}
-		}
-
-		private boolean pass(FilterTreeNode node) {
-			if (getFilter().trim().equals("")) {
-				return true;
-			}
-			return node.getUserObject().toString().toLowerCase().trim()
-					.contains(getFilter().toLowerCase().trim());
-		}
-
-		private void passFilterDown(String filter) {
-			int realChildCount = super.getChildCount();
-			for (int i = 0; i < realChildCount; i++) {
-				FilterTreeNode realChild = (FilterTreeNode) super.getChildAt(i);
-				realChild.setFilter(filter);
-				if (realChild.isPassed()) {
-					filteredChildren.add(realChild);
-				}
-			}
-		}
-
-		public void add(FilterTreeNode node) {
-			super.add(node);
-			node.setFilter(filter);
-			if (node.isPassed()) {
-				filteredChildren.add(node);
-			}
-		}
-
-		/*
-		 * (non-Javadoc)
-		 *
-		 * @see javax.swing.tree.DefaultMutableTreeNode#remove(int)
-		 */
-		public void remove(int childIndex) {
-			if (filter != null) {
-				// as child indexes might be inconsistent..
-				throw new IllegalStateException(
-						"Can't remove while the filter is active");
-			}
-			super.remove(childIndex);
-		}
-
-		/*
-		 * (non-Javadoc)
-		 *
-		 * @see javax.swing.tree.DefaultMutableTreeNode#getChildCount()
-		 */
-		public int getChildCount() {
-			if (filter == null) {
-				return super.getChildCount();
-			}
-			return (filteredChildren.size());
-		}
-
-		/*
-		 * (non-Javadoc)
-		 *
-		 * @see javax.swing.tree.DefaultMutableTreeNode#getChildAt(int)
-		 */
-		public FilterTreeNode getChildAt(int index) {
-			if (filter == null) {
-				return (FilterTreeNode) super.getChildAt(index);
-			}
-			return filteredChildren.get(index);
-		}
-
-		/**
-		 *
-		 * @return
-		 */
-		public boolean isPassed() {
-			return passed;
-		}
-	}
-
-	public static void main(String[] args) throws Exception {
-		// Create a frame
-		String title = "TeST";
-		JFrame frame = new JFrame(title);
-
-		// Create a component to add to the frame
-/*		Component comp = new BiomobyObjectTree(CentralImpl.DEFAULT_ENDPOINT,
-				CentralImpl.DEFAULT_NAMESPACE).getDatatypeTree();*/
-
-		Component comp = new BiomobyObjectTree("http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl",
-				CentralImpl.DEFAULT_NAMESPACE, null, null).getDatatypeTree();
-
-		// Add the component to the frame's content pane;
-		// by default, the content pane has a border layout
-		frame.getContentPane().add(comp, BorderLayout.CENTER);
-
-		// Show the frame
-		int width = 300;
-		int height = 300;
-		frame.setSize(width, height);
-		frame.setVisible(true);
-
-		// Set to exit on close
-		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-	}
-}