You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/27 17:22:14 UTC
[01/23] incubator-taverna-workbench-common-activities git commit:
Repository: incubator-taverna-workbench-common-activities
Updated Branches:
refs/heads/master 9e37ea395 -> 163747de9
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
new file mode 100644
index 0000000..200e7e2
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
@@ -0,0 +1,81 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.dom4j.QName;
+
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ */
+public abstract class XPathActivityXMLTreeNode extends DefaultMutableTreeNode
+{
+ protected static final int DISPLAY_LABEL_MAX_LENGTH = 200;
+
+ private final boolean isAttribute;
+
+ public XPathActivityXMLTreeNode(Object userObject, boolean isAttribute)
+ {
+ super(userObject);
+ this.isAttribute = isAttribute;
+ }
+
+ public boolean isAttribute() {
+ return (isAttribute);
+ }
+
+
+ public QName getNodeQName() {
+ if (this.isAttribute()) {
+ return (((XPathActivityXMLTreeAttributeNode)this).getAssociatedAttribute().getQName());
+ }
+ else {
+ return (((XPathActivityXMLTreeElementNode)this).getAssociatedElement().getQName());
+ }
+ }
+
+
+ public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bIncludeElementNamespace, boolean bUseStyling)
+ {
+ if (this.isAttribute()) {
+ return (((XPathActivityXMLTreeAttributeNode)this).getTreeNodeDisplayLabel(bIncludeValue, bUseStyling));
+ }
+ else {
+ return (((XPathActivityXMLTreeElementNode)this).getTreeNodeDisplayLabel(bIncludeValue, bIncludeElementNamespace, bUseStyling));
+ }
+ }
+
+
+ protected String truncateElementTextValue(String textValue)
+ {
+ if (textValue != null && textValue.length() > DISPLAY_LABEL_MAX_LENGTH) {
+ textValue = textValue.substring(0, DISPLAY_LABEL_MAX_LENGTH) + "(...)";
+ }
+ return (textValue);
+ }
+
+
+ /**
+ * Tiny helper to strip out all HTML tags. This will not leave any HTML tags
+ * at all (so that the content can be displayed in DialogTextArea - and the
+ * like - components. This helps to present HTML content inside JAVA easier.
+ */
+ public static String stripAllHTML(String source) {
+ // don't do anything if not string is provided
+ if (source == null)
+ return ("");
+
+ // need to preserve at least all line breaks
+ // (ending and starting paragraph also make a line break)
+ source = source.replaceAll("</p>[\r\n]*<p>", "<br>");
+ source = source.replaceAll("\\<br/?\\>", "\n\n");
+
+ // strip all HTML
+ source = source.replaceAll("\\<.*?\\>", ""); // any HTML tags
+ source = source.replaceAll("&\\w{1,4};", ""); // this is for things like " ", ">", etc
+
+ return (source);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
new file mode 100644
index 0000000..a293e68
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
@@ -0,0 +1,251 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.activities.xpath.ui.config.XPathActivityConfigurationPanel;
+
+import org.dom4j.DocumentHelper;
+
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityXMLTreeSelectionHandler implements TreeSelectionListener
+{
+ private final XPathActivityXMLTree theTree;
+ private final XPathActivityConfigurationPanel parentConfigPanel;
+
+
+ public XPathActivityXMLTreeSelectionHandler(XPathActivityConfigurationPanel parentConfigPanel,
+ XPathActivityXMLTree tree)
+ {
+ this.parentConfigPanel = parentConfigPanel;
+ this.theTree = tree;
+ }
+
+
+ public void valueChanged(TreeSelectionEvent e)
+ {
+ // get the newly made selection
+ TreePath newSelectedPath = e.getNewLeadSelectionPath();
+
+ // NB! Safety check - sometimes the container of the XML tree will remove all selections,
+ // in such case this listener is not supposed to perform any action -> terminate
+ if (newSelectedPath == null) return;
+
+
+ // --- XPath GENERATION ---
+
+ // get the XPath expression for the new selection + taking into consideration all previous ones
+ List<String> wildcardedXPath = generateWildcardedXPathExpression(newSelectedPath);
+
+ // assemble the xpath expression as one string
+ StringBuilder xpath = new StringBuilder();
+ for (String leg : wildcardedXPath) {
+ xpath.append(leg);
+ }
+ theTree.setCurrentXPathExpression(DocumentHelper.createXPath(xpath.toString()));
+ theTree.getCurrentXPathExpression().setNamespaceURIs(theTree.getCurrentXPathNamespaces());
+
+
+ // --- UPDATE CONFIG PANEL ---
+ // (with new values for XPath expression and namespace mappings)
+
+ // inform the parent activity configuration panel to update the XPath expression in the UI
+ /* We do not update the XPath expression after changes in selection in the XML tree - we
+ * now have a button to explicitly do that.
+ * theTree.getParentConfigPanel().updateXPathEditingPanelValues();
+ */
+
+ // --- SELECTION ---
+ selectAllNodesThatMatchTheCurrentXPath(wildcardedXPath, newSelectedPath);
+ }
+
+
+ /**
+ * Selects all nodes that match the <code>wildcardedXPath</code> expression.
+ *
+ * Keyboard focus is set to remain on the "deepest" (e.g. furthest from root)
+ * element of the <code>lastSelectedPath</code>.
+ *
+ * @param wildcardedXPath List of strings, where each string contains one "leg" of the XPath expression
+ * (e.g. a string starting with a "/" and containing the name of one node of the tree).
+ *
+ * @param lastSelectedPath The path that was last selected in the tree (normally,
+ * because of this selection {@link XPathActivityXMLTreeSelectionHandler#valueChanged(TreeSelectionEvent)}
+ * was executed and this method was started as a part of that.
+ */
+ public void selectAllNodesThatMatchTheCurrentXPath(List<String> wildcardedXPath, TreePath lastSelectedPath)
+ {
+ // first of all - calculate the number of nodes that match this XPath
+ // expression in the XML tree
+ int numberOfMatchingNodes = parentConfigPanel.runXPath(false);
+
+
+ // store all tree selection listeners in order to temporarily remove them;
+ // this is necessary as selection modifications will be made here -- don't
+ // want any listeners to respond to these new events
+ theTree.removeAllSelectionListeners();
+
+
+ // remove all previous selections - safest way to get the new ones correctly
+ theTree.clearSelection();
+
+
+ if (numberOfMatchingNodes <= XPathActivityConfigurationPanel.MAX_NUMBER_OF_MATCHING_NODES_TO_HIGHLIGHT_IN_THE_TREE)
+ {
+ // find all nodes that match the XPath expression
+ List<XPathActivityXMLTreeNode> matchingNodes = new ArrayList<XPathActivityXMLTreeNode>();
+ findAllNodesThatMatchWildcardedXPath(
+ (XPathActivityXMLTreeNode)theTree.getModel().getRoot(),
+ wildcardedXPath.subList(1, wildcardedXPath.size()),
+ matchingNodes);
+
+ // obtain and select TreePaths for each of the matching nodes
+ for (XPathActivityXMLTreeNode matchingNode : matchingNodes) {
+ TreeNode[] pathAsObjects = ((DefaultTreeModel)theTree.getModel()).getPathToRoot(matchingNode);
+ TreePath path = new TreePath(pathAsObjects);
+ selectTreePathAndAllItsAncestors(path);
+ }
+ }
+ else {
+ JOptionPane.showMessageDialog(parentConfigPanel,
+ "Current XPath expression matches " + numberOfMatchingNodes + " nodes in the XML tree.\n" +
+ "The XPath Activity is unable to highlight all these nodes in the tree due to\n" +
+ "performance reasons.\n\n" +
+ "The XPath Activity will still work correctly - both during the workflow execution\n" +
+ "and if 'Run XPath' button is clicked to run this expression against the example XML.",
+ "XPath Activity", JOptionPane.INFORMATION_MESSAGE);
+ }
+
+
+ // make sure the keyboard focus stays on the actual node that was clicked on -
+ // no direct way to do this, so simply de-select and re-select again
+ if (lastSelectedPath != null) {
+ theTree.removeSelectionPath(lastSelectedPath);
+ theTree.addSelectionPath(lastSelectedPath);
+ }
+
+ // restore all previously stored selection listeners
+ theTree.restoreAllSelectionListeners();
+ }
+
+
+
+ /**
+ * This cannot work for XPath expressions that were modified manually -
+ * only works for the type generated by the click in the XML tree.
+ *
+ * @param nodeToStartAt
+ * @param xpathLegs From <code>nodeToStartAt</code>.
+ * @param matchingNodes
+ */
+ private void findAllNodesThatMatchWildcardedXPath(XPathActivityXMLTreeNode nodeToStartAt,
+ List<String> xpathLegs, List<XPathActivityXMLTreeNode> matchingNodes)
+ {
+ // some of the input data is missing, just return...
+ if (nodeToStartAt == null || xpathLegs == null || matchingNodes == null) {
+ return;
+ }
+
+ // no XPath expression to match against the 'nodeToStartAt', therefore
+ // we've "found" the macthing node: 'nodeToStartAt'
+ if (xpathLegs.size() == 0) {
+ matchingNodes.add(nodeToStartAt);
+ return;
+ }
+
+ // standard case - there is something to match, proceed as normal
+ Enumeration<XPathActivityXMLTreeNode> startNodeChildren = nodeToStartAt.children();
+ while (startNodeChildren.hasMoreElements()) {
+ XPathActivityXMLTreeNode child = startNodeChildren.nextElement();
+
+ if (xpathLegs.get(0).equals("/*") ||
+ xpathLegs.get(0).equals(this.theTree.getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(child)))
+ {
+ // this node matches current section of the XPath expression
+ if (xpathLegs.size() == 1) {
+ // no more sections in the XPath leg list to match, so this child
+ // node is the one we were looking for - add to the result
+ matchingNodes.add(child);
+ }
+ else {
+ // ...or process its children recursively
+ findAllNodesThatMatchWildcardedXPath(child, xpathLegs.subList(1, xpathLegs.size()), matchingNodes);
+ }
+ }
+ }
+ }
+
+
+ private List<String> generateWildcardedXPathExpression(TreePath newSelectedPath)
+ {
+ // look through previous selection to find paths of the same length, as the newly selected one
+ List<TreePath> pathsOfSameLength = new ArrayList<TreePath>();
+ TreePath[] previouslySelectedPaths = theTree.getSelectionPaths();
+ for (TreePath path : previouslySelectedPaths) {
+ if (path.getPathCount() == newSelectedPath.getPathCount()) {
+ pathsOfSameLength.add(path);
+ }
+ }
+
+ // if there were found any paths of the same length, we have a "wildcard" situation
+ List<String> wildcardXPathLegs = theTree.generateXPathFromTreePathAsLegList(newSelectedPath);
+
+ if (pathsOfSameLength.size() > 0)
+ {
+ // it's okay to use just the first path - TODO: explain that this is because of previous comparisons
+ List<String> firstMatchingLengthPathLegs = theTree.generateXPathFromTreePathAsLegList(pathsOfSameLength.get(0));
+
+ int pathLength = wildcardXPathLegs.size();
+
+ // only use wildcards if the last segments of both paths are identical
+ if (wildcardXPathLegs.get(pathLength - 1).equals(firstMatchingLengthPathLegs.get(pathLength - 1)))
+ {
+ // continue all the way to the last segment, but don't touch it
+ for (int i = 0; i < wildcardXPathLegs.size() - 1; i++)
+ {
+ if (!wildcardXPathLegs.get(i).equals(firstMatchingLengthPathLegs.get(i))) {
+ // set wildcard
+ // TODO - make wildcard a constant
+ // TODO - may need to make the wildcard to have a namespace? (e.g. "/default:*" instead of simply "/*")
+ wildcardXPathLegs.set(i, "/*"); // definitely an element, not an attribute (as not the last segment in the path)
+ }
+ }
+ }
+ }
+
+ return (wildcardXPathLegs);
+ }
+
+
+
+ private void selectTreePathAndAllItsAncestors(TreePath path)
+ {
+ // select all ancestors of that path
+ TreePath pathToSelect = path;
+ for (int i = 0; i < path.getPathCount(); i++)
+ {
+ pathToSelect = pathToSelect.getParentPath();
+ theTree.addSelectionPath(pathToSelect);
+ }
+
+ // select the specified path itself
+ //
+ // NB! important to do this after the ancestors, so that the supplied
+ // path is the one that retains the keyboard focus after this method terminates
+ theTree.addSelectionPath(path);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
new file mode 100644
index 0000000..3527767
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
@@ -0,0 +1,65 @@
+package org.apache.taverna.activities.xpath.ui.contextualview;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.xpath.ui.config.XPathActivityConfigureAction;
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * This action is responsible for enabling the contextual menu entry on processors that perform
+ * XPathActivity'ies.
+ * NB! As a side-effect this also enables the pop-up with for configuration of the processor when it
+ * is added to the workflow from the Service Panel.
+ *
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class ConfigureXPathActivityMenuAction extends AbstractConfigureActivityMenuAction {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public ConfigureXPathActivityMenuAction() {
+ super(XPathTemplateService.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ XPathActivityConfigureAction configAction = new XPathActivityConfigureAction(
+ findActivity(), getParentFrame(), editManager, fileManager, activityIconManager,
+ serviceDescriptionRegistry, serviceRegistry);
+ configAction.putValue(Action.NAME, "Configure XPath service");
+ addMenuDots(configAction);
+ return configAction;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
new file mode 100644
index 0000000..57f194f
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
@@ -0,0 +1,59 @@
+package org.apache.taverna.activities.xpath.ui.contextualview;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityMainContextViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public boolean canHandle(Object selection) {
+ return selection instanceof Activity
+ && ((Activity) selection).getType()
+ .equals(XPathTemplateService.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity selection) {
+ return Arrays.<ContextualView> asList(new XPathActivityMainContextualView(selection,
+ editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
+ serviceRegistry));
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
new file mode 100644
index 0000000..41df2ea
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
@@ -0,0 +1,209 @@
+package org.apache.taverna.activities.xpath.ui.contextualview;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.table.DefaultTableModel;
+
+import org.apache.taverna.activities.xpath.ui.config.XPathActivityConfigureAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class XPathActivityMainContextualView extends ContextualView {
+
+ private final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ private XPathActivityMainContextualView thisContextualView;
+
+ private final Activity activity;
+
+ private JPanel jpMainPanel;
+ private JTextField tfXPathExpression;
+
+ private DefaultTableModel xpathNamespaceMappingsTableModel;
+ private JTable jtXPathNamespaceMappings;
+ private JScrollPane spXPathNamespaceMappings;
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private final ServiceRegistry serviceRegistry;
+
+ public XPathActivityMainContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ this.serviceRegistry = serviceRegistry;
+ this.thisContextualView = this;
+ this.activity = activity;
+ initView();
+ }
+
+ @Override
+ public JComponent getMainFrame() {
+ jpMainPanel = new JPanel(new GridBagLayout());
+ jpMainPanel.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createEmptyBorder(4, 2, 4, 2), BorderFactory.createEmptyBorder()));
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.anchor = GridBagConstraints.WEST;
+ c.weighty = 0;
+
+ // --- XPath Expression ---
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.insets = new Insets(5, 5, 5, 5);
+ JLabel jlXPathExpression = new JLabel("XPath Expression:");
+ jlXPathExpression.setFont(jlXPathExpression.getFont().deriveFont(Font.BOLD));
+ jpMainPanel.add(jlXPathExpression, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ tfXPathExpression = new JTextField();
+ tfXPathExpression.setEditable(false);
+ jpMainPanel.add(tfXPathExpression, c);
+
+ // --- Label to Show/Hide Mapping Table ---
+
+ final JLabel jlShowHideNamespaceMappings = new JLabel("Show namespace mappings...");
+ jlShowHideNamespaceMappings.setForeground(Color.BLUE);
+ jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ spXPathNamespaceMappings.setVisible(!spXPathNamespaceMappings.isVisible());
+ jlShowHideNamespaceMappings.setText((spXPathNamespaceMappings.isVisible() ? "Hide"
+ : "Show") + " namespace mappings...");
+ thisContextualView.revalidate();
+ }
+ });
+
+ c.gridx = 0;
+ c.gridy++;
+ c.gridwidth = 2;
+ c.weightx = 1.0;
+ c.weighty = 0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ jpMainPanel.add(jlShowHideNamespaceMappings, c);
+
+ // --- Namespace Mapping Table ---
+
+ xpathNamespaceMappingsTableModel = new DefaultTableModel() {
+ /**
+ * No cells should be editable
+ */
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return (false);
+ }
+ };
+ xpathNamespaceMappingsTableModel.addColumn("Namespace Prefix");
+ xpathNamespaceMappingsTableModel.addColumn("Namespace URI");
+
+ jtXPathNamespaceMappings = new JTable();
+ jtXPathNamespaceMappings.setModel(xpathNamespaceMappingsTableModel);
+ jtXPathNamespaceMappings.setPreferredScrollableViewportSize(new Dimension(200, 90));
+ // TODO - next line is to be enabled when Taverna is migrated to Java
+ // 1.6; for now it's fine to run without this
+ // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure
+ // that when the dedicated area is larger than the table, the latter is
+ // stretched vertically to fill the empty space
+
+ jtXPathNamespaceMappings.getColumnModel().getColumn(0).setPreferredWidth(20); // set
+ // relative
+ // sizes of
+ // columns
+ jtXPathNamespaceMappings.getColumnModel().getColumn(1).setPreferredWidth(300);
+
+ c.gridy++;
+ spXPathNamespaceMappings = new JScrollPane(jtXPathNamespaceMappings);
+ spXPathNamespaceMappings.setVisible(false);
+ jpMainPanel.add(spXPathNamespaceMappings, c);
+
+ // populate the view with values
+ refreshView();
+
+ return jpMainPanel;
+ }
+
+ @Override
+ /**
+ * This is the title of the contextual view - shown in the list of other available
+ * views (even when this contextual view is collapsed).
+ */
+ public String getViewTitle() {
+ return "XPath Service Details";
+ }
+
+ /**
+ * Typically called when the activity configuration has changed.
+ */
+ @Override
+ public void refreshView() {
+ Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
+ JsonNode json = configuration.getJson();
+
+ // Set XPath Expression
+ tfXPathExpression.setText(json.get("xpathExpression").asText());
+
+ // Populate Namespace Mappings
+ xpathNamespaceMappingsTableModel.getDataVector().removeAllElements();
+ if (json.has("xpathNamespaceMap")) {
+ for (JsonNode mapping : json.get("xpathNamespaceMap")) {
+ xpathNamespaceMappingsTableModel.addRow(new Object[] {
+ mapping.get("prefix").asText(), mapping.get("uri").asText() });
+ }
+ }
+ }
+
+ /**
+ * View position hint
+ */
+ @Override
+ public int getPreferredPosition() {
+ // want to be on top, as it's the main contextual view for this activity
+ return 100;
+ }
+
+ @Override
+ public Action getConfigureAction(final Frame owner) {
+ // "Configure" button appears because of this action being returned
+ return new XPathActivityConfigureAction(activity, owner, editManager, fileManager,
+ activityIconManager, serviceDescriptionRegistry, serviceRegistry);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateAction.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateAction.java
new file mode 100644
index 0000000..b5ba45a
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateAction.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 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 org.apache.taverna.activities.xpath.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action to add a REST activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class AddXPathTemplateAction extends AbstractContextualMenuAction {
+
+ private static final String ADD_XPATH = "XPath";
+
+ private static final URI insertSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/insert");
+
+ private EditManager editManager;
+
+ private MenuManager menuManager;
+
+ private SelectionManager selectionManager;
+
+ private ActivityIconManager activityIconManager;
+
+ private ServiceRegistry serviceRegistry;
+
+ public AddXPathTemplateAction() {
+ super(insertSection, 1000);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+
+ return new AddXPathAction();
+ }
+
+ protected class AddXPathAction extends AbstractAction {
+ AddXPathAction() {
+ super(ADD_XPATH, activityIconManager
+ .iconForActivity(XPathTemplateService.ACTIVITY_TYPE));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ WorkflowView.importServiceDescription(XPathTemplateService.getServiceDescription(),
+ false, editManager, menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
new file mode 100644
index 0000000..e8ab4ef
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 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 org.apache.taverna.activities.xpath.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * An action to add a REST activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class AddXPathTemplateMenuAction extends AbstractMenuAction {
+
+ private static final String ADD_XPATH = "XPath";
+
+ private static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ private static final URI ADD_XPATH_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddXPath");
+
+ private EditManager editManager;
+
+ private MenuManager menuManager;
+
+ private SelectionManager selectionManager;
+
+ private ActivityIconManager activityIconManager;
+
+ private ServiceRegistry serviceRegistry;
+
+ public AddXPathTemplateMenuAction() {
+ super(INSERT, 1000, ADD_XPATH_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddXPathMenuAction();
+ }
+
+ protected class AddXPathMenuAction extends AbstractAction implements DesignOnlyAction {
+ AddXPathMenuAction() {
+ super();
+ putValue(SMALL_ICON,
+ activityIconManager.iconForActivity(XPathTemplateService.ACTIVITY_TYPE));
+ putValue(NAME, ADD_XPATH);
+ putValue(SHORT_DESCRIPTION, "XPath service");
+ putValue(
+ Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.SHIFT_DOWN_MASK
+ | InputEvent.ALT_DOWN_MASK));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(XPathTemplateService.getServiceDescription(),
+ false, editManager, menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathActivityIcon.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathActivityIcon.java
new file mode 100644
index 0000000..10cb2c6
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathActivityIcon.java
@@ -0,0 +1,86 @@
+package org.apache.taverna.activities.xpath.ui.servicedescription;
+
+import java.awt.Color;
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+/**
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityIcon implements ActivityIconSPI {
+ private static final Color PROCESSOR_COLOUR = Color.decode("#E6FF5E");
+
+ // --- LOCATIONS OF ICONS USED IN THE XPath ACTIVITY ---
+
+ private static final String FAMFAMFAM_SILK_PATH = "famfamfam_silk/";
+ private static final String FOLDS_PATH = "folds/";
+
+ public static final String XPATH_ACTIVITY_ICON = FAMFAMFAM_SILK_PATH + "page_white_code.png";
+ public static final String XPATH_ACTIVITY_CONFIGURATION_PARSE_XML_ICON = "arrow_right.png";
+
+ public static final String XML_TREE_ROOT_ICON = FAMFAMFAM_SILK_PATH + "page_white_code.png";
+ public static final String XML_TREE_NODE_ICON = FAMFAMFAM_SILK_PATH + "tag.png";
+ public static final String XML_TREE_ATTRIBUTE_ICON = "xpath_attribute.png";
+
+ public static final String XML_TREE_EXPAND_ALL_ICON = FAMFAMFAM_SILK_PATH
+ + "text_linespacing.png";
+ public static final String XML_TREE_COLLAPSE_ALL_ICON = FAMFAMFAM_SILK_PATH
+ + "text_linespacing (collapse).png";
+
+ public static final String XPATH_STATUS_OK_ICON = FAMFAMFAM_SILK_PATH + "accept.png";
+ public static final String XPATH_STATUS_ERROR_ICON = FAMFAMFAM_SILK_PATH + "exclamation.png";
+ public static final String XPATH_STATUS_UNKNOWN_ICON = FAMFAMFAM_SILK_PATH + "help.png";
+
+ public static final String FOLD_ICON = FOLDS_PATH + "fold.png";
+ public static final String UNFOLD_ICON = FOLDS_PATH + "unfold.png";
+
+ // ------
+
+ private static ImageIcon icon;
+
+ public int canProvideIconScore(URI activityType) {
+ if (XPathTemplateService.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getXPathActivityIcon();
+ }
+
+ public static Icon getXPathActivityIcon() {
+ if (icon == null) {
+ synchronized (XPathActivityIcon.class) {
+ if (icon == null) {
+ try {
+ icon = new ImageIcon(
+ XPathActivityIcon.class.getResource(XPATH_ACTIVITY_ICON));
+ } catch (NullPointerException e) {
+ /* icon wasn't found - do nothing, but no icon will be available */
+ }
+ }
+ }
+ }
+ return (icon);
+ }
+
+ public static Icon getIconById(String iconID) {
+ try {
+ return (new ImageIcon(XPathActivityIcon.class.getResource(iconID)));
+ } catch (NullPointerException e) {
+ // requested icon wasn't found - just return null
+ return (null);
+ }
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ colourManager.setPreferredColour(XPathTemplateService.ACTIVITY_TYPE.toString(), PROCESSOR_COLOUR);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathTemplateService.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathTemplateService.java
new file mode 100644
index 0000000..9abf37a
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/servicedescription/XPathTemplateService.java
@@ -0,0 +1,62 @@
+package org.apache.taverna.activities.xpath.ui.servicedescription;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class XPathTemplateService extends AbstractTemplateService {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xpath");
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ ObjectNode json = (ObjectNode) configuration.getJson();
+ json.put("xpathExpression", "/");
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return XPathActivityIcon.getXPathActivityIcon();
+ }
+
+ public String getName() {
+ return "XPath";
+ }
+
+ public String getDescription() {
+ return "Service for point-and-click creation of XPath expressions for XML data";
+ }
+
+ public static ServiceDescription getServiceDescription() {
+ XPathTemplateService gts = new XPathTemplateService();
+ return gts.templateService;
+ }
+
+ public String getId() {
+ return "http://www.taverna.org.uk/2010/services/xpath";
+ }
+
+ @Override
+ public XPathTemplateService newInstance() {
+ return new XPathTemplateService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index be7da5f..0000000
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 7700abb..0000000
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.xpath.ui.contextualview.ConfigureXPathActivityMenuAction
-net.sf.taverna.t2.activities.xpath.ui.menu.AddXPathTemplateAction
-net.sf.taverna.t2.activities.xpath.ui.menu.AddXPathTemplateMenuAction
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index b759c2e..0000000
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index e248981..0000000
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
- net.sf.taverna.t2.activities.xpath.ui.contextualview.XPathActivityMainContextViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..49f4b21
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..079c0bb
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+org.apache.taverna.activities.xpath.ui.contextualview.ConfigureXPathActivityMenuAction
+org.apache.taverna.activities.xpath.ui.menu.AddXPathTemplateAction
+org.apache.taverna.activities.xpath.ui.menu.AddXPathTemplateMenuAction
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..69903f8
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.xpath.ui.servicedescription.XPathActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..248a92e
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+ org.apache.taverna.activities.xpath.ui.contextualview.XPathActivityMainContextViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context-osgi.xml b/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context-osgi.xml
index 1e53ea6..f368183 100644
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context-osgi.xml
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context-osgi.xml
@@ -6,23 +6,23 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="XPathActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="XPathActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="XPathTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="XPathTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="ConfigureXPathActivityMenuAction" auto-export="interfaces" />
<service ref="AddXPathTemplateAction" auto-export="interfaces" />
<service ref="AddXPathTemplateMenuAction" auto-export="interfaces" />
- <service ref="XPathActivityMainContextViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="XPathActivityMainContextViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context.xml b/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context.xml
index 0116b2e..d10f141 100644
--- a/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context.xml
+++ b/taverna-xpath-activity-ui/src/main/resources/META-INF/spring/xpath-activity-ui-context.xml
@@ -5,15 +5,15 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="XPathActivityIcon"
- class="net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathActivityIcon">
+ class="org.apache.taverna.activities.xpath.ui.servicedescription.XPathActivityIcon">
<property name="colourManager" ref="colourManager" />
</bean>
<bean id="XPathTemplateService"
- class="net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService" />
+ class="org.apache.taverna.activities.xpath.ui.servicedescription.XPathTemplateService" />
<bean id="ConfigureXPathActivityMenuAction"
- class="net.sf.taverna.t2.activities.xpath.ui.contextualview.ConfigureXPathActivityMenuAction">
+ class="org.apache.taverna.activities.xpath.ui.contextualview.ConfigureXPathActivityMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -21,7 +21,7 @@
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
<bean id="AddXPathTemplateAction"
- class="net.sf.taverna.t2.activities.xpath.ui.menu.AddXPathTemplateAction">
+ class="org.apache.taverna.activities.xpath.ui.menu.AddXPathTemplateAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -29,7 +29,7 @@
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
<bean id="AddXPathTemplateMenuAction"
- class="net.sf.taverna.t2.activities.xpath.ui.menu.AddXPathTemplateMenuAction">
+ class="org.apache.taverna.activities.xpath.ui.menu.AddXPathTemplateMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -38,7 +38,7 @@
</bean>
<bean id="XPathActivityMainContextViewFactory"
- class="net.sf.taverna.t2.activities.xpath.ui.contextualview.XPathActivityMainContextViewFactory">
+ class="org.apache.taverna.activities.xpath.ui.contextualview.XPathActivityMainContextViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/arrow_right.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/arrow_right.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/arrow_right.png
deleted file mode 100644
index 2cf15f1..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/arrow_right.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png
deleted file mode 100644
index 89c8129..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png
deleted file mode 100644
index c37bd06..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/help.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/help.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/help.png
deleted file mode 100644
index 5c87017..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/help.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png
deleted file mode 100644
index 0c76bd1..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png
deleted file mode 100644
index e093032..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png
deleted file mode 100644
index ff09e31..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png
deleted file mode 100644
index 1a91cbd..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/fold.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/fold.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/fold.png
deleted file mode 100644
index a13d280..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/fold.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/unfold.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/unfold.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/unfold.png
deleted file mode 100644
index 589e2c9..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/folds/unfold.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/xpath_attribute.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/xpath_attribute.png b/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/xpath_attribute.png
deleted file mode 100644
index 3fa7811..0000000
Binary files a/taverna-xpath-activity-ui/src/main/resources/net/sf/taverna/t2/activities/xpath/ui/servicedescription/xpath_attribute.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/arrow_right.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/arrow_right.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/arrow_right.png
new file mode 100644
index 0000000..2cf15f1
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/arrow_right.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png
new file mode 100644
index 0000000..89c8129
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/accept.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png
new file mode 100644
index 0000000..c37bd06
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/exclamation.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/help.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/help.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/help.png
new file mode 100644
index 0000000..5c87017
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/help.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png
new file mode 100644
index 0000000..0c76bd1
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/page_white_code.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png
new file mode 100644
index 0000000..e093032
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/tag.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png
new file mode 100644
index 0000000..ff09e31
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing (collapse).png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png
new file mode 100644
index 0000000..1a91cbd
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/famfamfam_silk/text_linespacing.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/fold.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/fold.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/fold.png
new file mode 100644
index 0000000..a13d280
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/fold.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/unfold.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/unfold.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/unfold.png
new file mode 100644
index 0000000..589e2c9
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/folds/unfold.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/xpath_attribute.png
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/xpath_attribute.png b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/xpath_attribute.png
new file mode 100644
index 0000000..3fa7811
Binary files /dev/null and b/taverna-xpath-activity-ui/src/main/resources/org/apache/taverna/activities/xpath/ui/servicedescription/xpath_attribute.png differ
[13/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge
index cdd408d..91876fa 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>String seperatorString = "\n";
if (seperator != void) {
seperatorString = seperator;
@@ -15,7 +15,7 @@ concatenated = sb.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -24,8 +24,8 @@ concatenated = sb.toString();
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -34,16 +34,16 @@ concatenated = sb.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>concatenated</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference
index c7bb289..d9a1022 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>List difference = new ArrayList();
for (Iterator i = list1.iterator(); i.hasNext();) {
Object o = i.next();
@@ -15,7 +15,7 @@ for (Iterator i = list2.iterator(); i.hasNext();) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -24,8 +24,8 @@ for (Iterator i = list2.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -34,16 +34,16 @@ for (Iterator i = list2.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>difference</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection
index a4c2f5a..c7cd72b 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>List intersection = new ArrayList();
for (Iterator i = list1.iterator(); i.hasNext();) {
Object o = i.next();
@@ -9,7 +9,7 @@ for (Iterator i = list1.iterator(); i.hasNext();) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -18,8 +18,8 @@ for (Iterator i = list1.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -28,16 +28,16 @@ for (Iterator i = list1.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>intersection</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion
index 1ef0958..154c67d 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion
@@ -1,6 +1,6 @@
<activity xmlns="http://taverna.sf.net/2008/xml/t2flow">
-<class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>Set results = new HashSet();
results.addAll(list1);
results.addAll(list2);
@@ -9,7 +9,7 @@ union.addAll(results);
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -18,8 +18,8 @@ union.addAll(results);
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -28,16 +28,16 @@ union.addAll(results);
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>union</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates
index 310dccc..6ecd7c8 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>List strippedlist = new ArrayList();
for (Iterator i = stringlist.iterator(); i.hasNext();) {
String item = (String) i.next();
@@ -9,7 +9,7 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -18,16 +18,16 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>strippedlist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor
index 790073a..6632920 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor
@@ -1,8 +1,8 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>throw new Exception("This script fails");</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -11,8 +11,8 @@
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -21,16 +21,16 @@
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>urgle</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails
index 90e8ba8..0b98e4f 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.util.Random;
Random r = new Random();
@@ -10,7 +10,7 @@ if ((r.nextInt() % 4) == 0) {
out = in;</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -19,16 +19,16 @@ out = in;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>out</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher
index db3a73a..94a8ffd 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((url == void) || (url == null)) {
throw new RuntimeException("The url must be specified");
}
@@ -30,7 +30,7 @@ os.close();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -39,8 +39,8 @@ os.close();
<mimeTypes>
<string>'text/x-taverna-web-url'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -49,16 +49,16 @@ os.close();
<mimeTypes>
<string>'text/x-taverna-web-url'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>image</name>
<depth>0</depth>
<mimeTypes>
<string>'image/*'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
index dcd76a6..7d7a4f6 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((url == void) || (url == null)) {
throw new RuntimeException("The url must be specified");
}
@@ -34,7 +34,7 @@ contents = result.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -43,8 +43,8 @@ contents = result.toString();
<mimeTypes>
<string>'text/x-taverna-web-url'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -53,16 +53,16 @@ contents = result.toString();
<mimeTypes>
<string>'text/x-taverna-web-url'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>contents</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain,text/html'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/pom.xml b/taverna-rest-activity-ui/pom.xml
index 5268144..74d62b1 100644
--- a/taverna-rest-activity-ui/pom.xml
+++ b/taverna-rest-activity-ui/pom.xml
@@ -16,15 +16,15 @@
<dependencies>
<dependency>
- <groupId>org.apache.taverna.commonactivities</groupId>
- <artifactId>taverna-rest-activity</artifactId>
- <version>${taverna.commonactivities.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.taverna.engine</groupId>
<artifactId>taverna-services-api</artifactId>
<version>${taverna.engine.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-rest-activity</artifactId>
+ <version>${taverna.commonactivities.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.taverna.workbench</groupId>
<artifactId>taverna-activity-tools</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java
deleted file mode 100644
index 30507c9..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.config;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-
-import javax.swing.table.AbstractTableModel;
-
-@SuppressWarnings("serial")
-public class HTTPHeadersTableModel extends AbstractTableModel {
-
- protected String[] columnNames;
- protected ArrayList<ArrayList<String>> data;
-
- public HTTPHeadersTableModel() {
- columnNames = new String[] {"HTTP Header Name", "HTTP Header Value"};
- data = new ArrayList<ArrayList<String>>();
- }
-
- public String getColumnName(int column) {
- return columnNames[column];
- }
-
- public boolean isCellEditable(int row, int column) {
- return true;
- }
-
- public int getColumnCount()
- {
- return columnNames.length;
- }
-
- public int getRowCount()
- {
- return data.size();
- }
-
- public Object getValueAt(int row, int column)
- {
- return data.get(row).get(column);
- }
-
- public void setValueAt(Object value, int row, int column) {
- if ((row < 0) || (column < 0)) {
- throw new IllegalArgumentException("Invalid row/column setting");
- }
- data.get(row).set(column, (String)value);
- }
-
- /**
- * Get the class at of the cells at the given column position.
- */
- public Class<? extends Object> getColumnClass(int iCol)
- {
- return getValueAt(0, iCol).getClass();
- }
-
-
- public void addEmptyRow() {
- data.add(new ArrayList<String>(Arrays.asList("", ""))); // add empty row
- fireTableRowsInserted(
- data.size() - 1,
- data.size() - 1);
- }
-
- public void addRow(ArrayList<String> headerValuePair) {
- data.add(headerValuePair);
- fireTableRowsInserted(
- data.size() - 1,
- data.size() - 1);
- }
-
- public void removeRow(int row)
- {
- if (row >=0 && row < data.size()){
- data.remove(row);
- fireTableRowsDeleted(row, row);
- }
- }
-
- public ArrayList<ArrayList<String>> getHTTPHeaderData(){
- // Return a deep copy of the 2-dimensional array
- return deepCopy(data);
- }
-
- public void setHTTPHeaderData(ArrayList<ArrayList<String>> data){
- this.data = deepCopy(data);
- fireTableChanged(null);
- }
-
- public ArrayList<String> getHTTPHeaderNames(){
- ArrayList<String> headerNames = new ArrayList<String>();
- for (ArrayList<String> headerNameValuePair : data){
- headerNames.add(headerNameValuePair.get(0));
- }
- return headerNames;
- }
-
- public ArrayList<String> getHTTPHeaderValues(){
- ArrayList<String> headerValues = new ArrayList<String>();
- for (ArrayList<String> headerNameValuePair : data){
- headerValues.add(headerNameValuePair.get(1));
- }
- return headerValues;
- }
-
- public static ArrayList<ArrayList<String>> deepCopy(ArrayList<ArrayList<String>> src)
- {
- ArrayList<ArrayList<String>> dest = new ArrayList<ArrayList<String>>();
-
- for (int i = 0; i< src.size(); i++){
- dest.add(new ArrayList<String>(Arrays.asList(new String[src.get(i).size()])));
- Collections.copy(dest.get(i), src.get(i));
- }
- return dest;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
deleted file mode 100644
index 3f1ae9b..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
+++ /dev/null
@@ -1,670 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.config;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Scanner;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-
-import org.apache.taverna.activities.rest.RESTActivity;
-import org.apache.taverna.activities.rest.RESTActivity.DATA_FORMAT;
-import org.apache.taverna.activities.rest.RESTActivity.HTTP_METHOD;
-import org.apache.taverna.activities.rest.RESTActivityConfigurationBean;
-import org.apache.taverna.activities.rest.URISignatureHandler;
-import org.apache.taverna.activities.rest.URISignatureHandler.URISignatureParsingException;
-import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-@SuppressWarnings("serial")
-public class RESTActivityConfigurationPanel extends MultiPageActivityConfigurationPanel {
- private static final Icon infoIcon = new ImageIcon(
- RESTActivityConfigurationPanel.class.getResource("information.png"));
-
- // GENERAL tab
- private JComboBox<HTTP_METHOD> cbHTTPMethod; // HTTP method of this REST activity
- private JTextField tfURLSignature; // URL signature that determines its
- // input ports
- private JComboBox<String> cbAccepts; // for Accepts header
- private JLabel jlContentTypeExplanation;
- private JLabel jlContentTypeExplanationPlaceholder;
- private JLabel jlContentType;
- private JLabel jlContentTypeLabelPlaceholder; // this placeholder label will
- // take up space of the
- // ContentType combo-box
- // when the latter is not
- // shown
- private JLabel jlContentTypeFieldPlaceholder;
- private JComboBox<String> cbContentType; // for MIME type of data sent to the server
- // by POST / PUT methods
- private JLabel jlSendDataAs;
- private JComboBox<DATA_FORMAT> cbSendDataAs;
- private JLabel jlSendDataAsLabelPlaceholder;
- private JLabel jlSendDataAsFieldPlaceholder;
-
- // ADVANCED tab
- private JCheckBox cbSendHTTPExpectHeader;
- private JCheckBox cbShowRedirectionOutputPort;
- private JCheckBox cbShowActualUrlPort;
- private JCheckBox cbShowResponseHeadersPort;
- private JCheckBox cbEscapeParameters;
- private JButton addHeaderButton;
- private JButton removeHeaderButton;
- private JTable httpHeadersTable;
- private HTTPHeadersTableModel httpHeadersTableModel;
-
- private String[] mediaTypes;
-
- private final ServiceRegistry serviceRegistry;
-
- public RESTActivityConfigurationPanel(Activity activity, ServiceRegistry serviceRegistry) {
- super(activity);
- this.serviceRegistry = serviceRegistry;
- initialise();
- }
-
- @Override
- protected void initialise() {
- super.initialise();
- removeAllPages();
- addPage("General", createGeneralTab());
- addPage("Advanced", createAdvancedTab());
- refreshConfiguration();
- }
-
- @Override
- public void noteConfiguration() {
- ObjectNode requestNode = json.objectNode();
-
- String methodName = ((HTTP_METHOD) cbHTTPMethod.getSelectedItem()).name();
- requestNode.put("httpMethod", methodName);
- requestNode.put("absoluteURITemplate", tfURLSignature.getText().trim());
-
- ArrayNode headersNode = requestNode.arrayNode();
- headersNode.addObject().put("header", "Accept").put("value", (String) cbAccepts.getSelectedItem());
- headersNode.addObject().put("header", "Content-Type").put("value", (String) cbContentType.getSelectedItem());
- if (cbSendHTTPExpectHeader.isSelected()) {
- headersNode.addObject().put("header", "Expect").put("value", "100-continue");
- }
- ArrayList<String> headerNames = httpHeadersTableModel.getHTTPHeaderNames();
- ArrayList<String> headerValues = httpHeadersTableModel.getHTTPHeaderValues();
- for (int i = 0; i < headerNames.size(); i++) {
- headersNode.addObject().put("header", headerNames.get(i)).put("value", headerValues.get(i));
- }
-
- requestNode.set("headers", headersNode);
- json.set("request", requestNode);
-
- json.put("outgoingDataFormat", ((DATA_FORMAT) cbSendDataAs.getSelectedItem()).name());
- json.put("showRedirectionOutputPort", cbShowRedirectionOutputPort
- .isSelected());
- json.put("showActualURLPort", cbShowActualUrlPort.isSelected());
- json.put("showResponseHeadersPort", cbShowResponseHeadersPort.isSelected());
- json.put("escapeParameters", cbEscapeParameters.isSelected());
-
- configureInputPorts(serviceRegistry);
- configureOutputPorts(serviceRegistry);
- }
-
- /**
- * Check that user values in the UI are valid.
- */
- @Override
- public boolean checkValues() {
- // HTTP method is a fixed selection combo-box - no validation required
-
- // URL signature must be present and be valid
- String candidateURLSignature = tfURLSignature.getText().trim();
- if (candidateURLSignature == null
- || candidateURLSignature.length() == 0) {
- JOptionPane.showMessageDialog(MainWindow.getMainWindow(),
- "URL signature must not be empty",
- "REST Activity Configuration - Warning",
- JOptionPane.WARNING_MESSAGE);
- return (false);
- } else {
- try {
- // Test if any exceptions will be thrown - if not, proceed to
- // other validations
- URISignatureHandler.validate(candidateURLSignature);
- } catch (URISignatureParsingException e) {
- JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e
- .getMessage(), "REST Activity Configuration - Warning",
- JOptionPane.WARNING_MESSAGE);
- return (false);
- }
-
- // Test if the URL string contains "unsafe" characters, i.e. characters
- // that need URL-encoding.
- // From RFC 1738: "...Only alphanumerics [0-9a-zA-Z], the special
- // characters "$-_.+!*'()," (not including the quotes) and reserved
- // characters used for their reserved purposes may be
- // used unencoded within a URL."
- // Reserved characters are: ";/?:@&=" ..." (excluding quotes) and "%" used
- // for escaping.
- // We do not warn the user if they have not properly enclosed parameter
- // names in curly braces as this check is already being done elsewhere in the code.
- // We do not check the characters in parameter names either.
- try {
- // Test if any exceptions will be thrown - if not, proceed to
- // other validations
- URISignatureHandler.checkForUnsafeCharacters(candidateURLSignature);
- } catch (URISignatureParsingException e) {
- JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e
- .getMessage(), "REST Activity Configuration - Warning",
- JOptionPane.WARNING_MESSAGE);
- return (false);
- }
-
- // Other HTTP headers configured must not have empty names
- ArrayList<String> otherHTTPHeaderNames = httpHeadersTableModel.getHTTPHeaderNames();
- for (String headerName : otherHTTPHeaderNames){
- if (headerName.equals("")){
- JOptionPane.showMessageDialog(MainWindow.getMainWindow(), "One of the HTTP header names is empty", "REST Activity Configuration - Warning",
- JOptionPane.WARNING_MESSAGE);
- return false;
- }
- }
- }
-
- // All valid, return true
- return true;
- }
-
- /**
- * Update GUI from a changed configuration bean (perhaps by undo / redo).
- */
- @Override
- public void refreshConfiguration() {
- RESTActivityConfigurationBean configBean = new RESTActivityConfigurationBean(json);
-
- cbHTTPMethod.setSelectedItem(configBean.getHttpMethod());
- tfURLSignature.setText(configBean.getUrlSignature());
- tfURLSignature.setCaretPosition(0);
- cbAccepts.setSelectedItem(configBean.getAcceptsHeaderValue());
- cbContentType.setSelectedItem(configBean.getContentTypeForUpdates());
- cbSendDataAs.setSelectedItem(configBean.getOutgoingDataFormat());
- cbSendHTTPExpectHeader.setSelected(configBean
- .getSendHTTPExpectRequestHeader());
- cbShowRedirectionOutputPort.setSelected(configBean
- .getShowRedirectionOutputPort());
- cbShowActualUrlPort.setSelected(configBean.getShowActualUrlPort());
- cbShowResponseHeadersPort.setSelected(configBean.getShowResponseHeadersPort());
- cbEscapeParameters.setSelected(configBean.getEscapeParameters());
- httpHeadersTableModel.setHTTPHeaderData(configBean.getOtherHTTPHeaders());
- }
-
- private JPanel createGeneralTab() {
- JPanel jpGeneral = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- // All components to be anchored WEST
- c.anchor = GridBagConstraints.WEST;
-
- c.gridx = 0;
- c.gridy = 0;
- c.gridwidth = 1;
- c.insets = new Insets(7, 7, 3, 3);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- JLabel labelMethod = new JLabel("HTTP Method:", infoIcon, JLabel.LEFT);
- labelMethod
- .setToolTipText("<html>HTTP method determines how a request to the remote server will be made.<br><br>"
- + "Supported HTTP methods are normally used for different purposes:<br>"
- + "<b>GET</b> - to fetch data;<br>"
- + "<b>POST</b> - to create new resources;<br>"
- + "<b>PUT</b> - to update existing resources;<br>"
- + "<b>DELETE</b> - to remove existing resources.<br><br>"
- + "Documentation of the server that is about to be used may suggest the<br>"
- + "HTTP method that should be used.</html>");
- jpGeneral.add(labelMethod, c);
-
- // the HTTP method combo-box will always contain the same values - it is
- // the selected
- // method which is important; therefore, can prepopulate as the set of
- // values is known
- c.gridx++;
- c.insets = new Insets(7, 3, 3, 7);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
- cbHTTPMethod = new JComboBox<>(HTTP_METHOD.values());
- cbHTTPMethod.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- boolean contentTypeSelEnabled = RESTActivity
- .hasMessageBodyInputPort((HTTP_METHOD) cbHTTPMethod
- .getSelectedItem());
-
- jlContentTypeExplanation.setVisible(contentTypeSelEnabled);
- jlContentType.setVisible(contentTypeSelEnabled);
- cbContentType.setVisible(contentTypeSelEnabled);
- jlSendDataAs.setVisible(contentTypeSelEnabled);
- cbSendDataAs.setVisible(contentTypeSelEnabled);
-
- jlContentTypeExplanationPlaceholder
- .setVisible(!contentTypeSelEnabled);
- jlContentTypeLabelPlaceholder
- .setVisible(!contentTypeSelEnabled);
- jlContentTypeFieldPlaceholder
- .setVisible(!contentTypeSelEnabled);
- jlSendDataAsLabelPlaceholder.setVisible(!contentTypeSelEnabled);
- jlSendDataAsFieldPlaceholder.setVisible(!contentTypeSelEnabled);
- }
- });
- jpGeneral.add(cbHTTPMethod, c);
-
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 7, 3, 3);
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0.0;
- JLabel labelString = new JLabel("URL Template:", infoIcon, JLabel.LEFT);
- labelString
- .setToolTipText("<html>URL template enables to define a URL with <b>configurable<br>"
- + "parameters</b> that will be used to access a remote server.<br><br>"
- + "The template may contain zero or more <b>parameters</b> - each<br>"
- + "enclosed within curly braces <b>\"{\"</b> and <b>\"}\"</b>.<br>"
- + "Taverna will automatically create an individual input port for<br>"
- + "this activity for each parameter.<br><br>"
- + "Values extracted from these input ports during the workflow<br>"
- + "execution these will be used to replace the parameters to<br>"
- + "produce complete URLs.<br><br>"
- + "For example, if the URL template is configured as<br>"
- + "\"<i>http://www.myexperiment.org/user.xml?id={userID}</i>\", a<br>"
- + "single input port with the name \"<i>userID</i>\" will be created.</html>");
- labelString.setLabelFor(tfURLSignature);
- jpGeneral.add(labelString, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 3, 7);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
- tfURLSignature = new JTextField(40);
- tfURLSignature.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- tfURLSignature.selectAll();
- }
-
- public void focusLost(FocusEvent e) { /* do nothing */
- }
- });
- jpGeneral.add(tfURLSignature, c);
-
- c.gridx = 0;
- c.gridwidth = 2;
- c.gridy++;
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(18, 7, 3, 7);
- JLabel jlAcceptsExplanation = new JLabel(
- "Preferred MIME type for data to be fetched from the remote server --");
- jpGeneral.add(jlAcceptsExplanation, c);
- c.gridwidth = 1;
-
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 7, 3, 3);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- JLabel jlAccepts = new JLabel("'Accept' header:", infoIcon, JLabel.LEFT);
- jlAccepts
- .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</br>");
- jlAccepts.setLabelFor(cbAccepts);
- jpGeneral.add(jlAccepts, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 3, 7);
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- cbAccepts = new JComboBox<>(getMediaTypes());
- cbAccepts.setEditable(true);
- cbAccepts.getEditor().getEditorComponent().addFocusListener(
- new FocusListener() {
- public void focusGained(FocusEvent e) {
- cbAccepts.getEditor().selectAll();
- }
-
- public void focusLost(FocusEvent e) { /* do nothing */
- }
- });
- jpGeneral.add(cbAccepts, c);
-
- c.gridx = 0;
- c.gridwidth = 2;
- c.gridy++;
- c.insets = new Insets(18, 7, 3, 7);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- jlContentTypeExplanation = new JLabel(
- "MIME type of data that will be sent to the remote server --");
- jpGeneral.add(jlContentTypeExplanation, c);
- c.gridwidth = 1;
-
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 7, 3, 3);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- jlContentType = new JLabel("'Content-Type' header:", infoIcon,
- JLabel.LEFT);
- jlContentType
- .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</html>");
- jlContentType.setLabelFor(cbContentType);
- jpGeneral.add(jlContentType, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 3, 7);
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- cbContentType = new JComboBox<>(getMediaTypes());
- cbContentType.setEditable(true);
- cbContentType.getEditor().getEditorComponent().addFocusListener(
- new FocusListener() {
- public void focusGained(FocusEvent e) {
- cbContentType.getEditor().selectAll();
- }
-
- public void focusLost(FocusEvent e) { /* do nothing */
- }
- });
- cbContentType.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- // change selection in the "Send data as" combo-box, based on
- // the selection of Content-Type
- String selectedContentType = (String) cbContentType
- .getSelectedItem();
- if (selectedContentType.startsWith("text")) {
- cbSendDataAs.setSelectedItem(DATA_FORMAT.String);
- } else {
- cbSendDataAs.setSelectedItem(DATA_FORMAT.Binary);
- }
- }
- });
- jpGeneral.add(cbContentType, c);
-
- c.gridx = 0;
- c.gridwidth = 2;
- c.gridy++;
- c.insets = new Insets(18, 7, 3, 7);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- jlContentTypeExplanationPlaceholder = new JLabel();
- jlContentTypeExplanationPlaceholder
- .setPreferredSize(jlContentTypeExplanation.getPreferredSize());
- jpGeneral.add(jlContentTypeExplanationPlaceholder, c);
- c.gridwidth = 1;
-
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 7, 3, 3);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- jlContentTypeLabelPlaceholder = new JLabel();
- jlContentTypeLabelPlaceholder.setPreferredSize(jlContentType
- .getPreferredSize());
- jpGeneral.add(jlContentTypeLabelPlaceholder, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 3, 7);
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- jlContentTypeFieldPlaceholder = new JLabel();
- jlContentTypeFieldPlaceholder.setPreferredSize(cbContentType
- .getPreferredSize());
- jpGeneral.add(jlContentTypeFieldPlaceholder, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(3, 7, 8, 3);
- jlSendDataAs = new JLabel("Send data as:", infoIcon, JLabel.LEFT);
- jlSendDataAs
- .setToolTipText("Select the format for the data to be sent to the remote server");
- jlSendDataAs.setLabelFor(cbSendDataAs);
- jpGeneral.add(jlSendDataAs, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 8, 7);
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- cbSendDataAs = new JComboBox<>(DATA_FORMAT.values());
- cbSendDataAs.setEditable(false);
- jpGeneral.add(cbSendDataAs, c);
-
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 7, 8, 3);
- c.weightx = 0.0;
- c.fill = GridBagConstraints.NONE;
- jlSendDataAsLabelPlaceholder = new JLabel();
- jlSendDataAsLabelPlaceholder.setPreferredSize(jlSendDataAs
- .getPreferredSize());
- jpGeneral.add(jlSendDataAsLabelPlaceholder, c);
-
- c.gridx++;
- c.insets = new Insets(3, 3, 8, 7);
- c.weightx = 1.0;
- c.fill = GridBagConstraints.HORIZONTAL;
- jlSendDataAsFieldPlaceholder = new JLabel();
- jlSendDataAsFieldPlaceholder.setPreferredSize(cbSendDataAs
- .getPreferredSize());
- jpGeneral.add(jlSendDataAsFieldPlaceholder, c);
-
- JPanel finalPanel = new JPanel(new BorderLayout());
- finalPanel.add(jpGeneral, BorderLayout.NORTH);
- return (finalPanel);
- }
-
- private String[] getMediaTypes() {
- if (mediaTypes != null) {
- return mediaTypes;
- }
- List<String> types = new ArrayList<String>();
- InputStream typesStream = getClass().getResourceAsStream(
- "mediatypes.txt");
- try {
- // media types must be ASCII and can't have whitespace
- Scanner scanner = new Scanner(typesStream, "ascii");
- while (scanner.hasNext()) {
- types.add(scanner.next());
- }
- scanner.close();
- } finally {
- try {
- typesStream.close();
- } catch (IOException ex) {
- }
- }
- mediaTypes = types.toArray(new String[0]);
-
- return mediaTypes;
- }
-
- private JPanel createAdvancedTab() {
- JPanel jpAdvanced = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridx = 0;
- c.gridy = 0;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(8, 10, 2, 4);
- JLabel jlExpectHeaderInfoIcon = new JLabel(infoIcon);
- jlExpectHeaderInfoIcon
- .setToolTipText("<html>Ticking this checkbox may significantly improve performance when<br>"
- + "large volumes of data are sent to the remote server and a redirect<br>"
- + "from the original URL to the one specified by the server is likely.<br>"
- + "<br>"
- + "However, this checkbox <b>must not</b> be ticked to allow this activity<br>"
- + "to post updates to Twitter.</html>");
- jpAdvanced.add(jlExpectHeaderInfoIcon, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(8, 0, 2, 8);
- cbSendHTTPExpectHeader = new JCheckBox(
- "Send HTTP Expect request-header field");
- jpAdvanced.add(cbSendHTTPExpectHeader, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- c.insets = new Insets(2, 10, 5, 4);
- JLabel jlShowRedirectionOutputPortInfoIcon = new JLabel(infoIcon);
- jlShowRedirectionOutputPortInfoIcon
- .setToolTipText("<html>\"Redirection\" output port displays the URL of the final redirect<br>"
- + "that has yielded the output data on the \"Response Body\" port.</html>");
- jpAdvanced.add(jlShowRedirectionOutputPortInfoIcon, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(2, 0, 5, 8);
- cbShowRedirectionOutputPort = new JCheckBox(
- "Show \"Redirection\" output port");
- jpAdvanced.add(cbShowRedirectionOutputPort, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- c.insets = new Insets(2, 10, 5, 4);
- JLabel jlShowActualUrlPortInfoIcon = new JLabel(infoIcon);
- jlShowActualUrlPortInfoIcon
- .setToolTipText("<html>\"Actual URL\" output port displays the URL used by the REST service<br>"
- + "with the actual parameter values.</html>");
- jpAdvanced.add(jlShowActualUrlPortInfoIcon, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(2, 0, 5, 8);
- cbShowActualUrlPort = new JCheckBox(
- "Show \"Actual URL\" output port");
- jpAdvanced.add(cbShowActualUrlPort, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- c.insets = new Insets(2, 10, 5, 4);
- JLabel jlShowResponseHeadersPortInfoIcon = new JLabel(infoIcon);
- jlShowResponseHeadersPortInfoIcon
- .setToolTipText("<html>\"Response headers\" output port displays the HTTP headers<br>"
- + "received from the final (after redirection) HTTP call.</html>");
- jpAdvanced.add(jlShowResponseHeadersPortInfoIcon, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(2, 0, 5, 8);
- cbShowResponseHeadersPort = new JCheckBox(
- "Show \"Response headers\" output port");
- jpAdvanced.add(cbShowResponseHeadersPort, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- c.insets = new Insets(2, 10, 5, 4);
- JLabel jlEscapeParametersInfoIcon = new JLabel(infoIcon);
- jlEscapeParametersInfoIcon
- .setToolTipText("<html>Determines if parameters you pass to form the full URL<br>" +
- " of the REST service will be URL-escaped.</html>");
- jpAdvanced.add(jlEscapeParametersInfoIcon, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(2, 0, 5, 8);
- cbEscapeParameters = new JCheckBox("Escape URL parameter values");
- jpAdvanced.add(cbEscapeParameters, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(2, 10, 5, 4);
- JLabel jlHTTPHeadersInfoIcon = new JLabel(infoIcon);
- jlHTTPHeadersInfoIcon
- .setToolTipText("<html>Set additional HTTP headers</html>");
- jpAdvanced.add(jlHTTPHeadersInfoIcon, c);
-
- c.gridx = 1;
- c.weightx = 0;
- c.weighty = 0;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.NONE;
- c.insets = new Insets(2, 10, 5, 4);
- addHeaderButton = new JButton("Add HTTP header");
- addHeaderButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- httpHeadersTableModel.addEmptyRow();
- httpHeadersTable.getSelectionModel().setSelectionInterval(httpHeadersTableModel.getRowCount() - 1, httpHeadersTableModel.getRowCount() - 1); }
- });
- removeHeaderButton = new JButton("Remove HTTP header");
- removeHeaderButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- int row = httpHeadersTable.getSelectedRow();
- httpHeadersTableModel.removeRow(row);
- }
- });
- JPanel buttonPanel = new JPanel();
- buttonPanel.add(addHeaderButton, FlowLayout.LEFT);
- buttonPanel.add(removeHeaderButton);
- jpAdvanced.add(buttonPanel, c);
-
- c.gridx = 1;
- c.gridy++;
- c.weightx = 0;
- c.weighty = 1.0;
- c.fill = GridBagConstraints.BOTH;
- c.insets = new Insets(2, 10, 5, 4);
- httpHeadersTableModel = new HTTPHeadersTableModel();
- httpHeadersTable = new JTable(httpHeadersTableModel);
- httpHeadersTable.setGridColor(Color.GRAY);
- httpHeadersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- setVisibleRowCount(httpHeadersTable, 3);
- JScrollPane headersTableScrollPane = new JScrollPane(httpHeadersTable);
- jpAdvanced.add(headersTableScrollPane, c);
-
- return (jpAdvanced);
- }
-
- /*
- * Based on http://www.javalobby.org/java/forums/t19559.html
- */
- public static void setVisibleRowCount(JTable table, int visibleRows){
- int height = 0;
- for(int row = 0; row < visibleRows; row++)
- height += table.getRowHeight(row);
-
- table.setPreferredScrollableViewportSize(new Dimension(
- table.getPreferredScrollableViewportSize().width,
- height));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
deleted file mode 100644
index ff3477d..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.config;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-/**
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class RESTActivityConfigureAction extends ActivityConfigurationAction {
-
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ServiceRegistry serviceRegistry;
-
- public RESTActivityConfigureAction(Activity activity, Frame owner, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.serviceRegistry = serviceRegistry;
- }
-
- public void actionPerformed(ActionEvent e) {
- ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
- .getDialog(getActivity());
-
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
-
- RESTActivityConfigurationPanel panel = new RESTActivityConfigurationPanel(getActivity(), serviceRegistry);
- ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(), panel,
- editManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
deleted file mode 100644
index d38c4ac..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.rest.ui.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action to add a REST activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddRESTTemplateAction extends AbstractContextualMenuAction {
-
- private static final String ADD_REST = "REST";
-
- private static final URI insertSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/insert");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceRegistry serviceRegistry;
-
- public AddRESTTemplateAction() {
- super(insertSection, 500);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
- }
-
- @Override
- protected Action createAction() {
-
- return new AddRestAction();
- }
-
- protected class AddRestAction extends AbstractAction {
- AddRestAction() {
- super(ADD_REST, activityIconManager
- .iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(
- GenericRESTTemplateService.getServiceDescription(), false, editManager,
- menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
deleted file mode 100644
index ebc8ad6..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.rest.ui.menu;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * An action to add a REST activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author alanrw
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddRESTTemplateMenuAction extends AbstractMenuAction {
-
- private static final String ADD_REST = "REST";
-
- private static final URI INSERT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
- private static final URI ADD_REST_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddREST");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceRegistry serviceRegistry;
-
- public AddRESTTemplateMenuAction() {
- super(INSERT, 500, ADD_REST_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddRESTMenuAction();
- }
-
- protected class AddRESTMenuAction extends AbstractAction implements DesignOnlyAction {
- AddRESTMenuAction() {
- super();
- putValue(SMALL_ICON, activityIconManager.iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE));
- putValue(NAME, ADD_REST);
- putValue(SHORT_DESCRIPTION, "REST service");
- putValue(
- Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.SHIFT_DOWN_MASK
- | InputEvent.ALT_DOWN_MASK));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(
- GenericRESTTemplateService.getServiceDescription(), false, editManager,
- menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
deleted file mode 100644
index b60fb6a..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.servicedescription;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.activities.rest.RESTActivity;
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-/**
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class GenericRESTTemplateService extends AbstractTemplateService {
-
- public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/rest");
-
- private static final String REST = "REST";
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- ObjectNode json = (ObjectNode) configuration.getJson();
- ObjectNode requestNode = json.objectNode();
-
- requestNode.put("httpMethod", RESTActivity.HTTP_METHOD.GET.name());
- requestNode.put("absoluteURITemplate", "http://www.uniprot.org/uniprot/{id}.xml");
-
- ArrayNode headersNode = requestNode.arrayNode();
- headersNode.addObject().put("header", "Accept").put("value", "application/xml");
- headersNode.addObject().put("header", "Content-Type").put("value", "application/xml");
-
- requestNode.set("headers", headersNode);
- json.set("request", requestNode);
- json.put("outgoingDataFormat", RESTActivity.DATA_FORMAT.String.name());
- json.put("showRedirectionOutputPort", false);
- json.put("showActualURLPort", false);
- json.put("showResponseHeadersPort", false);
- json.put("escapeParameters", true);
- return configuration;
- }
-
- @Override
- public Icon getIcon() {
- return RESTActivityIcon.getRESTActivityIcon();
- }
-
- public String getName() {
- return REST;
- }
-
- public String getDescription() {
- return "A generic REST service that can handle all HTTP methods";
- }
-
- public static ServiceDescription getServiceDescription() {
- GenericRESTTemplateService gts = new GenericRESTTemplateService();
- return gts.templateService;
- }
-
- public String getId() {
- return "http://www.taverna.org.uk/2010/services/rest";
- }
-
- @Override
- public ServiceDescriptionProvider newInstance() {
- return new GenericRESTTemplateService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
deleted file mode 100644
index c2309a9..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.servicedescription;
-
-import java.awt.Color;
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-/**
- *
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class RESTActivityIcon implements ActivityIconSPI {
- private static final Color PROCESSOR_COLOUR = Color.decode("#7AAFFF");
-
- private static ImageIcon icon;
-
- public int canProvideIconScore(URI activityType) {
- if (GenericRESTTemplateService.ACTIVITY_TYPE.equals(activityType))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getRESTActivityIcon();
- }
-
- public static Icon getRESTActivityIcon() {
- if (icon == null) {
- synchronized (RESTActivityIcon.class) {
- if (icon == null) {
- try {
- icon = new ImageIcon(
- RESTActivityIcon.class.getResource("service_type_rest.png"));
- } catch (NullPointerException e) {
- /* icon wasn't found - do nothing, but no icon will be available */
- }
- }
- }
- }
- return (icon);
- }
-
- public void setColourManager(ColourManager colourManager) {
- // set colour for REST processors in the workflow diagram
- colourManager.setPreferredColour(GenericRESTTemplateService.ACTIVITY_TYPE.toString(), PROCESSOR_COLOUR);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
deleted file mode 100644
index 5d9848d..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
+++ /dev/null
@@ -1,99 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-import net.sf.taverna.t2.activities.rest.RESTActivity;
-import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
-
-public class ExampleServiceDesc extends ServiceDescription<RESTActivityConfigurationBean>
-{
- /**
- * The subclass of Activity which should be instantiated when adding a service
- * for this description
- */
- @Override
- public Class<? extends Activity<RESTActivityConfigurationBean>> getActivityClass() {
- return RESTActivity.class;
- }
-
- /**
- * The configuration bean which is to be used for configuring the instantiated activity.
- * Making this bean will typically require some of the fields set on this service
- * description, like an endpoint URL or method name.
- *
- */
- @Override
- public RESTActivityConfigurationBean getActivityConfiguration() {
- RESTActivityConfigurationBean bean = new RESTActivityConfigurationBean();
- bean.setExampleString(exampleString);
- bean.setExampleUri(exampleUri);
- return bean;
- }
-
- /**
- * An icon to represent this service description in the service palette.
- */
- @Override
- public Icon getIcon() {
- return null;
- }
-
- /**
- * The display name that will be shown in service palette and will
- * be used as a template for processor name when added to workflow.
- */
- @Override
- public String getName() {
- return exampleString;
- }
-
- /**
- * The path to this service description in the service palette. Folders
- * will be created for each element of the returned path.
- */
- @Override
- public List<String> getPath() {
- // For deeper paths you may return several strings
- return Arrays.asList("Service templates", "Examples " + exampleUri);
- }
-
- /**
- * Return a list of data values uniquely identifying this service
- * description (to avoid duplicates). Include only primary key like fields,
- * ie. ignore descriptions, icons, etc.
- */
- @Override
- protected List<? extends Object> getIdentifyingData() {
- // FIXME: Use your fields instead of example fields
- return Arrays.<Object>asList(exampleString, exampleUri);
- }
-
-
- // FIXME: Replace example fields and getters/setters with any required
- // and optional fields. (All fields are searchable in the Service palette,
- // for instance try a search for exampleString:3)
- private String exampleString;
- private URI exampleUri;
- public String getExampleString() {
- return exampleString;
- }
- public URI getExampleUri() {
- return exampleUri;
- }
- public void setExampleString(String exampleString) {
- this.exampleString = exampleString;
- }
- public void setExampleUri(URI exampleUri) {
- this.exampleUri = exampleUri;
- }
-
-
-}
[22/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
new file mode 100644
index 0000000..e5cec36
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
@@ -0,0 +1,82 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public class BeanshellTemplateService extends AbstractTemplateService {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/beanshell");
+
+ private static final String BEANSHELL = "Beanshell";
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/beanshell");
+
+ public String getName() {
+ return BEANSHELL;
+ }
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ configuration.getJsonAsObjectNode().put("script", "");
+ configuration.getJsonAsObjectNode().put("classLoaderSharing", "workflow");
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return BeanshellActivityIcon.getBeanshellIcon();
+ }
+
+ @Override
+ public String getDescription() {
+ return "A service that allows Beanshell scripts, with dependencies on libraries";
+ }
+
+ public static ServiceDescription getServiceDescription() {
+ BeanshellTemplateService bts = new BeanshellTemplateService();
+ return bts.templateService;
+ }
+
+ public String getId() {
+ return providerId.toString();
+ }
+
+ @Override
+ public ServiceDescriptionProvider newInstance() {
+ return new BeanshellTemplateService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java
new file mode 100644
index 0000000..f00d6af
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java
@@ -0,0 +1,83 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.views;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class BeanshellActivityViewFactory implements ContextualViewFactory<Activity> {
+
+ private static final URI ACTIVITY_TYPE = URI
+ .create("http://ns.taverna.org.uk/2010/activity/beanshell");
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ private ApplicationConfiguration applicationConfiguration;
+
+ public boolean canHandle(Object object) {
+ return object instanceof Activity && ((Activity) object).getType().equals(ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays.asList(new ContextualView[] { new BeanshellContextualView(activity,
+ editManager, fileManager, activityIconManager, colourManager,
+ serviceDescriptionRegistry, applicationConfiguration) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java
new file mode 100644
index 0000000..5edcbc6
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java
@@ -0,0 +1,230 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.views;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+import org.apache.taverna.lang.ui.EditorKeySetUtil;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityPortConfiguration;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.DependencyConfigurationPanel;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ListConfigurationComponent;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ScriptConfigurationComponent;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ValidatingTextField;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ValidatingTextGroup;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
+/**
+ * Component for configuring a Beanshell activity.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class BeanshellConfigurationPanel extends MultiPageActivityConfigurationPanel {
+
+ private ScriptConfigurationComponent scriptConfigurationComponent;
+ private ValidatingTextGroup inputTextGroup, outputTextGroup;
+ private DependencyConfigurationPanel dependencyConfigurationPanel;
+ private File libDir;
+
+ public BeanshellConfigurationPanel(Activity activity,
+ ApplicationConfiguration applicationConfiguration) {
+ super(activity);
+ libDir = new File(applicationConfiguration.getApplicationHomeDir(), "lib");
+ if (!libDir.exists()) {
+ libDir.mkdir();
+ }
+ initialise();
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+ removeAllPages();
+ addPage("Script", createScriptEditPanel());
+ addPage("Input ports", createInputPanel());
+ addPage("Output ports", createOutputPanel());
+ addPage("Dependencies", createDependenciesPanel());
+ setPreferredSize(new Dimension(600, 500));
+ }
+
+ @Override
+ public void noteConfiguration() {
+ setProperty("script", scriptConfigurationComponent.getScript());
+ setProperty("classLoaderSharing", dependencyConfigurationPanel.getClassLoaderSharing());
+ List<String> localDependencies = dependencyConfigurationPanel.getLocalDependencies();
+ if (localDependencies == null || localDependencies.isEmpty()) {
+ getJson().remove("localDependency");
+ } else {
+ ArrayNode localDependenciesArray = getJson().arrayNode();
+ for (String localDependency : localDependencies) {
+ localDependenciesArray.add(localDependency);
+ }
+ getJson().put("localDependency", localDependenciesArray);
+ }
+ }
+
+ @Override
+ public boolean checkValues() {
+ return true;
+ }
+
+ private Component createScriptEditPanel() {
+ Set<String> keywords = EditorKeySetUtil.loadKeySet(getClass().getResourceAsStream(
+ "keys.txt"));
+ Set<String> ports = new HashSet<>();
+ for (InputActivityPort ip : getActivity().getInputPorts()) {
+ ports.add(ip.getName());
+ }
+ for (OutputActivityPort op : getActivity().getOutputPorts()) {
+ ports.add(op.getName());
+ }
+ scriptConfigurationComponent = new ScriptConfigurationComponent(getProperty("script"),
+ keywords, ports, "Beanshell", ".bsh");
+ return scriptConfigurationComponent;
+ }
+
+ private Component createInputPanel() {
+ inputTextGroup = new ValidatingTextGroup();
+ ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>(
+ "Input Port", getInputPorts()) {
+ @Override
+ protected Component createItemComponent(ActivityPortConfiguration port) {
+ return new PortComponent(port, inputTextGroup);
+ }
+
+ @Override
+ protected ActivityPortConfiguration createDefaultItem() {
+ return new ActivityPortConfiguration("in", 0);
+ }
+ };
+ return inputPanel;
+ }
+
+ private Component createOutputPanel() {
+ outputTextGroup = new ValidatingTextGroup();
+ ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>(
+ "Output Port", getOutputPorts()) {
+ @Override
+ protected Component createItemComponent(ActivityPortConfiguration port) {
+ return new PortComponent(port, outputTextGroup);
+ }
+
+ @Override
+ protected ActivityPortConfiguration createDefaultItem() {
+ return new ActivityPortConfiguration("out", 0);
+ }
+ };
+ return inputPanel;
+ }
+
+ private Component createDependenciesPanel() {
+ String classLoaderSharing = getProperty("classLoaderSharing");
+ List<String> localDependencies = new ArrayList<>();
+ if (getJson().has("localDependency")) {
+ for (JsonNode localDependency : getJson().get("localDependency")) {
+ localDependencies.add(localDependency.textValue());
+ }
+ }
+ dependencyConfigurationPanel = new DependencyConfigurationPanel(classLoaderSharing,
+ localDependencies, libDir);
+ return dependencyConfigurationPanel;
+ }
+
+ class PortComponent extends JPanel {
+
+ private ValidatingTextField nameField;
+ private SpinnerNumberModel depthModel;
+ private final ValidatingTextGroup validatingTextGroup;
+
+ public PortComponent(final ActivityPortConfiguration portConfiguration,
+ ValidatingTextGroup validatingTextGroup) {
+ this.validatingTextGroup = validatingTextGroup;
+
+ nameField = new ValidatingTextField(portConfiguration.getName());
+ nameField.getDocument().addDocumentListener(new DocumentListener() {
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ portConfiguration.setName(nameField.getText());
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ portConfiguration.setName(nameField.getText());
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ portConfiguration.setName(nameField.getText());
+ }
+ });
+ validatingTextGroup.addValidTextComponent(nameField);
+ depthModel = new SpinnerNumberModel(portConfiguration.getDepth(), 0, 100, 1);
+ depthModel.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ portConfiguration.setDepth(depthModel.getNumber().intValue());
+ }
+ });
+
+ setLayout(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.WEST;
+ add(new JLabel("Name"), c);
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ add(nameField, c);
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ add(new JLabel("Depth"), c);
+ add(new JSpinner(depthModel), c);
+
+ }
+
+ public void removeNotify() {
+ validatingTextGroup.removeTextComponent(nameField);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java
new file mode 100644
index 0000000..cf276fa
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java
@@ -0,0 +1,103 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.views;
+
+import java.awt.Frame;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.beanshell.actions.BeanshellActivityConfigurationAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+/**
+ * A simple non editable HTML table view over a {@link BeanshellActivity}.
+ * Clicking on the configure button shows the editable {@link BeanshellConfigView}
+ *
+ * @author Ian Dunlop
+ * @author Stuart Owen
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class BeanshellContextualView extends HTMLBasedActivityContextualView {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private final ApplicationConfiguration applicationConfiguration;
+
+ public BeanshellContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry,
+ ApplicationConfiguration applicationConfiguration) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ this.applicationConfiguration = applicationConfiguration;
+ init();
+ }
+
+ private void init() {
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ StringBuilder html = new StringBuilder();
+ html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
+ for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
+ html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
+ html.append(inputActivityPort.getDepth() + "</td></tr>");
+ }
+ html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
+ for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
+ html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
+ html.append(outputActivityPort.getDepth() + "</td></tr>");
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Beanshell service";
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new BeanshellActivityConfigurationAction(getActivity(), owner, editManager,
+ fileManager, activityIconManager, serviceDescriptionRegistry, applicationConfiguration);
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index a77db8d..0000000
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index a3c71cd..0000000
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateAction
-net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateMenuAction
-net.sf.taverna.t2.activities.beanshell.menu.ConfigureBeanshellMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index a268bf1..0000000
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index dcdf598..0000000
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.beanshell.views.BeanshellActivityViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..ef61c0a
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..8cfb456
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateAction
+org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateMenuAction
+org.apache.taverna.activities.beanshell.menu.ConfigureBeanshellMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..27a2447
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..7cbd7c2
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.beanshell.views.BeanshellActivityViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml
index 58a3e18..30b0534 100644
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml
@@ -6,23 +6,23 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="BeanshellActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="BeanshellActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="BeanshellTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="BeanshellTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="AddBeanshellTemplateAction" auto-export="interfaces" />
<service ref="AddBeanshellTemplateMenuAction" auto-export="interfaces" />
<service ref="ConfigureBeanshellMenuAction" auto-export="interfaces" />
- <service ref="BeanshellActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="BeanshellActivityViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml
index fc6d5d4..620456e 100644
--- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml
+++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml
@@ -3,11 +3,11 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="BeanshellActivityIcon" class="net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellActivityIcon" />
+ <bean id="BeanshellActivityIcon" class="org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellActivityIcon" />
- <bean id="BeanshellTemplateService" class="net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService" />
+ <bean id="BeanshellTemplateService" class="org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService" />
- <bean id="AddBeanshellTemplateAction" class="net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateAction">
+ <bean id="AddBeanshellTemplateAction" class="org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -15,7 +15,7 @@
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
- <bean id="AddBeanshellTemplateMenuAction" class="net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateMenuAction">
+ <bean id="AddBeanshellTemplateMenuAction" class="org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -23,7 +23,7 @@
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
- <bean id="ConfigureBeanshellMenuAction" class="net.sf.taverna.t2.activities.beanshell.menu.ConfigureBeanshellMenuAction">
+ <bean id="ConfigureBeanshellMenuAction" class="org.apache.taverna.activities.beanshell.menu.ConfigureBeanshellMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -31,7 +31,7 @@
<property name="applicationConfiguration" ref="applicationConfiguration" />
</bean>
- <bean id="BeanshellActivityViewFactory" class="net.sf.taverna.t2.activities.beanshell.views.BeanshellActivityViewFactory">
+ <bean id="BeanshellActivityViewFactory" class="org.apache.taverna.activities.beanshell.views.BeanshellActivityViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt b/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt
deleted file mode 100644
index 15cb51b..0000000
--- a/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-++
---
-+
--
-~
-!
-*
-/
-%
-<<
->>
->>>
-<
->
-<=
->=
-==
-!=
-&
-^
-|
-&&
-||
-:
-=
-+=
--=
-*=
-/=
-%=
-&=
-^=
-|=
-<<=
->>=
->>>=
-=
-abstract
-assert
-boolean
-break
-byte
-case
-catch
-char
-class
-const
-continue
-default
-do
-double
-else
-enum
-extends
-false
-final
-finally
-float
-for
-goto
-if
-implements
-import
-instanceof
-int
-interface
-long
-native
-new
-null
-package
-private
-protected
-public
-return
-short
-static
-strictfp
-super
-switch
-synchronized
-this
-throw
-throws
-transient
-true
-try
-void
-volatile
-while
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt b/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt
new file mode 100644
index 0000000..15cb51b
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt
@@ -0,0 +1,90 @@
+++
+--
++
+-
+~
+!
+*
+/
+%
+<<
+>>
+>>>
+<
+>
+<=
+>=
+==
+!=
+&
+^
+|
+&&
+||
+:
+=
++=
+-=
+*=
+/=
+%=
+&=
+^=
+|=
+<<=
+>>=
+>>>=
+=
+abstract
+assert
+boolean
+break
+byte
+case
+catch
+char
+class
+const
+continue
+default
+do
+double
+else
+enum
+extends
+false
+final
+finally
+float
+for
+goto
+if
+implements
+import
+instanceof
+int
+interface
+long
+native
+new
+null
+package
+private
+protected
+public
+return
+short
+static
+strictfp
+super
+switch
+synchronized
+this
+throw
+throws
+transient
+true
+try
+void
+volatile
+while
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/pom.xml b/taverna-external-tool-activity-ui/pom.xml
index 80170e5..039a80b 100644
--- a/taverna-external-tool-activity-ui/pom.xml
+++ b/taverna-external-tool-activity-ui/pom.xml
@@ -67,6 +67,24 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-activity-tools</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.help</groupId>
+ <artifactId>javahelp</artifactId>
+ <version>2.0.02</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>renderers-impl</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
</dependencies>
<repositories>
<repository>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
deleted file mode 100644
index 3e45fa2..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- * modified 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
- *
- * 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.externaltool.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.Action;
-
-import org.apache.taverna.activities.externaltool.ExternalToolActivity;
-import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.views.ExternalToolConfigView;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-
-/**
- * This class implements an ActivityConfigurationAction to configure the ExternalToolActivity
- * plugin. The configuration action is called "Configure UseCase invocation" and is implemented in
- * the KnowARCConfigurationDialog inside the knowarc-usecases maven artifact.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-@SuppressWarnings("serial")
-public class ExternalToolActivityConfigureAction extends
- ActivityConfigurationAction {// <ExternalToolActivity, ExternalToolActivityConfigurationBean> {
-
- private final Frame owner;
- private final EditManager editManager;
- private final FileManager fileManager;
-
- public ExternalToolActivityConfigureAction(ExternalToolActivity activity, Frame owner,
- EditManager editManager, FileManager fileManager, ActivityIconManager activityIconManager) {
- super(activity, activityIconManager);
- this.editManager = editManager;
- this.fileManager = fileManager;
- putValue(Action.NAME, "Configure tool invocation");
- this.owner = owner;
- }
-
- public void actionPerformed(ActionEvent e) {
- /*
- * if (getActivity().getConfiguration() instanceof
- * RegisteredExternalToolActivityConfigurationBean) { new KnowARCConfigurationDialog(owner,
- * false, KnowARCConfigurationFactory.getConfiguration()).setVisible(true); } else
- */{
- ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
- .getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
- final ExternalToolConfigView externalToolConfigView = new ExternalToolConfigView(
- (ExternalToolActivity) getActivity());
- final ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean> dialog = new ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean>(
- getActivity(), externalToolConfigView, editManager, fileManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
deleted file mode 100644
index 0877045..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.configuration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-
-
-/**
- * @author alanrw
- *
- */
-public class ToolInvocationConfiguration extends AbstractConfigurable {
-
- private static ToolInvocationConfiguration instance;
-
- private Map<String, String> defaultPropertyMap;
-
- public static ToolInvocationConfiguration getInstance() {
- if (instance == null) {
- instance = new ToolInvocationConfiguration();
- }
- return instance;
- }
-
- @Override
- public String getCategory() {
- return "general";
- }
-
- @Override
- public Map<String, String> getDefaultPropertyMap() {
- if (defaultPropertyMap == null) {
- defaultPropertyMap = new HashMap<String, String>();
- }
- return defaultPropertyMap;
- }
-
- @Override
- public String getDisplayName() {
- return "Tool invocation";
- }
-
- @Override
- public String getFilePrefix() {
- return "ToolInvocation";
- }
-
- @Override
- public String getUUID() {
- return "B611F5C2-EB49-479E-B01A-7F3F56E6918A";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
deleted file mode 100644
index 8f62787..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
+++ /dev/null
@@ -1,113 +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.externaltool.manager;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-
-/**
- * UI for creating/editing dataflow input ports.
- *
- * @author David Withers
- */
-public class GroupPanel extends JPanel {
-
- private static final long serialVersionUID = 1L;
-
- private JTextField groupNameField;
-
- private JComboBox mechanismComboBox;
-
- private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
-
- public GroupPanel(Object[] mechanisms) {
- super(new GridBagLayout());
-
- groupNameField = new JTextField();
-
-
- setBorder(new EmptyBorder(10, 10, 10, 10));
-
- GridBagConstraints constraints = new GridBagConstraints();
-
- constraints.anchor = GridBagConstraints.WEST;
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.ipadx = 10;
- add(new JLabel("Name:"), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- add(groupNameField, constraints);
-
- constraints.gridx = 0;
- constraints.gridy = 1;
- constraints.gridwidth = 1;
- constraints.weightx = 0d;
- constraints.fill = GridBagConstraints.NONE;
- constraints.ipadx = 10;
- constraints.insets = new Insets(10, 0, 0, 0);
- add(new JLabel("Explicit location:"), constraints);
-
- mechanismComboBox = new JComboBox(mechanisms);
- mechanismComboBox.setSelectedItem(manager.getDefaultMechanism());
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- add(mechanismComboBox, constraints);
- }
-
- /**
- * Returns the portNameField.
- *
- * @return the portNameField
- */
- public JTextField getGroupNameField() {
- return groupNameField;
- }
-
- /**
- * Returns the group name.
- *
- * @return the group name
- */
- public String getGroupName() {
- return groupNameField.getText();
- }
-
- public InvocationMechanism getSelectedMechanism() {
- return (InvocationMechanism) mechanismComboBox.getSelectedItem();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
deleted file mode 100644
index 3d54b26..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager;
-
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import net.sf.taverna.t2.workbench.ShutdownSPI;
-
-/**
- * @author alanrw
- *
- */
-public class InvocationGroupManagerShutdownHook implements ShutdownSPI {
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workbench.ShutdownSPI#positionHint()
- */
- @Override
- public int positionHint() {
- return 710;
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workbench.ShutdownSPI#shutdown()
- */
- @Override
- public boolean shutdown() {
- InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
- manager.saveConfiguration();
- manager.persistInvocations();
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
deleted file mode 100644
index 43cf4df..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 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.externaltool.manager;
-
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import net.sf.taverna.t2.workbench.StartupSPI;
-
-/**
- * Load previously saved workflow ids that were scheduled to be deleted before
- * previous Taverna shutdown, and initiate deletion of them now.
- *
- * @see StoreRunIdsToDeleteLaterShutdownHook
- * @see DatabaseCleanup
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class InvocationGroupManagerStartupHook implements StartupSPI {
-
- public int positionHint() {
- return 900;
- }
-
- public boolean startup() {
- InvocationGroupManagerImpl.getInstance().loadInvocations();
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
deleted file mode 100644
index 495d22b..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager;
-
-import javax.swing.JPanel;
-
-/**
- * @author alanrw
- *
- */
-public abstract class InvocationMechanismEditor<T extends InvocationMechanism> extends JPanel {
-
- public abstract String getName();
-
- public abstract boolean canShow(Class<?> c);
-
- public abstract void show(T invocationMechanism);
-
- public abstract T updateInvocationMechanism();
-
- public abstract InvocationMechanism createMechanism(String mechanismName);
-
- public boolean isSingleton() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java
deleted file mode 100644
index c068d56..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.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.externaltool.manager;
-
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.util.List;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-/**
- * UI for creating/editing dataflow input ports.
- *
- * @author David Withers
- */
-public class MechanismPanel extends JPanel {
-
- private static final long serialVersionUID = 1L;
-
- private JTextField mechanismNameField;
-
- private JComboBox mechanismTypeSelector;
-
- public MechanismPanel(List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
- super(new GridBagLayout());
-
- mechanismNameField = new JTextField();
-
-
- setBorder(new EmptyBorder(10, 10, 10, 10));
-
- GridBagConstraints constraints = new GridBagConstraints();
-
- constraints.anchor = GridBagConstraints.WEST;
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.ipadx = 10;
- add(new JLabel("Name:"), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- add(mechanismNameField, constraints);
-
- constraints.gridx = 0;
- constraints.gridy = 1;
- constraints.gridwidth = 1;
- constraints.weightx = 0d;
- constraints.fill = GridBagConstraints.NONE;
- constraints.ipadx = 10;
- constraints.insets = new Insets(10, 0, 0, 0);
- add(new JLabel("Type:"), constraints);
-
- mechanismTypeSelector = new JComboBox();
- for (InvocationMechanismEditor<?> ime : invocationMechanismEditors) {
- if (!ime.isSingleton()) {
- mechanismTypeSelector.addItem(ime.getName());
- }
- }
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- add(mechanismTypeSelector, constraints);
-
-
- }
-
- /**
- * Returns the portNameField.
- *
- * @return the portNameField
- */
- public JTextField getMechanismNameField() {
- return mechanismNameField;
- }
-
- /**
- * Returns the port name.
- *
- * @return the port name
- */
- public String getMechanismName() {
- return mechanismNameField.getText();
- }
-
- public String getMechanismTypeName() {
- return (String) mechanismTypeSelector.getSelectedItem();
- }
-
- public Component getMechanismTypeSelector() {
- return mechanismTypeSelector;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
deleted file mode 100644
index 5b3c783..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.helper.Helper;
-
-/**
- * @author alanrw
- *
- */
-public class ToolInvocationConfigurationPanel extends JPanel implements
- Observer<InvocationManagerEvent> {
-
- public static final String HEADER_TEXT = "A tool can be set to run at an explicit location (e.g. on a specificic machine or one of a set of machines). Alternatively, it can be set to run at a symbolic location, which means the tool will then be run at the explicit location pointed to by the symbolic location.";
-
- private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance();
-
- private final List<InvocationMechanismEditor<?>> invocationMechanismEditors;
-
- private JTextArea headerText;
-
- private static String EXPLICIT_LOCATIONS = "explicit locations";
- private static String SYMBOLIC_LOCATIONS = "symbolic locations";
-
- private List<MechanismCreator> mechanismCreators;
-
- JList locationList = new JList();
-
- DefaultListModel groupListModel = new DefaultListModel();
- DefaultListModel mechanismListModel = new DefaultListModel();
- JComboBox locationTypeCombo = new JComboBox(new String[] { EXPLICIT_LOCATIONS,
- SYMBOLIC_LOCATIONS });
-
- public ToolInvocationConfigurationPanel(List<MechanismCreator> mechanismCreators,
- List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
- super();
- this.mechanismCreators = mechanismCreators;
- this.invocationMechanismEditors = invocationMechanismEditors;
- manager.addObserver(this);
-
- this.setLayout(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- headerText = new JTextArea(HEADER_TEXT);
- headerText.setLineWrap(true);
- headerText.setWrapStyleWord(true);
- headerText.setEditable(false);
- headerText.setFocusable(false);
- headerText.setBorder(new EmptyBorder(10, 10, 10, 10));
-
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(0, 0, 10, 0);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.gridwidth = 1;
- gbc.weightx = 1.0;
- gbc.weighty = 0.0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- add(headerText, gbc);
-
- JPanel locationPanel = new JPanel(new BorderLayout());
- JPanel subPanel = new JPanel(new FlowLayout());
- JLabel modify = new JLabel("Modify:");
-
- locationTypeCombo.setSelectedItem(EXPLICIT_LOCATIONS);
- locationTypeCombo.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- switchList();
- }
- });
- subPanel.add(modify);
- subPanel.add(locationTypeCombo);
-
- populateLists();
- switchList();
- locationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- locationList.setCellRenderer(new DefaultListCellRenderer() {
- public Component getListCellRendererComponent(JList list, Object value, int index,
- boolean isSelected, boolean cellHasFocus) {
- Object toShow = value;
- if (value instanceof InvocationGroup) {
- InvocationGroup invocationGroup = (InvocationGroup) value;
- toShow = invocationGroup.getName() + " --> "
- + invocationGroup.getMechanismName();
- }
- return super.getListCellRendererComponent(list, toShow, index, isSelected,
- cellHasFocus);
- }
- });
- locationPanel.add(new JScrollPane(locationList), BorderLayout.CENTER);
- locationPanel.add(subPanel, BorderLayout.NORTH);
-
- JPanel buttonPanel = new JPanel(new FlowLayout());
- JButton helpButton = new DeselectingButton("Help", new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
- Helper.showHelp(ToolInvocationConfigurationPanel.this);
- }
- });
-
- buttonPanel.add(helpButton);
-
- buttonPanel.add(addLocationButton());
- buttonPanel.add(removeLocationButton());
- buttonPanel.add(editLocationButton());
- locationPanel.add(buttonPanel, BorderLayout.SOUTH);
-
- gbc.gridy++;
- gbc.weighty = 1;
-
- gbc.fill = GridBagConstraints.BOTH;
- gbc.anchor = GridBagConstraints.SOUTH;
- gbc.insets = new Insets(10, 0, 0, 0);
- this.add(locationPanel, gbc);
- }
-
- private void switchList() {
- if (isShowingGroups()) {
- locationList.setModel(groupListModel);
- } else {
- locationList.setModel(mechanismListModel);
- }
- }
-
- private void populateLists() {
- poopulateGroupList();
- populateMechanismList();
- }
-
- private void populateMechanismList() {
- Object currentSelection = locationList.getSelectedValue();
- ArrayList<InvocationMechanism> mechanisms = new ArrayList<InvocationMechanism>();
- mechanisms.addAll(manager.getMechanisms());
- Collections.sort(mechanisms, new Comparator<InvocationMechanism>() {
-
- @Override
- public int compare(InvocationMechanism o1, InvocationMechanism o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- mechanismListModel.clear();
- for (InvocationMechanism m : mechanisms) {
- mechanismListModel.addElement(m);
- }
- if ((currentSelection != null) && !isShowingGroups()) {
- locationList.setSelectedValue(currentSelection, true);
- }
- }
-
- private void poopulateGroupList() {
- Object currentSelection = locationList.getSelectedValue();
- ArrayList<InvocationGroup> groups = new ArrayList<InvocationGroup>();
- groups.addAll(manager.getInvocationGroups());
- Collections.sort(groups, new Comparator<InvocationGroup>() {
-
- @Override
- public int compare(InvocationGroup o1, InvocationGroup o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- groupListModel.clear();
- for (InvocationGroup g : groups) {
- groupListModel.addElement(g);
- }
- if ((currentSelection != null) && isShowingGroups()) {
- locationList.setSelectedValue(currentSelection, true);
- }
- }
-
- private boolean isShowingGroups() {
- return (locationTypeCombo.getSelectedItem().equals(SYMBOLIC_LOCATIONS));
- }
-
- private JButton addLocationButton() {
- final JButton result = new DeselectingButton("Add", new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (isShowingGroups()) {
- Set<String> usedGroupNames = new HashSet<String>();
- for (InvocationGroup g : manager.getInvocationGroups()) {
- usedGroupNames.add(g.getName());
- }
-
- GroupPanel inputPanel = new GroupPanel(mechanismListModel.toArray());
-
- ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
- "Add symbolic location", inputPanel);
- vuid.addTextComponentValidation(inputPanel.getGroupNameField(),
- "Set the symbolic location name.", usedGroupNames,
- "Duplicate symbolic location name.", "[\\p{L}\\p{Digit}_.]+",
- "Invalid symbolic location name.");
- vuid.setSize(new Dimension(400, 250));
-
- if (vuid.show(ToolInvocationConfigurationPanel.this)) {
- String groupName = inputPanel.getGroupName();
- InvocationGroup newGroup = new InvocationGroup(mechanismCreators);
- newGroup.setName(groupName);
- newGroup.setMechanism(inputPanel.getSelectedMechanism());
- manager.addInvocationGroup(newGroup);
- locationList.setSelectedValue(newGroup, true);
- }
- } else {
- Set<String> usedNames = new HashSet<String>();
- for (InvocationMechanism m : manager.getMechanisms()) {
- usedNames.add(m.getName());
- }
-
- MechanismPanel inputPanel = new MechanismPanel(invocationMechanismEditors);
-
- ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
- "Add explicit location", inputPanel);
- vuid.addTextComponentValidation(inputPanel.getMechanismNameField(),
- "Set the explicit location name.", usedNames,
- "Duplicate explicit location name.", "[\\p{L}\\p{Digit}_.]+",
- "Invalid explicit location name.");
- vuid.addMessageComponent(inputPanel.getMechanismTypeSelector(),
- "Set the location name and type.");
- vuid.setSize(new Dimension(400, 250));
-
- if (vuid.show(ToolInvocationConfigurationPanel.this)) {
- String mechanismName = inputPanel.getMechanismName();
- String mechanismTypeName = inputPanel.getMechanismTypeName();
- InvocationMechanismEditor ime = findEditor(mechanismTypeName);
- InvocationMechanism newMechanism = ime.createMechanism(mechanismName);
- manager.addMechanism(newMechanism);
- ime.show(newMechanism);
- ime.setPreferredSize(new Dimension(550, 500));
- int answer = JOptionPane.showConfirmDialog(
- ToolInvocationConfigurationPanel.this, ime,
- "New explicit location", JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.PLAIN_MESSAGE, null);
- if (answer == JOptionPane.OK_OPTION) {
- ime.updateInvocationMechanism();
- InvocationGroupManagerImpl.getInstance().mechanismChanged(newMechanism);
- }
- locationList.setSelectedValue(newMechanism, true);
- }
- }
- }
- });
- return result;
- }
-
- private JButton removeLocationButton() {
- JButton result = new DeselectingButton("Remove", new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (isShowingGroups()) {
- InvocationGroup toRemove = (InvocationGroup) locationList.getSelectedValue();
- if ((toRemove != null) && !toRemove.equals(manager.getDefaultGroup())) {
- manager.removeInvocationGroup(toRemove);
- }
- locationList.setSelectedValue(manager.getDefaultGroup(), true);
- } else {
- InvocationMechanism toRemove = (InvocationMechanism) locationList
- .getSelectedValue();
- if ((toRemove != null) && !toRemove.equals(manager.getDefaultMechanism())) {
- manager.removeMechanism(toRemove);
- locationList.setSelectedValue(manager.getDefaultMechanism(), true);
- }
- }
- }
- });
- return result;
- }
-
- private JButton editLocationButton() {
- final JButton result = new DeselectingButton("Edit", new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (isShowingGroups()) {
- InvocationGroup toEdit = (InvocationGroup) locationList.getSelectedValue();
- if (toEdit != null) {
- InvocationMechanism chosenMechanism = (InvocationMechanism) JOptionPane
- .showInputDialog(ToolInvocationConfigurationPanel.this,
- "Select an explicit location", "Edit symbolic location",
- JOptionPane.PLAIN_MESSAGE, null,
- mechanismListModel.toArray(), toEdit.getMechanism());
- if (chosenMechanism != null) {
- toEdit.setMechanism(chosenMechanism);
- manager.groupChanged(toEdit);
- }
- }
- } else {
- InvocationMechanism toEdit = (InvocationMechanism) locationList
- .getSelectedValue();
- if (toEdit != null) {
- InvocationMechanismEditor ime = findEditor(toEdit.getClass());
- ime.show(toEdit);
- ime.setPreferredSize(new Dimension(550, 500));
- int answer = JOptionPane.showConfirmDialog(
- ToolInvocationConfigurationPanel.this, ime,
- "Edit explicit location", JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.PLAIN_MESSAGE, null);
- if (answer == JOptionPane.OK_OPTION) {
- ime.updateInvocationMechanism();
- InvocationGroupManagerImpl.getInstance().mechanismChanged(toEdit);
- }
- }
- }
- }
- });
- return result;
- }
-
- protected InvocationMechanismEditor findEditor(String name) {
- for (InvocationMechanismEditor ime : invocationMechanismEditors) {
- if (ime.getName().equalsIgnoreCase(name)) {
- return ime;
- }
- }
- return null;
- }
-
- protected InvocationMechanismEditor findEditor(Class c) {
- for (InvocationMechanismEditor ime : invocationMechanismEditors) {
- if (ime.canShow(c)) {
- return ime;
- }
- }
- return null;
- }
-
- @Override
- public void notify(Observable<InvocationManagerEvent> arg0, InvocationManagerEvent arg1)
- throws Exception {
- if (SwingUtilities.isEventDispatchThread()) {
- populateLists();
- } else {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- populateLists();
- }
- });
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
deleted file mode 100644
index 82dd443..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager;
-
-import java.util.List;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-import net.sf.taverna.t2.activities.externaltool.configuration.ToolInvocationConfiguration;
-
-/**
- * @author alanrw
- *
- */
-public class ToolInvocationConfigurationUIFactory implements ConfigurationUIFactory {
-
- private List<MechanismCreator> mechanismCreators;
- private List<InvocationMechanismEditor<?>> invocationMechanismEditors;
-
- private ToolInvocationConfigurationPanel configPanel;
-
- @Override
- public boolean canHandle(String uuid) {
- return uuid.equals(getConfigurable().getUUID());
- }
-
- @Override
- public Configurable getConfigurable() {
- return ToolInvocationConfiguration.getInstance();
- }
-
- @Override
- public JPanel getConfigurationPanel() {
- if (configPanel == null) {
- configPanel = new ToolInvocationConfigurationPanel(mechanismCreators,
- invocationMechanismEditors);
- }
- return configPanel;
- }
-
- public void setMechanismCreators(List<MechanismCreator> mechanismCreators) {
- this.mechanismCreators = mechanismCreators;
- }
-
- public void setInvocationMechanismEditors(
- List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
- this.invocationMechanismEditors = invocationMechanismEditors;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
deleted file mode 100644
index 64fcc36..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager.local;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import net.sf.taverna.t2.activities.externaltool.local.ExternalToolLocalInvocationMechanism;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor;
-
-/**
- * @author alanrw
- *
- */
-public final class LocalInvocationMechanismEditor extends
- InvocationMechanismEditor<ExternalToolLocalInvocationMechanism> {
-
- private ExternalToolLocalInvocationMechanism invocationMechanism;
-
- private JTextField directoryField = new JTextField(30);
-
- private JTextField shellPrefixField = new JTextField(30);
-
- private JTextField linkCommandField = new JTextField(30);
-
- private JCheckBox retrieveDataField = new JCheckBox();
-
-
- @Override
- public boolean canShow(Class<?> c) {
- return ExternalToolLocalInvocationMechanism.class.isAssignableFrom(c);
- }
-
- @Override
- public String getName() {
- return ("Local");
- }
-
- @Override
- public void show(ExternalToolLocalInvocationMechanism invocationMechanism) {
- this.invocationMechanism = invocationMechanism;
- this.removeAll();
- final JPanel innerPanel = new JPanel(new GridBagLayout());
- final GridBagConstraints inputConstraint = new GridBagConstraints();
-// inputConstraint.insets = new Insets(5,5,5,5);
- inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- inputConstraint.gridx = 0;
- inputConstraint.gridy = 0;
- inputConstraint.weightx = 0.1;
- inputConstraint.fill = GridBagConstraints.BOTH;
- innerPanel.add(new JLabel("Working directory: "), inputConstraint);
- inputConstraint.gridx++;
- directoryField.setText(invocationMechanism.getDirectory());
- innerPanel.add(directoryField, inputConstraint);
- inputConstraint.gridx = 0;
- inputConstraint.gridy++;
- innerPanel.add(new JLabel("Shell: "), inputConstraint);
- inputConstraint.gridx++;
- shellPrefixField.setText(invocationMechanism.getShellPrefix());
- innerPanel.add(shellPrefixField, inputConstraint);
-
- inputConstraint.gridx = 0;
- inputConstraint.gridy++;
- innerPanel.add(new JLabel("Link command: "), inputConstraint);
- inputConstraint.gridx++;
- linkCommandField.setText(invocationMechanism.getLinkCommand());
- innerPanel.add(linkCommandField, inputConstraint);
-
- inputConstraint.gridx = 0;
- inputConstraint.gridy++;
- innerPanel.add(new JLabel("Fetch data: "), inputConstraint);
- inputConstraint.gridx++;
- retrieveDataField.setSelected(invocationMechanism.isRetrieveData());
- innerPanel.add(retrieveDataField, inputConstraint);
-
- this.add(innerPanel);
- }
-
- @Override
- public ExternalToolLocalInvocationMechanism updateInvocationMechanism() {
- if ((directoryField.getText() == null) || (directoryField.getText().length() == 0)) {
- invocationMechanism.setDirectory(null);
- } else {
- invocationMechanism.setDirectory(directoryField.getText());
- }
- if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) {
- invocationMechanism.setShellPrefix(null);
- } else {
- invocationMechanism.setShellPrefix(shellPrefixField.getText());
- }
- if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) {
- invocationMechanism.setShellPrefix(null);
- } else {
- invocationMechanism.setShellPrefix(shellPrefixField.getText());
- }
- if ((linkCommandField.getText() == null) || (linkCommandField.getText().length() == 0)) {
- invocationMechanism.setLinkCommand(null);
- } else {
- invocationMechanism.setLinkCommand(linkCommandField.getText());
- }
- invocationMechanism.setRetrieveData(retrieveDataField.isSelected());
- return invocationMechanism;
- }
-
- @Override
- public InvocationMechanism createMechanism(String mechanismName) {
- ExternalToolLocalInvocationMechanism result = new ExternalToolLocalInvocationMechanism();
- result.setName(mechanismName);
- return(result);
- }
-
- public boolean isSingleton() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
deleted file mode 100644
index fb837c5..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager.ssh;
-
-import javax.swing.JCheckBox;
-import javax.swing.JTextField;
-
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
-
-import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode;
-
-
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolSshNodeViewer {
-
- private JTextField hostnameField;
- private JTextField portField;
- private JTextField directoryField;
- private JTextField linkCommandField;
- private JTextField copyCommandField;
- private JCheckBox retrieveDataField;
-
- public ExternalToolSshNodeViewer(SshNode node) {
- this();
- hostnameField.setText(node.getHost());
- portField.setText(Integer.toString(node.getPort()));
- if (node.getDirectory() != null) {
- directoryField.setText(node.getDirectory());
- } else {
- directoryField.setText("");
- }
- if (node.getLinkCommand() != null) {
- linkCommandField.setText(node.getLinkCommand());
- } else {
- linkCommandField.setText("");
- }
- if (node.getCopyCommand() != null) {
- copyCommandField.setText(node.getCopyCommand());
- } else {
- copyCommandField.setText("");
- }
- retrieveDataField.setSelected(node.isRetrieveData());
- }
-
- public ExternalToolSshNodeViewer() {
- hostnameField = new JTextField(30);
- hostnameField.setText(SshNode.DEFAULT_HOST);
- portField = new JTextField(3);
- portField.setText("" + SshNode.DEFAULT_PORT);
- directoryField = new JTextField(30);
- directoryField.setText(SshNode.DEFAULT_DIRECTORY);
- linkCommandField = new JTextField(30);
- linkCommandField.setText(InvocationMechanism.UNIX_LINK);
- copyCommandField = new JTextField(30);
- copyCommandField.setText(InvocationMechanism.UNIX_COPY);
- retrieveDataField = new JCheckBox();
- }
-
- public JTextField getHostnameField() {
- return hostnameField;
- }
-
- public JTextField getPortField() {
- return portField;
- }
-
- public JTextField getDirectoryField() {
- return directoryField;
- }
-
- public JTextField getLinkCommandField() {
- return linkCommandField;
- }
-
- public JTextField getCopyCommandField() {
- return copyCommandField;
- }
-
- public String getHostname() {
- return hostnameField.getText();
- }
-
- public int getPort() {
- return Integer.parseInt(portField.getText());
- }
-
- public String getDirectory() {
- return directoryField.getText();
- }
-
- public String getLinkCommand() {
- return linkCommandField.getText();
- }
-
- public String getCopyCommand() {
- return copyCommandField.getText();
- }
-
- /**
- * @return the retrieveDataField
- */
- public JCheckBox getRetrieveDataField() {
- return retrieveDataField;
- }
-}
[20/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolConfigView.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolConfigView.java
deleted file mode 100644
index 4723a78..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolConfigView.java
+++ /dev/null
@@ -1,868 +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.externaltool.views;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.help.CSH;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JEditorPane;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.JTextPane;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityHealthChecker;
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.KeywordDocument;
-import net.sf.taverna.t2.lang.ui.LinePainter;
-import net.sf.taverna.t2.lang.ui.NoWrapEditorKit;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-
-import org.apache.log4j.Logger;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-/**
- * Provides the configurable view for a {@link ExternalToolActivity} through
- * it's {@link ExternalToolActivityConfigurationBean}. Has 3 main tabs - Script,
- * Ports & Dependencies. The {@link #inputViewList} contains the
- * {@link ExternalToolInputViewer}s describing the input ports and
- * {@link #outputViewList} has the {@link ExternalToolFileViewer}s
- *
- * @author Ian Dunlop
- * @author Alex Nenadic
- * @author Alan R Williams
- *
- */
-@SuppressWarnings("serial")
-public class ExternalToolConfigView
- extends
- ActivityConfigurationPanel<ExternalToolActivity, ExternalToolActivityConfigurationBean> {
-
- private static final Color LINE_COLOR = new Color(225,225,225);
-
- private static final String FILE_INPUT_DESCRIPTION = "You can use a file input to feed data into " +
- "the service via an input port and have that data written to the specified file.";
-
- private static final String FILE_OUTPUT_DESCRIPTION = "You can use a file output to take the " +
- "content of a file produced by the tool and send it to an output port of the service.";
-
- private static final String FILE_LIST_DESCRIPTION = "If you feed a list of data into a file list " +
- "input, then each data item is written to a temporary file. A file is produced containing " +
- "the names of those temporary file. That index file can then be used as part of the tool " +
- "command.";
-
- private static final String VALID_NAME_REGEX = "[\\p{L}\\p{Digit}_]+";
-
- private static Logger logger = Logger
- .getLogger(ExternalToolConfigView.class);
-
- /** The activity which this view describes */
- protected ExternalToolActivity activity;
-
- /** The configuration bean used to configure the activity */
- private ExternalToolActivityConfigurationBean configuration;
-
- private JTabbedPane tabbedPane = null;
- private JPanel advancedPanel = null;
- private JTabbedPane advancedTab = null;
- private AnnotationPanel annotationPanel = null;
-
- private int stringReplacementGridy = 1;
- private List<ExternalToolStringReplacementViewer> stringReplacementViewList = new ArrayList<ExternalToolStringReplacementViewer>();
-
- private List<ExternalToolFileViewer> inputFileViewList = new ArrayList<ExternalToolFileViewer>();
-
- private List<ExternalToolFileViewer> fileListViewList = new ArrayList<ExternalToolFileViewer>();
-
- private int inputGridy = 1;
-
- private int outputGridy = 1;
- private List<ExternalToolFileViewer> outputViewList = new ArrayList<ExternalToolFileViewer>();
-
- private int staticGridy = 1;
- private List<ExternalToolStaticUrlViewer> staticUrlViewList = new ArrayList<ExternalToolStaticUrlViewer>();
-
- private List<ExternalToolStaticStringViewer> staticStringViewList = new ArrayList<ExternalToolStaticStringViewer>();
-
-/* private List<ExternalToolRuntimeEnvironmentViewer> runtimeEnvironmentViewList = new ArrayList<ExternalToolRuntimeEnvironmentViewer>();
-*/
-
- private JTextField nameField = new JTextField(20);
- private JTextField groupField = new JTextField(20);
- private JTextArea descriptionArea = new JTextArea(6, 40);
-
- private JEditorPane scriptTextArea;
-
- private InvocationPanel invocationPanel;
-
- private JCheckBox stdInCheckBox = new JCheckBox("Show STDIN");
- private JCheckBox stdOutCheckBox = new JCheckBox("Show STDOUT");
- private JCheckBox stdErrCheckBox = new JCheckBox("Show STDERR");
-
- private JTextField returnCodesField = new JTextField(20);
-
- /**
- * Stores the {@link ExternalToolActivity}, gets its
- * {@link ExternalToolActivityConfigurationBean}, sets the layout and calls
- * {@link #initialise()} to get the view going
- *
- * @param activity
- * the {@link ExternalToolActivity} that the view is over
- */
- public ExternalToolConfigView(ExternalToolActivity activity) {
- this.activity = activity;
- ExternalToolActivityHealthChecker.updateLocation(activity.getConfiguration());
- configuration = (ExternalToolActivityConfigurationBean) cloneBean(activity
- .getConfiguration());
- setLayout(new GridBagLayout());
- initialise(configuration);
- }
-
- public void noteConfiguration() {
- configuration = makeConfiguration();
- }
-
- public ExternalToolActivityConfigurationBean makeConfiguration() {
- ExternalToolActivityConfigurationBean newConfiguration = (ExternalToolActivityConfigurationBean) cloneBean(configuration);
- ExternalToolActivityHealthChecker.updateLocation(newConfiguration);
-
-
- if (!isFromRepository()) {
- UseCaseDescription ucd = newConfiguration.getUseCaseDescription();
-
- ucd.setUsecaseid(nameField.getText());
- if (groupField.getText().isEmpty()) {
- ucd.setGroup(null);
- } else {
- ucd.setGroup(groupField.getText());
- }
- ucd.setDescription(descriptionArea.getText());
- ucd.setCommand(scriptTextArea.getText());
- ucd.setReturnCodesAsText(returnCodesField.getText());
- ucd.setIncludeStdIn(stdInCheckBox.isSelected());
- ucd.setIncludeStdOut(stdOutCheckBox.isSelected());
- ucd.setIncludeStdErr(stdErrCheckBox.isSelected());
-
- ucd.getInputs().clear();
- ucd.getTags().clear();
- synchronized (fileListViewList) {
- for (ExternalToolFileViewer viewer : fileListViewList) {
- ScriptInputUser si = new ScriptInputUser();
- si.setBinary(viewer.isBinary());
- si.setList(true);
- si.setTag(viewer.getValue());
- si.setTempFile(false);
- si.setFile(true);
- ucd.getInputs().put(viewer.getName(), si);
- }
- }
-
- synchronized (stringReplacementViewList) {
- for (ExternalToolStringReplacementViewer viewer : stringReplacementViewList) {
- ScriptInputUser si = new ScriptInputUser();
- si.setBinary(false);
- si.setList(false);
- si.setTag(viewer.getValue());
- si.setTempFile(false);
- si.setFile(false);
- ucd.getTags().add(si.getTag());
- ucd.getInputs().put(viewer.getName(), si);
- }
- }
-
- synchronized (inputFileViewList) {
- for (ExternalToolFileViewer viewer : inputFileViewList) {
- ScriptInputUser si = new ScriptInputUser();
- si.setBinary(viewer.isBinary());
- si.setList(false);
- si.setTag(viewer.getValue());
- si.setTempFile(false);
- si.setFile(true);
- ucd.getInputs().put(viewer.getName(), si);
- }
- }
-
- synchronized (outputViewList) {
- ucd.getOutputs().clear();
- for (ExternalToolFileViewer viewer : outputViewList) {
- ScriptOutput so = new ScriptOutput();
- so.setBinary(viewer.isBinary());
- so.setPath(viewer.getValue());
- ucd.getOutputs().put(viewer.getName(), so);
- }
- }
- ucd.getStatic_inputs().clear();
- synchronized (staticStringViewList) {
- for (ExternalToolStaticStringViewer viewer : staticStringViewList) {
- ScriptInputStatic sis = new ScriptInputStatic();
- sis.setContent(viewer.getContent());
- sis.setTag(viewer.getValue());
- sis.setTempFile(false);
- sis.setFile(true);
- ucd.getStatic_inputs().add(sis);
- }
- }
- synchronized (staticUrlViewList) {
- for (ExternalToolStaticUrlViewer viewer : staticUrlViewList) {
- ScriptInputStatic sis = new ScriptInputStatic();
- sis.setUrl(viewer.getContent());
- sis.setTag(viewer.getValue());
- sis.setTempFile(false);
- sis.setFile(true);
- ucd.getStatic_inputs().add(sis);
- }
- }
-
-/* synchronized (runtimeEnvironmentViewList) {
- ucd.getREs().clear();
- for (ExternalToolRuntimeEnvironmentViewer viewer : runtimeEnvironmentViewList) {
- RuntimeEnvironmentConstraint newConstraint = new RuntimeEnvironmentConstraint(
- viewer.getId(), viewer.getRelation());
- ucd.getREs().add(newConstraint);
- }
- }*/
- }
- invocationPanel.fillInConfiguration(newConfiguration);
-
- return newConfiguration;
- }
-
- public boolean isConfigurationChanged() {
- String configurationString = convertBeanToString(activity
- .getConfiguration());
- return (!convertBeanToString(makeConfiguration()).equals(
- configurationString));
- }
-
- /**
- * Adds a {@link JButton} which handles the reconfiguring of the
- * {@link ExternalToolActivity} through the altered
- * {@link ExternalToolActivityConfigurationBean}. Sets up the initial tabs -
- * Script (also sets the initial value), Ports & Dependencies and their
- * initial values through {@link #setDependencies()},
- * {@link #getPortPanel()}
- */
- private void initialise(ExternalToolActivityConfigurationBean configuration) {
- CSH.setHelpIDString(
- this,
- "net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ExternalToolConfigView");
- this.configuration = configuration;
- setBorder(javax.swing.BorderFactory.createTitledBorder(null, null,
- javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
- javax.swing.border.TitledBorder.DEFAULT_POSITION,
- new java.awt.Font("Lucida Grande", 1, 12)));
-
- tabbedPane = new JTabbedPane();
-
- if (invocationPanel != null) {
- invocationPanel.stopObserving();
- }
-
- if (!isFromRepository()) {
- UseCaseDescription useCaseDescription = configuration
- .getUseCaseDescription();
-
- nameField.setText(useCaseDescription.getUsecaseid());
- if (useCaseDescription.getGroup() != null) {
- groupField.setText(useCaseDescription.getGroup());
- }
- descriptionArea.setText(useCaseDescription.getDescription());
- stringReplacementViewList = new ArrayList<ExternalToolStringReplacementViewer>();
- inputFileViewList = new ArrayList<ExternalToolFileViewer>();
- fileListViewList = new ArrayList<ExternalToolFileViewer>();
- outputViewList = new ArrayList<ExternalToolFileViewer>();
- staticUrlViewList = new ArrayList<ExternalToolStaticUrlViewer>();
- staticStringViewList = new ArrayList<ExternalToolStaticStringViewer>();
-/* runtimeEnvironmentViewList = new ArrayList<ExternalToolRuntimeEnvironmentViewer>();*/
-
- for (Entry<String, ScriptInput> entry : useCaseDescription
- .getInputs().entrySet()) {
- String name = entry.getKey();
- ScriptInputUser si = (ScriptInputUser) entry.getValue();
- if (Tools.isStringReplacement(si)) {
- final ExternalToolStringReplacementViewer inputView = new ExternalToolStringReplacementViewer(
- name, si);
- stringReplacementViewList.add(inputView);
- }
-
- }
- Collections.sort(stringReplacementViewList,
- new Comparator<ExternalToolStringReplacementViewer>() {
-
- @Override
- public int compare(
- ExternalToolStringReplacementViewer o1,
- ExternalToolStringReplacementViewer o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
-
- for (Entry<String, ScriptInput> entry : useCaseDescription
- .getInputs().entrySet()) {
- String name = entry.getKey();
- ScriptInputUser si = (ScriptInputUser) entry.getValue();
- if (Tools.isInputFile(si)) {
- final ExternalToolFileViewer inputView = new ExternalToolFileViewer(
- name, si.getTag(), si.isBinary());
- inputFileViewList.add(inputView);
- }
-
- }
- Collections.sort(inputFileViewList,
- new Comparator<ExternalToolFileViewer>() {
-
- @Override
- public int compare(ExternalToolFileViewer o1,
- ExternalToolFileViewer o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
-
- for (Entry<String, ScriptInput> entry : useCaseDescription
- .getInputs().entrySet()) {
- String name = entry.getKey();
- ScriptInputUser si = (ScriptInputUser) entry.getValue();
- if (Tools.isFileList(si)) {
- final ExternalToolFileViewer inputView = new ExternalToolFileViewer(
- name, si.getTag(), si.isBinary());
- fileListViewList.add(inputView);
- }
-
- }
- Collections.sort(fileListViewList,
- new Comparator<ExternalToolFileViewer>() {
-
- @Override
- public int compare(ExternalToolFileViewer o1,
- ExternalToolFileViewer o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
-
- for (Entry<String, ScriptOutput> entry : useCaseDescription
- .getOutputs().entrySet()) {
- ScriptOutput so = entry.getValue();
- final ExternalToolFileViewer outputView = new ExternalToolFileViewer(
- entry.getKey(), so.getPath(), so.isBinary());
- outputViewList.add(outputView);
- }
- Collections.sort(outputViewList,
- new Comparator<ExternalToolFileViewer>() {
-
- @Override
- public int compare(ExternalToolFileViewer o1,
- ExternalToolFileViewer o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
-
- for (ScriptInputStatic siss : useCaseDescription.getStatic_inputs()) {
- if ((siss.getUrl() == null) && siss.isFile()) {
- final ExternalToolStaticStringViewer staticView = new ExternalToolStaticStringViewer(
- siss);
- staticStringViewList.add(staticView);
- }
- }
- Collections.sort(staticStringViewList,
- new Comparator<ExternalToolStaticStringViewer>() {
-
- @Override
- public int compare(ExternalToolStaticStringViewer o1,
- ExternalToolStaticStringViewer o2) {
- return o1.getContent().compareTo(o2.getContent());
- }
- });
-
- for (ScriptInputStatic sis : useCaseDescription.getStatic_inputs()) {
- if ((sis.getUrl() != null) && sis.isFile()) {
- final ExternalToolStaticUrlViewer staticView = new ExternalToolStaticUrlViewer(
- sis);
- staticUrlViewList.add(staticView);
- }
- }
- Collections.sort(staticUrlViewList,
- new Comparator<ExternalToolStaticUrlViewer>() {
-
- @Override
- public int compare(ExternalToolStaticUrlViewer o1,
- ExternalToolStaticUrlViewer o2) {
- return o1.getContent().compareTo(o2.getContent());
- }
- });
-
-/* for (RuntimeEnvironmentConstraint rec : useCaseDescription.getREs()) {
- final ExternalToolRuntimeEnvironmentViewer newView = new ExternalToolRuntimeEnvironmentViewer(
- rec.getID(), rec.getRelation());
- runtimeEnvironmentViewList.add(newView);
- }
- Collections.sort(runtimeEnvironmentViewList,
- new Comparator<ExternalToolRuntimeEnvironmentViewer>() {
-
- @Override
- public int compare(
- ExternalToolRuntimeEnvironmentViewer o1,
- ExternalToolRuntimeEnvironmentViewer o2) {
- return o1.getId().compareTo(o2.getId());
- }
- });*/
-
- scriptTextArea = new JTextPane();
- new LinePainter(scriptTextArea, LINE_COLOR);
-
- final KeywordDocument doc = new KeywordDocument(
- new HashSet<String>());
- // NOTE: Due to T2-1145 - always set editor kit BEFORE setDocument
- scriptTextArea.setEditorKit(new NoWrapEditorKit());
- scriptTextArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
- scriptTextArea.setDocument(doc);
- scriptTextArea.setText(useCaseDescription.getCommand());
- scriptTextArea.setCaretPosition(0);
- scriptTextArea.setPreferredSize(new Dimension(200, 100));
-
- tabbedPane.addTab("Command", new ScriptPanel(this, scriptTextArea, stdInCheckBox, stdOutCheckBox, stdErrCheckBox, returnCodesField));
- tabbedPane.addTab("String replacements",
- new StringReplacementPanel(this, stringReplacementViewList));
- tabbedPane.addTab(
- "File inputs",
- new FilePanel(this, inputFileViewList, "To file", "File type",
- "in", FILE_INPUT_DESCRIPTION, "Add file input"));
- tabbedPane.addTab(
- "File outputs",
- new FilePanel(this, outputViewList, "From file", "File type",
- "out", FILE_OUTPUT_DESCRIPTION, "Add file output"));
- advancedPanel = new JPanel();
- advancedPanel.setLayout(new GridBagLayout());
- GridBagConstraints advancedConstraint = new GridBagConstraints();
- advancedConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- advancedConstraint.gridx = 0;
- advancedConstraint.gridy = 0;
-
- advancedConstraint.fill = GridBagConstraints.BOTH;
- advancedConstraint.weighty = 0.1;
- advancedConstraint.weightx = 0.1;
- advancedTab = new JTabbedPane();
- advancedTab.addTab("Strings", new StaticStringPanel(staticStringViewList));
- advancedTab.addTab("URLs", new StaticUrlPanel(staticUrlViewList));
- advancedTab.addTab(
- "File lists",
- new FilePanel(this, fileListViewList,
- "To file containing list", "Individual file type",
- "in", FILE_LIST_DESCRIPTION, "Add file list"));
- annotationPanel = new AnnotationPanel(nameField, descriptionArea, groupField);
- advancedTab.addTab("Annotation", annotationPanel);
- final ToolXMLPanel toolXMLPanel = new ToolXMLPanel(configuration.getUseCaseDescription());
- advancedTab.addTab("XML", toolXMLPanel);
- advancedTab.addChangeListener(new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- if (advancedTab.getSelectedComponent() == toolXMLPanel) {
- toolXMLPanel.regenerateTree(makeConfiguration().getUseCaseDescription());
- }
- }});
- tabbedPane.addChangeListener(new ChangeListener() {
-
- @Override
- public void stateChanged(ChangeEvent e) {
- if ((tabbedPane.getSelectedComponent() == advancedPanel) &&
- (advancedTab.getSelectedComponent() == toolXMLPanel)) {
- toolXMLPanel.regenerateTree(makeConfiguration().getUseCaseDescription());
- }
- }
-
- });
-/* advancedTab.addTab("Runtime environments",
- createRuntimeEnvironmentPanel(runtimeEnvironmentViewList));*/
- advancedPanel.add(advancedTab, advancedConstraint);
- tabbedPane.addTab("Advanced", advancedPanel);
- }
- invocationPanel = new InvocationPanel(configuration);
-
- tabbedPane.addTab("Location", invocationPanel);
- if (isFromRepository()) {
- tabbedPane.addTab("Edit", new EditablePanel(this));
- }
- GridBagConstraints outerConstraint = new GridBagConstraints();
- outerConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- outerConstraint.gridx = 0;
- outerConstraint.gridy = 0;
-
- outerConstraint.fill = GridBagConstraints.BOTH;
- outerConstraint.weighty = 0.1;
- outerConstraint.weightx = 0.1;
- add(tabbedPane, outerConstraint);
-
- setPreferredSize(new Dimension(700, 500));
- this.validate();
- }
-
- public void whenOpened() {
- if (scriptTextArea != null) {
- scriptTextArea.requestFocus();
- }
- }
-
- private boolean isFromRepository() {
- return (!this.configuration.isEdited() && isOriginallyFromRepository());
- }
-
- public boolean isOriginallyFromRepository() {
- String repositoryUrl = this.configuration.getRepositoryUrl();
- return ((repositoryUrl != null) && !repositoryUrl
- .isEmpty());
-
- }
-
-
- @Override
- public ExternalToolActivityConfigurationBean getConfiguration() {
- return configuration;
- }
-
- public void refreshConfiguration(
- ExternalToolActivityConfigurationBean config) {
- int visibleTab = -1;
- int secondaryTab = -1;
- if (tabbedPane != null) {
- visibleTab = tabbedPane.getSelectedIndex();
- if (tabbedPane.getSelectedComponent().equals(advancedTab)) {
- secondaryTab = advancedTab.getSelectedIndex();
- }
- }
- this.removeAll();
- initialise(config);
- if (visibleTab != -1) {
- tabbedPane.setSelectedIndex(visibleTab);
- }
- if (secondaryTab != -1) {
- advancedTab.setSelectedIndex(secondaryTab);
- }
- }
-
- public void showAnnotationPanel() {
- tabbedPane.setSelectedComponent(advancedPanel);
- advancedTab.setSelectedComponent(annotationPanel);
- }
-
- @Override
- public void refreshConfiguration() {
- refreshConfiguration(activity.getConfiguration());
- }
-
- static Pattern tagPattern = Pattern.compile("%%([^%]*)%%");
-
- @Override
- /**
- * Need to check that the script contains the string replacements and only them - done
- *
- * Need to check the input port names are valid and unique - done
- * Need to check the output port names are valid and unique - done
- *
- * Need to check the input files and static files are unique - done
- * Need to check the file names are valid
- * Need to check the URLs are valid
- * Need to check the replacement tags are unique - done
- */
- public boolean checkValues() {
- if (isFromRepository()) {
- return true;
- }
- boolean result = true;
- String text = "";
- Set<String> stringReplacementPortNames = new HashSet<String>();
- Set<String> stringReplacementTags = new HashSet<String>();
- for (ExternalToolStringReplacementViewer v : stringReplacementViewList) {
- String name = v.getName();
- if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
- text += "A string replacement port has a reserved name \"" + name + "\"\n";
- result = false;
- }
- else if (stringReplacementPortNames.contains(name)) {
- text += "Two string replacement ports have the name \"" + name
- + "\"\n";
- result = false;
- } else if (!name.matches(VALID_NAME_REGEX)) {
- text += "String replacement port name \"" + name
- + "\" is invalid\n";
- result = false;
- } else {
- stringReplacementPortNames.add(name);
- }
-
- String tag = v.getValue();
- if (stringReplacementTags.contains(tag)) {
- text += "Two string replacement ports replace \"%%" + tag
- + "%%\"\n";
- result = false;
- } else if (!tag.matches(VALID_NAME_REGEX)) {
- text += "String replacement tag \"%%" + tag
- + "%%\" is invalid\n";
- result = false;
- } else {
- stringReplacementTags.add(tag);
- }
- }
-
- Matcher m = tagPattern.matcher(scriptTextArea.getText());
- Set<String> tags = new HashSet<String>();
- while (m.find()) {
- String tag = m.group(1);
- if (tag != null) {
- if (tag.isEmpty()) {
- text += "The command contains an empty tag i.e. %%%%\n";
- result = false;
- } else {
- if (!tag.matches(VALID_NAME_REGEX)) {
- text += "The command contains an invalid tag \"%%"
- + tag + "\"%%\n";
- result = false;
- }
- if (!stringReplacementTags.contains(tag)) {
- text += "There is no string replacement for %%" + tag
- + "%%\n";
- result = false;
- } else {
- tags.add(tag);
- }
- }
- }
- }
-
- for (String tag : stringReplacementTags) {
- if (!tags.contains(tag)) {
- text += "String replacement for %%" + tag
- + "%% is not used in the command\n";
- result = false;
- }
- }
-
- Set<String> inputFilePortNames = new HashSet<String>();
- Set<String> inputFileNames = new HashSet<String>();
- for (ExternalToolFileViewer v : inputFileViewList) {
- String name = v.getName();
- if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
- text += "An input file port has a reserved name \"" + name + "\"\n";
- result = false;
- }
- else if (stringReplacementPortNames.contains(name)) {
- text += "A string replacement port and an input file port have the name \""
- + name + "\"\n";
- result = false;
- } else if (inputFilePortNames.contains(name)) {
- text += "Two file input ports have the name \"" + name + "\"\n";
- result = false;
- } else if (!name.matches(VALID_NAME_REGEX)) {
- text += "File input port name \"" + name + "\" is invalid\n";
- result = false;
- } else {
- inputFilePortNames.add(name);
- }
-
- String fileName = v.getValue();
- if (inputFileNames.contains(fileName)) {
- text += "Two file inputs ports write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else {
- inputFileNames.add(fileName);
- }
- }
-
- Set<String> fileListPortNames = new HashSet<String>();
- Set<String> fileListFileNames = new HashSet<String>();
- for (ExternalToolFileViewer v : fileListViewList) {
- String name = v.getName();
- if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
- text += "A file list port has a reserved name \"" + name + "\"\n";
- result = false;
- } else if (stringReplacementPortNames.contains(name)) {
- text += "A string replacement port and a file list port have the name \""
- + name + "\"\n";
- result = false;
- } else if (inputFilePortNames.contains(name)) {
- text += "A file input port and a file list port have the name \""
- + name + "\"\n";
- result = false;
- } else if (fileListPortNames.contains(name)) {
- text += "Two file list ports have the name \"" + name + "\"\n";
- result = false;
- } else if (!name.matches(VALID_NAME_REGEX)) {
- text += "File list port name \"" + name + "\" is invalid\n";
- result = false;
- } else {
- fileListPortNames.add(name);
- }
-
- String fileName = v.getValue();
- if (fileListFileNames.contains(fileName)) {
- text += "Two file list ports write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else if (inputFileNames.contains(fileName)) {
- text += "A file input port and a file list port write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else {
- fileListFileNames.add(fileName);
- }
- }
-
- Set<String> staticStringFileNames = new HashSet<String>();
- for (ExternalToolStaticStringViewer v : staticStringViewList) {
- String fileName = v.getValue();
- if (staticStringFileNames.contains(fileName)) {
- text += "Two static strings write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else if (inputFileNames.contains(fileName)) {
- text += "A file input port and a static string write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else if (fileListFileNames.contains(fileName)) {
- text += "A file list port and a static string write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else {
- staticStringFileNames.add(fileName);
- }
- }
-
- Set<String> staticUrlFileNames = new HashSet<String>();
- for (ExternalToolStaticUrlViewer v : staticUrlViewList) {
- String fileName = v.getValue();
- if (staticUrlFileNames.contains(fileName)) {
- text += "Two static URLss write to the same file \"" + fileName
- + "\"\n";
- result = false;
- } else if (inputFileNames.contains(fileName)) {
- text += "A file input port and a static URL write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else if (fileListFileNames.contains(fileName)) {
- text += "A file list port and a static URL write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else if (staticStringFileNames.contains(fileName)) {
- text += "A static string and a static URL write to the same file \""
- + fileName + "\"\n";
- result = false;
- } else {
- staticUrlFileNames.add(fileName);
- }
- }
- Set<String> outputPortNames = new HashSet<String>();
- for (ExternalToolFileViewer v : outputViewList) {
- String name = v.getName();
- if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
- text += "An output port has a reserved name \"" + name + "\"\n";
- result = false;
- } else if (outputPortNames.contains(name)) {
- text += "Two output file ports have the name \"" + name
- + "\"\n";
- result = false;
- } else if (!name.matches(VALID_NAME_REGEX)) {
- text += "Output file port name \"" + name + "\" is invalid\n";
- result = false;
- } else {
- outputPortNames.add(name);
- }
- }
- if (!result) {
- JOptionPane.showMessageDialog(this, text, "Problems",
- JOptionPane.ERROR_MESSAGE);
- }
- return result;
- }
-
- /**
- * Check the proposed port name against the set of ports
- *
- * @return
- */
- public boolean portNameExists(String name) {
- if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
- return true;
- }
-
- for (ExternalToolFileViewer v : inputFileViewList) {
- if (name.equals(v.getName())) {
- return true;
- }
- }
- for (ExternalToolFileViewer v : fileListViewList) {
- if (name.equals(v.getName())) {
- return true;
- }
- }
- for (ExternalToolStringReplacementViewer v : stringReplacementViewList) {
- if (name.equals(v.getName())) {
- return true;
- }
- }
- for (ExternalToolFileViewer v : outputViewList) {
- if (name.equals(v.getName())) {
- return true;
- }
- }
- return false;
- }
-
-
- public void setEditable(boolean editable, ExternalToolActivityConfigurationBean config) {
- ExternalToolActivityConfigurationBean newConfig = (ExternalToolActivityConfigurationBean) cloneBean(config);
- ExternalToolActivityHealthChecker.updateLocation(newConfig);
- newConfig.setEdited(editable);
- refreshConfiguration(newConfig);
- }
-
- public void whenClosed() {
- if (invocationPanel != null) {
- invocationPanel.stopObserving();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolFileViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolFileViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolFileViewer.java
deleted file mode 100644
index 11fb0c4..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolFileViewer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolFileViewer {
-
- private JTextField nameField;
- private String name;
- private JTextField valueField;
- private JCheckBox valueFromField;
- private JComboBox typeSelector;
-
- public ExternalToolFileViewer(String name, String value, boolean isBinary) {
- this(name);
- nameField.setText(name);
- if (!value.equals(name)) {
- valueFromField.setSelected(false);
- valueField.setText(value);
- valueField.setEnabled(true);
- }
- if (isBinary) {
- typeSelector.setSelectedItem("Binary");
- } else {
- typeSelector.setSelectedItem("Text");
- }
- }
-
- public ExternalToolFileViewer(final String name) {
- this.name = name;
- nameField = new JTextField(20);
- valueField = new JTextField(20);
- valueFromField = new JCheckBox(new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (valueFromField.isSelected()) {
- valueField.setText("");
- valueField.setEnabled(false);
- } else {
- valueField.setText(getName());
- valueField.setEnabled(true);
- }
- }});
- valueFromField.setSelected(true);
- valueField.setEnabled(false);
- typeSelector = new JComboBox(new String[] {"Binary", "Text"});
- nameField.setText(name);
- typeSelector.setSelectedItem("Text");
-
- }
-
- public JTextField getNameField() {
- return nameField;
- }
-
- public JTextField getValueField() {
- return valueField;
- }
-
- public JComboBox getTypeSelector() {
- return typeSelector;
- }
-
- public String getName() {
- return nameField.getText();
- }
-
- public boolean isBinary() {
- return (typeSelector.getSelectedItem().equals("Binary"));
- }
-
- public String getValue() {
- if (valueFromField.isSelected()) {
- return getName();
- }
- return valueField.getText();
- }
-
- /**
- * @return the valueFromField
- */
- public JCheckBox getValueFromField() {
- return valueFromField;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
deleted file mode 100644
index 1451660..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
-
-import de.uni_luebeck.inb.knowarc.usecases.RuntimeEnvironmentConstraint;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolRuntimeEnvironmentViewer {
-
- private JTextField idField;
- private JComboBox relationSelector;
-
- public ExternalToolRuntimeEnvironmentViewer(String id, String relation) {
- this(id);
- idField.setText(id);
- relationSelector.setSelectedItem(relation);
- }
-
- public ExternalToolRuntimeEnvironmentViewer(String id) {
- this();
- idField.setText(id);
- }
-
- public ExternalToolRuntimeEnvironmentViewer() {
- idField = new JTextField(20);
- relationSelector = new JComboBox(RuntimeEnvironmentConstraint.getAcceptedRelations());
- relationSelector.setSelectedItem(RuntimeEnvironmentConstraint.getDefaultRelation());
- }
-
- public JTextField getIdField() {
- return idField;
- }
-
- public JComboBox getRelationSelector() {
- return relationSelector;
- }
-
- public String getId() {
- return idField.getText();
- }
-
- public String getRelation() {
- return (String) relationSelector.getSelectedItem();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticStringViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticStringViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticStringViewer.java
deleted file mode 100644
index d82d9b7..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticStringViewer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolStaticStringViewer {
-
- ScriptInputStatic input;
- private JTextArea contentField = new JTextArea();
- private JTextField valueField;
-
-
- public ExternalToolStaticStringViewer(ScriptInputStatic input) {
- this();
- this.input = input;
- contentField.setText((String) input.getContent());
- valueField.setText(input.getTag());
- }
-
- public ExternalToolStaticStringViewer() {
- contentField = new JTextArea(5, 40);
- contentField.setText("");
- valueField = new JTextField(20);
- valueField.setText("");
- }
-
- public String getContent() {
- return contentField.getText();
- }
-
- public JTextArea getContentField() {
- return contentField;
- }
-
-
- public JTextField getValueField() {
- return valueField;
- }
-
- public String getValue() {
- return valueField.getText();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticUrlViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticUrlViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticUrlViewer.java
deleted file mode 100644
index f7a1793..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStaticUrlViewer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import javax.swing.JComboBox;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolStaticUrlViewer {
-
- ScriptInputStatic input;
- private JTextField contentField = new JTextField();
- private JTextField valueField;
-
-
- public ExternalToolStaticUrlViewer(ScriptInputStatic input) {
- this();
- this.input = input;
- contentField.setText(input.getUrl());
- valueField.setText(input.getTag());
- }
-
- public ExternalToolStaticUrlViewer() {
- contentField = new JTextField(40);
- contentField.setText("");
- valueField = new JTextField(20);
- valueField.setText("");
- }
-
- public String getContent() {
- return contentField.getText();
- }
-
- public JTextField getContentField() {
- return contentField;
- }
-
-
- public JTextField getValueField() {
- return valueField;
- }
-
- public String getValue() {
- return valueField.getText();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStringReplacementViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStringReplacementViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStringReplacementViewer.java
deleted file mode 100644
index 8e24183..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolStringReplacementViewer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.event.ActionEvent;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.AbstractAction;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JTextField;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolStringReplacementViewer {
-
- private static Pattern p = Pattern.compile("\\w+");
- private static final String PERCENTS = "%%";
- ScriptInput input;
- private JTextField nameField;
- private String name;
- private JTextField valueField;
- private JCheckBox valueFromField;
-
- public ExternalToolStringReplacementViewer(String name, ScriptInputUser input) {
- this(name);
- this.input = input;
- nameField.setText(name);
- if (!input.getTag().equals(name)) {
- valueFromField.setSelected(false);
- valueField.setText(PERCENTS + input.getTag() + PERCENTS);
- valueField.setEnabled(true);
- }
- }
-
- public ExternalToolStringReplacementViewer(String name) {
- this.name = name;
- nameField = new JTextField(20);
- nameField.setText(name);
- valueField = new JTextField(20);
- valueFromField = new JCheckBox(new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (valueFromField.isSelected()) {
- valueField.setText("");
- valueField.setEnabled(false);
- } else {
- valueField.setText(PERCENTS + getName() + PERCENTS);
- valueField.setEnabled(true);
- }
- }});
- valueFromField.setSelected(true);
- valueField.setEnabled(false);
- }
-
- public JTextField getNameField() {
- return nameField;
- }
-
- public JTextField getValueField() {
- return valueField;
- }
-
- public String getName() {
- return nameField.getText();
- }
-
- public String getValue() {
- if (valueFromField.isSelected()) {
- return getName();
- }
- String enteredValue = valueField.getText();
-
- Matcher m = p.matcher(enteredValue);
- String result = "";
- if (m.find()) {
- result = m.group();
- }
- return result;
- }
-
- /**
- * @return the valueFromField
- */
- public JCheckBox getValueFromField() {
- return valueFromField;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
deleted file mode 100644
index 678711c..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class FilePanel extends JPanel {
-
- private int outputGridy = 1;
- private final ExternalToolConfigView view;
-
- public FilePanel(final ExternalToolConfigView view,
- final List<ExternalToolFileViewer> viewList,
- String fileHeader, String typeHeader, final String portPrefix,
- final String description, String addText) {
- super();
- this.view = view;
- this.setLayout(new BorderLayout());
- final JPanel fileEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints fileConstraint = new GridBagConstraints();
- fileConstraint.insets = new Insets(5, 5, 5, 5);
- fileConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- fileConstraint.gridx = 0;
- fileConstraint.gridy = 0;
- fileConstraint.weightx = 0.1;
- fileConstraint.fill = GridBagConstraints.BOTH;
-
- final String[] elementLabels = new String[] {"Taverna port name",
- "Use port name for file",
- fileHeader,
- typeHeader
- };
-
- fileConstraint.gridx = 0;
- synchronized (viewList) {
- for (ExternalToolFileViewer outputView : viewList) {
- addFileViewer(viewList, this, fileEditPanel,
- outputView, elementLabels);
- }
- }
- JButton addFilePortButton = new DeselectingButton(addText,
- new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
-
- int portNumber = 1;
-
- String name2 = portPrefix + portNumber++;
- boolean nameExists = true;
- while (nameExists == true) {
- nameExists = view.portNameExists(name2);
- if (nameExists) {
- name2 = portPrefix + portNumber++;
- }
- }
-
- ExternalToolFileViewer newViewer = new ExternalToolFileViewer(
- name2);
- synchronized (viewList) {
- viewList.add(newViewer);
- addFileViewer(viewList, FilePanel.this, fileEditPanel,
- newViewer, elementLabels);
- fileEditPanel.revalidate();
- fileEditPanel.repaint();
- }
- }
-
- });
- JTextArea descriptionText = new ReadOnlyTextArea(description);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
-
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.add(new JScrollPane(fileEditPanel), BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addFilePortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addFileViewer(final List<ExternalToolFileViewer> viewList,
- final JPanel outerPanel, final JPanel panel,
- ExternalToolFileViewer viewer, String[] elementLabels) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField(), viewer.getTypeSelector()},
- viewList,
- viewer,
- outerPanel);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
deleted file mode 100644
index a3221ab..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import javax.swing.AbstractAction;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JTextArea;
-import javax.swing.SwingUtilities;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityHealthChecker;
-import net.sf.taverna.t2.activities.externaltool.configuration.ToolInvocationConfiguration;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroup;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupAddedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupRemovedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationManagerEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismAddedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismRemovedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationPanel;
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.workbench.ui.impl.configuration.ui.T2ConfigurationFrame;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author alanrw
- *
- */
-public class InvocationPanel extends JPanel implements Observer<InvocationManagerEvent> {
-
- private static final String LOCATION_DESCRIPTION = ToolInvocationConfigurationPanel.HEADER_TEXT;
- private final JComboBox mechanismSelection;
- private final JComboBox groupSelection;
-
- private DefaultComboBoxModel mechanismSelectionModel = new DefaultComboBoxModel();
- private DefaultComboBoxModel groupSelectionModel = new DefaultComboBoxModel();
-
- private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance();
-
- private static Logger logger = Logger
- .getLogger(InvocationPanel.class);
-
- private JRadioButton unmanagedLocation;
- private JRadioButton groupSelected;
- private JRadioButton mechanismSelected;
- private JButton manageInvocation;
- private ButtonGroup mechanismOrGroup;
- private ExternalToolActivityConfigurationBean configuration;
-
- private ActionListener radioChangeListener;
-
- boolean unmanagedShown = false;
-
- public InvocationPanel(ExternalToolActivityConfigurationBean configuration) {
- super();
- manager.addObserver(this);
-
- mechanismSelection = new JComboBox();
- populateMechanismList();
- mechanismSelection.setModel(mechanismSelectionModel);
-
- groupSelection = new JComboBox();
- populateGroupList();
- groupSelection.setModel(groupSelectionModel);
- populateInvocationPanel(configuration);
-
- radioChangeListener = new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (unmanagedShown && unmanagedLocation.isSelected()) {
- setUnmanagedLocationSelectability(true);
- setMechanismSelectability(false);
- setGroupSelectability(false);
- return;
- }
- if (mechanismSelected.isSelected()) {
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(true);
- setGroupSelectability(false);
- return;
- }
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(false);
- setGroupSelectability(true);
- return; }
-
- };
- if (unmanagedShown) {
- unmanagedLocation.addActionListener(radioChangeListener);
- }
- groupSelected.addActionListener(radioChangeListener);
- mechanismSelected.addActionListener(radioChangeListener);
- }
-
- private void populateMechanismList() {
- InvocationMechanism currentSelection = (InvocationMechanism) mechanismSelection.getSelectedItem();
- InvocationMechanism[] mechanisms = InvocationGroupManagerImpl.getInstance()
- .getMechanisms().toArray(new InvocationMechanism[] {});
- Arrays.sort(mechanisms, new Comparator<InvocationMechanism>() {
-
- @Override
- public int compare(InvocationMechanism arg0, InvocationMechanism arg1) {
- return arg0.getName().compareTo(
- arg1.getName());
- }
- });
- mechanismSelectionModel.removeAllElements();
- for (InvocationMechanism mechanism : mechanisms) {
- mechanismSelectionModel.addElement(mechanism);
- logger.info("Added mechanism " + mechanism.hashCode());
- }
- if (currentSelection != null) {
- mechanismSelection.setSelectedItem(currentSelection);
- }
-
- }
-
- private void populateGroupList() {
- InvocationGroup currentSelection = (InvocationGroup) groupSelection.getSelectedItem();
- InvocationGroup[] groups = InvocationGroupManagerImpl.getInstance()
- .getInvocationGroups().toArray(new InvocationGroup[] {});
- Arrays.sort(groups, new Comparator<InvocationGroup>() {
-
- @Override
- public int compare(InvocationGroup arg0, InvocationGroup arg1) {
- return arg0.getName().compareTo(
- arg1.getName());
- }
- });
- groupSelectionModel.removeAllElements();
- for (InvocationGroup group : groups) {
- groupSelectionModel.addElement(group);
- logger.info("Added group " + group.hashCode());
- }
- if (currentSelection != null) {
- groupSelection.setSelectedItem(currentSelection);
- }
-
- }
-
-
- private void populateInvocationPanel(ExternalToolActivityConfigurationBean configuration) {
- this.configuration = configuration;
- this.removeAll();
- this.setLayout(new BorderLayout());
-
- JTextArea descriptionText = new JTextArea(
- LOCATION_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- descriptionText.setRows(3);
- this.add(descriptionText, BorderLayout.NORTH);
-
- JPanel innerPanel = new JPanel(new BorderLayout());
-
- mechanismOrGroup = new ButtonGroup();
-
- JPanel subPanel = new JPanel(new GridLayout(4,1));
-
- if (isUnmanaged(configuration)) {
- createUnmanagedLocation(subPanel);
- unmanagedShown = true;
- }
-
- subPanel.add(createMechanismPanel());
-
- subPanel.add(createGroupPanel());
-
- subPanel.add(createButtonPanel());
-
- innerPanel.add(subPanel, BorderLayout.NORTH);
- innerPanel.add(new JPanel(), BorderLayout.CENTER);
-
- initializeSelectability();
- this.add(innerPanel, BorderLayout.CENTER);
- this.repaint();
- }
-
- private boolean isUnmanaged(
- ExternalToolActivityConfigurationBean configuration2) {
- return (!ExternalToolActivityHealthChecker.updateLocation(configuration2));
- }
-
- private void initializeSelectability() {
- if (isUnmanaged(configuration)) {
- unmanagedLocation.setSelected(true);
- setUnmanagedLocationSelectability(true);
- setMechanismSelectability(false);
- setGroupSelectability(false);
- return;
- }
- if (configuration.getInvocationGroup() == null) {
- mechanismSelected.setSelected(true);
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(true);
- setGroupSelectability(false);
- return;
- }
- groupSelected.setSelected(true);
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(false);
- setGroupSelectability(true);
- return;
- }
-
- private void setGroupSelectability(boolean b) {
- groupSelection.setEnabled(b);
- }
-
- private void setMechanismSelectability(boolean b) {
- mechanismSelection.setEnabled(b);
- }
-
- private void setUnmanagedLocationSelectability(boolean b) {
- // Nothing to do
- }
-
- private JPanel createGroupPanel() {
- JPanel groupPanel = new JPanel(new BorderLayout());
-
- JPanel groupSelectionPanel = new JPanel(new GridLayout(1, 2));
- groupSelected = new JRadioButton("Select a symbolic location");
- mechanismOrGroup.add(groupSelected);
- groupSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
- groupSelectionPanel.add(groupSelected);
-
- groupSelection.setRenderer(new DefaultListCellRenderer() {
-
- @Override
- public Component getListCellRendererComponent(JList arg0,
- Object arg1, int arg2, boolean arg3, boolean arg4) {
- if (arg1 instanceof InvocationGroup) {
- return super.getListCellRendererComponent(arg0,
- ((InvocationGroup) arg1).getName(),
- arg2, arg3, arg4);
- }
- return super.getListCellRendererComponent(arg0, arg1, arg2,
- arg3, arg4);
- }
- });
-
- groupSelectionPanel.add(groupSelection);
-
- groupPanel.add(groupSelectionPanel, BorderLayout.CENTER);
-
- if (configuration.getInvocationGroup() != null) {
- groupSelection.setSelectedItem(configuration.getInvocationGroup());
- } else {
- groupSelection.setSelectedItem(manager.getDefaultGroup());
- }
-
- return groupPanel;
- }
-
- private JPanel createMechanismPanel() {
- JPanel mechanismPanel = new JPanel(new BorderLayout());
- JPanel mechanismSelectionPanel = new JPanel(new GridLayout(1, 3));
- mechanismSelected = new JRadioButton("Select an explicit location");
- mechanismOrGroup.add(mechanismSelected);
- mechanismSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
- mechanismSelectionPanel.add(mechanismSelected);
-
- mechanismSelection.setRenderer(new DefaultListCellRenderer() {
-
- @Override
- public Component getListCellRendererComponent(JList arg0,
- Object arg1, int arg2, boolean arg3, boolean arg4) {
- if (arg1 instanceof InvocationMechanism) {
- return super.getListCellRendererComponent(arg0,
- ((InvocationMechanism) arg1).getName(),
- arg2, arg3, arg4);
- }
- return super.getListCellRendererComponent(arg0, arg1, arg2,
- arg3, arg4);
- }
- });
-
- mechanismSelectionPanel.add(mechanismSelection);
-
- mechanismPanel.add(mechanismSelectionPanel, BorderLayout.CENTER);
- if (configuration.getMechanism() != null) {
- mechanismSelection.setSelectedItem(configuration.getMechanism());
- } else {
- mechanismSelection.setSelectedItem(manager.getDefaultMechanism());
- }
- return mechanismPanel;
-
- }
-
- private JPanel createButtonPanel() {
- JPanel buttonPanel = new JPanel(new FlowLayout());
- manageInvocation = new DeselectingButton("Manage locations",
- new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- T2ConfigurationFrame.showConfiguration(ToolInvocationConfiguration.getInstance().getDisplayName());
- }});
- buttonPanel.add(manageInvocation);
- return buttonPanel;
- }
-
- private void createUnmanagedLocation(JPanel subPanel) {
- unmanagedLocation = new JRadioButton("Continue using unmanaged location");
- subPanel.add(unmanagedLocation);
- mechanismOrGroup.add(unmanagedLocation);
- }
-
- private void handleInvocationManagerMessage(InvocationManagerEvent message) {
- if (message instanceof InvocationMechanismRemovedEvent) {
- InvocationMechanism removedMechanism = ((InvocationMechanismRemovedEvent) message).getRemovedMechanism();
- InvocationMechanism replacementMechanism = ((InvocationMechanismRemovedEvent) message).getReplacementMechanism();
- if (mechanismSelection.getSelectedItem().equals(removedMechanism)) {
- mechanismSelection.setSelectedItem(replacementMechanism);
- }
- mechanismSelectionModel.removeElement(removedMechanism);
- } else if (message instanceof InvocationMechanismAddedEvent) {
- populateMechanismList();
- }
- else if (message instanceof InvocationGroupRemovedEvent) {
- InvocationGroup removedGroup = ((InvocationGroupRemovedEvent) message).getRemovedGroup();
- InvocationGroup replacementGroup = ((InvocationGroupRemovedEvent) message).getReplacementGroup();
- if (groupSelection.getSelectedItem().equals(removedGroup)) {
- groupSelection.setSelectedItem(replacementGroup);
- }
- groupSelectionModel.removeElement(removedGroup);
- } else if (message instanceof InvocationGroupAddedEvent) {
- populateGroupList();
- }
- }
-
- @Override
- public void notify(Observable<InvocationManagerEvent> sender,
- final InvocationManagerEvent message) throws Exception {
- if (SwingUtilities.isEventDispatchThread()) {
- handleInvocationManagerMessage(message);
- } else {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- handleInvocationManagerMessage(message);
- }
- });
- } }
-
- public void fillInConfiguration(
- ExternalToolActivityConfigurationBean newConfiguration) {
- if (unmanagedShown && unmanagedLocation.isSelected()) {
- return;
- }
- if (mechanismSelected.isSelected()) {
- newConfiguration.setMechanism((InvocationMechanism) mechanismSelection.getSelectedItem());
- return;
- }
- newConfiguration.setInvocationGroup((InvocationGroup) groupSelection.getSelectedItem());
- }
-
- public void stopObserving() {
- manager.removeObserver(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
deleted file mode 100644
index 7f0d82f..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.io.StringBufferInputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.lang.ui.FileTools;
-
-import org.jdom.Document;
-import org.jdom.JDOMException;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-final class LoadDescriptionAction extends AbstractAction {
- /**
- *
- */
- private final ScriptPanel scriptPanel;
- private final ExternalToolConfigView view;
-
- LoadDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
- this.scriptPanel = scriptPanel;
- this.view = view;
- }
-
- public void actionPerformed(ActionEvent e) {
- String descriptionsString = FileTools.readStringFromFile(
- this.scriptPanel, "Load tool description",
- ".xml");
- if (descriptionsString != null) {
- String errorMessage = null;
- try {
- Document doc = ScriptPanel.builder
- .build(new StringReader(descriptionsString));
- List<UseCaseDescription> descriptions = UseCaseEnumeration.readDescriptionsFromStream(new StringBufferInputStream(descriptionsString));
- if (descriptions.isEmpty()) {
- JOptionPane.showMessageDialog(this.scriptPanel, "No tool descriptions found", "File content", JOptionPane.ERROR_MESSAGE);
- return;
- }
-
- if (descriptions.size() == 1) {
- view.getConfiguration().setUseCaseDescription(descriptions.get(0));
- view.refreshConfiguration(view.getConfiguration());
- return;
- }
-
- List<String> descriptionNames = new ArrayList();
- for (UseCaseDescription ud : descriptions) {
- descriptionNames.add(ud.getUsecaseid());
- }
- Collections.sort(descriptionNames);
- String chosenName = (String) JOptionPane.showInputDialog(this.scriptPanel, "Please select a tool description",
- "Select tool description", JOptionPane.PLAIN_MESSAGE, null, descriptionNames.toArray(), descriptionNames.get(0));
- if (chosenName != null) {
- for (UseCaseDescription ud : descriptions) {
- if (ud.getUsecaseid().equals(chosenName)) {
- view.getConfiguration().setUseCaseDescription(ud);
- view.refreshConfiguration(view.getConfiguration());
- return;
-
- }
- }
- }
- } catch (JDOMException e1) {
- errorMessage = e1.getMessage();
- } catch (IOException e1) {
- errorMessage = e1.getMessage();
- } catch (Exception e1) {
- errorMessage = e1.getMessage();
- }
- if (errorMessage != null) {
- JOptionPane.showMessageDialog(null, errorMessage,
- "Tool description load error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
deleted file mode 100644
index 31266b4..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.lang.ui.ExtensionFileFilter;
-import net.sf.taverna.t2.lang.ui.FileTools;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-final class SaveDescriptionAction extends AbstractAction {
- /**
- *
- */
- private final ScriptPanel scriptPanel;
- private final ExternalToolConfigView view;
-
- private static Logger logger = Logger.getLogger(SaveDescriptionAction.class);
-
- private static XMLOutputter outputter = new XMLOutputter(Format
- .getPrettyFormat());
-
- SaveDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
- this.scriptPanel = scriptPanel;
- this.view = view;
- }
-
- public void actionPerformed(ActionEvent e) {
- UseCaseDescription currentDescription = view.makeConfiguration().getUseCaseDescription();
- String usecaseid = currentDescription.getUsecaseid();
- String description = currentDescription.getDescription();
- String group = currentDescription.getGroup();
- if ((usecaseid == null) || usecaseid.isEmpty() || (description == null) || description.isEmpty() || (group == null) || group.isEmpty()) {
- JOptionPane.showMessageDialog(view, "Please fill in the tool annotation and\nthen re-export the description", "Missing annotation", JOptionPane.PLAIN_MESSAGE, null);
- view.showAnnotationPanel();
- } else {
- saveStringToFile(this.scriptPanel,
- "Save tool description", ".xml", currentDescription);
- }
- }
-
- public static boolean saveStringToFile(Component parent, String dialogTitle, String extension, UseCaseDescription description) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setDialogTitle(dialogTitle);
-
- fileChooser.resetChoosableFileFilters();
- fileChooser.setAcceptAllFileFilterUsed(true);
-
- fileChooser.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
-
- Preferences prefs = Preferences.userNodeForPackage(FileTools.class);
- String curDir = prefs
- .get("currentDir", System.getProperty("user.home"));
- fileChooser.setCurrentDirectory(new File(curDir));
-
- boolean tryAgain = true;
- while (tryAgain) {
- tryAgain = false;
- int returnVal = fileChooser.showSaveDialog(parent);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- prefs.put("currentDir", fileChooser.getCurrentDirectory()
- .toString());
- File file = fileChooser.getSelectedFile();
- if (!file.getName().contains(".")) {
- String newName = file.getName() + extension;
- file = new File(file.getParentFile(), newName);
- }
-
- // TODO: Open in separate thread to avoid hanging UI
- try {
- List<UseCaseDescription> currentDescriptions;
- if (file.exists()) {
- currentDescriptions = UseCaseEnumeration.readDescriptionsFromStream(new FileInputStream(file));
- } else {
- currentDescriptions = new ArrayList<UseCaseDescription>();
- }
- Element overallElement = new Element("usecases");
- for (UseCaseDescription ud : currentDescriptions) {
- if (!ud.getUsecaseid().equals(description.getUsecaseid())) {
- overallElement.addContent(ud.writeToXMLElement());
- }
- }
-
- overallElement.addContent(description.writeToXMLElement());
- BufferedWriter out = new BufferedWriter(new FileWriter(file));
- out.write(outputter.outputString(overallElement));
- out.close();
- logger.info("Saved content by overwriting " + file);
- return true;
- } catch (IOException ex) {
- logger.warn("Could not save content to " + file, ex);
- JOptionPane.showMessageDialog(parent,
- "Could not save to " + file + ": \n\n"
- + ex.getMessage(), "Warning",
- JOptionPane.WARNING_MESSAGE);
- return false;
- }
- }
- }
- return false;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
deleted file mode 100644
index bf902d7..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-import javax.swing.text.JTextComponent;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.LineEnabledTextPanel;
-
-import org.jdom.input.SAXBuilder;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-
-/**
- * @author alanrw
- *
- */
-public class ScriptPanel extends JPanel {
-
- private static final String SCRIPT_DESCRIPTION = "Specify the commands that you want to run. You can use data arriving at an input port to replace parts of the command or to write to a file. You can also take data written to a file and send it to an output port.";
- static SAXBuilder builder = new SAXBuilder();
- private final JTextComponent scriptTextArea;
-
- public ScriptPanel(final ExternalToolConfigView view, JTextComponent scriptTextArea, JCheckBox stdInCheckBox, JCheckBox stdOutCheckBox, JCheckBox stdErrCheckBox, JTextField returnCodesField) {
- super();
- this.setLayout(new BorderLayout());
-
- JTextArea descriptionText = new JTextArea(
- SCRIPT_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.scriptTextArea = scriptTextArea;
-
- this.add(new LineEnabledTextPanel(scriptTextArea),
- BorderLayout.CENTER);
-
-
- UseCaseDescription useCaseDescription = view.getConfiguration().getUseCaseDescription();
- stdInCheckBox.setSelected(useCaseDescription.isIncludeStdIn());
- stdOutCheckBox.setSelected(useCaseDescription.isIncludeStdOut());
- stdErrCheckBox.setSelected(useCaseDescription.isIncludeStdErr());
- returnCodesField.setText(useCaseDescription.getReturnCodesAsText());
-
- JPanel codesPanel = new JPanel(new FlowLayout());
- codesPanel.add(new JLabel("Valid return codes:"));
- codesPanel.add(returnCodesField);
-
- JPanel streamPanel = new JPanel(new FlowLayout());
- streamPanel.add(stdInCheckBox);
- streamPanel.add(stdOutCheckBox);
- streamPanel.add(stdErrCheckBox);
-
- JPanel buttonPanel = new JPanel(new FlowLayout());
- if (view.isOriginallyFromRepository()) {
- JButton revertButton = new DeselectingButton("Revert to original description",
- new AbstractAction(){
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ExternalToolActivityConfigurationBean bean = view.makeConfiguration();
- String repositoryUrl = bean.getRepositoryUrl();
- String id = bean.getExternaltoolid();
- UseCaseDescription usecase = null;
- try {
- usecase = UseCaseEnumeration.readDescriptionFromUrl(
- repositoryUrl, id);
- }
- catch (IOException ex) {
- // Already logged
- }
- if (usecase != null) {
- bean.setUseCaseDescription(usecase);
- view.setEditable(false, bean);
- } else {
- JOptionPane.showMessageDialog(view, "Unable to find tool description " + id, "Missing tool description", JOptionPane.ERROR_MESSAGE);
- }
- }});
- revertButton.setToolTipText("Revert to the tool description from the repository");
- buttonPanel.add(revertButton);
- }
- JButton loadScriptButton = new DeselectingButton("Load description",
- new LoadDescriptionAction(this, view));
- loadScriptButton.setToolTipText("Load tool description from a file");
-
- JButton saveScriptButton = new DeselectingButton("Export description",
- new SaveDescriptionAction(this, view));
- saveScriptButton.setToolTipText("Export the tool description to a file");
-
- JButton clearScriptButton = new DeselectingButton("Clear script",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
- clearScript();
- }
-
- });
- clearScriptButton.setToolTipText("Clear the script from the edit area");
-
- buttonPanel.add(loadScriptButton);
- buttonPanel.add(saveScriptButton);
- buttonPanel.add(clearScriptButton);
-
- JPanel subPanel = new JPanel(new GridLayout(3,1));
- subPanel.add(codesPanel);
- subPanel.add(streamPanel);
- subPanel.add(buttonPanel);
-
- this.add(subPanel, BorderLayout.SOUTH);
- }
-
- /**
- * Method for clearing the script
- *
- */
- private void clearScript() {
- if (JOptionPane.showConfirmDialog(this,
- "Do you really want to clear the tool description?",
- "Clearing the tool description", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
- scriptTextArea.setText("");
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
deleted file mode 100644
index 885cab5..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class StaticStringPanel extends JPanel {
-
- private static final String STATIC_STRING_DESCRIPTION = "A fixed string can be written to the specified file.";
- private final List<ExternalToolStaticStringViewer> staticStringViewList;
-
- int staticGridy = 1;
-
- private static String[] elementLabels = new String[] {"String to copy", "To file"};
-
- public StaticStringPanel(final List<ExternalToolStaticStringViewer> staticStringViewList) {
- super(new BorderLayout());
- this.staticStringViewList = staticStringViewList;
- final JPanel staticEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints staticConstraint = new GridBagConstraints();
- staticConstraint.insets = new Insets(5, 5, 5, 5);
- staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- staticConstraint.gridx = 0;
- staticConstraint.gridy = 0;
- staticConstraint.weightx = 0.1;
- staticConstraint.fill = GridBagConstraints.BOTH;
-
- staticConstraint.gridx = 0;
- synchronized (staticStringViewList) {
- for (ExternalToolStaticStringViewer staticView : staticStringViewList) {
- addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
- staticView);
- }
- }
-
- JTextArea descriptionText = new ReadOnlyTextArea(
- STATIC_STRING_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.add(new JScrollPane(staticEditPanel),
- BorderLayout.CENTER);
- JButton addStaticStringButton = new DeselectingButton("Add string",
- new AbstractAction() {
- // FIXME refactor this into a method
- public void actionPerformed(ActionEvent e) {
-
- ExternalToolStaticStringViewer newViewer = new ExternalToolStaticStringViewer();
- synchronized (staticStringViewList) {
- staticStringViewList.add(newViewer);
- addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
- newViewer);
- staticEditPanel.revalidate();
- staticEditPanel.repaint();
- }
- }
-
- });
-
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addStaticStringButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addStaticStringViewer(final JPanel outerPanel,
- final JPanel panel, ExternalToolStaticStringViewer viewer) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {new JScrollPane(viewer.getContentField()), viewer.getValueField()},
- staticStringViewList,
- viewer,
- outerPanel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
deleted file mode 100644
index ba441f4..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class StaticUrlPanel extends JPanel {
-
- private static final String STATIC_URL_DESCRIPTION = "The data at a URL can be downloaded and stored in the specified file.";
- private final List<ExternalToolStaticUrlViewer> staticUrlViewList;
- private int staticGridy = 1;
-
- private static String[] elementLabels = new String[] {"Copy from URL", "To file"};
-
-
- public StaticUrlPanel(final List<ExternalToolStaticUrlViewer> staticUrlViewList) {
-
- super(new BorderLayout());
- this.staticUrlViewList = staticUrlViewList;
- final JPanel staticEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints staticConstraint = new GridBagConstraints();
- staticConstraint.insets = new Insets(5, 5, 5, 5);
- staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- staticConstraint.gridx = 0;
- staticConstraint.gridy = 0;
- staticConstraint.weightx = 0.1;
- staticConstraint.fill = GridBagConstraints.BOTH;
-
- staticConstraint.gridx = 0;
- synchronized (staticUrlViewList) {
- for (ExternalToolStaticUrlViewer staticView : staticUrlViewList) {
- addStaticUrlViewer(this, staticEditPanel,
- staticView);
- }
- }
-
- this.add(new JScrollPane(staticEditPanel),
- BorderLayout.CENTER);
-
- JTextArea descriptionText = new ReadOnlyTextArea(
- STATIC_URL_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
-
- this.add(descriptionText, BorderLayout.NORTH);
-
- JButton addstaticPortButton = new DeselectingButton("Add URL",
- new AbstractAction() {
- // FIXME refactor this into a method
- public void actionPerformed(ActionEvent e) {
-
- ExternalToolStaticUrlViewer newViewer = new ExternalToolStaticUrlViewer();
- synchronized (staticUrlViewList) {
- staticUrlViewList.add(newViewer);
- addStaticUrlViewer(StaticUrlPanel.this, staticEditPanel,
- newViewer);
- staticEditPanel.revalidate();
- staticEditPanel.repaint();
- }
- }
-
- });
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addstaticPortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addStaticUrlViewer(final JPanel outerPanel,
- final JPanel panel, ExternalToolStaticUrlViewer viewer) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {viewer.getContentField(), viewer.getValueField()},
- staticUrlViewList,
- viewer,
- outerPanel);
- }
-
-
-}
[06/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLSplitterEdit.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLSplitterEdit.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLSplitterEdit.java
new file mode 100644
index 0000000..0d526d3
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLSplitterEdit.java
@@ -0,0 +1,314 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+import org.apache.taverna.workflow.edits.AddDataLinkEdit;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+import org.apache.taverna.wsdl.parser.ArrayTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
+
+import org.jdom.Element;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.taverna.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBeanBuilder;
+
+public class AddXMLSplitterEdit implements Edit<Workflow> {
+
+ public static final URI INPUT_SPLITTER_TYPE = URI
+ .create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
+ public static final URI OUTPUT_SPLITTER_TYPE = URI
+ .create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
+ public static final URI SPLITTER_CONFIG_TYPE = URI
+ .create("http://ns.taverna.org.uk/2010/activity/xml-splitter#Config");
+
+ private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ private final Workflow workflow;
+ private final Profile profile;
+ private final Activity activity;
+ private TypeDescriptor typeDescriptor;
+ private final String portName;
+ private final boolean isInput;
+
+ private CompoundEdit compoundEdit1 = null;
+ private Edit<?> linkUpEdit;
+ private boolean applied = false;
+
+ public AddXMLSplitterEdit(Workflow workflow, Profile profile, Activity activity,
+ TypeDescriptor typeDescriptor, String portName, boolean isInput) {
+ this.workflow = workflow;
+ this.profile = profile;
+ this.activity = activity;
+ this.typeDescriptor = typeDescriptor;
+ this.portName = portName;
+ this.isInput = isInput;
+ }
+
+ @Override
+ public Workflow doEdit() throws EditException {
+ if (applied) {
+ throw new EditException("Edit has already been applied!");
+ }
+
+ Activity splitter = null;
+ Configuration splitterConfiguration = null;
+ String sourcePortName = "";
+ Processor sourceProcessor = null;
+
+ String sinkPortName = "";
+ Processor sinkProcessor = null;
+
+ Processor activityProcessor = null;
+ List<ProcessorBinding> processorBindingsToActivity = scufl2Tools
+ .processorBindingsToActivity(activity);
+ for (ProcessorBinding processorBinding : processorBindingsToActivity) {
+ activityProcessor = processorBinding.getBoundProcessor();
+ break;
+ }
+ if (activityProcessor == null) {
+ throw new EditException("Cannot find the processor that the activity belongs to");
+ }
+
+ String displayName = portName;
+ if (portName.equals("parameters")) {
+ displayName = isInput ? "input" : "output";
+ }
+ String processorName = activityProcessor.getName();
+ String candidateName;
+ if (displayName.startsWith(processorName)) {
+ // No need to make GetRequest_GetRequestResponse
+ candidateName = displayName;
+ } else {
+ // Combine with processor name
+ String displayProcessorName;
+ if (activity.getType().equals(INPUT_SPLITTER_TYPE)
+ || activity.getType().equals(OUTPUT_SPLITTER_TYPE)) {
+ // For splitters on splitters - avoid adding up blah_bluh_blih_more_stuff
+ String[] processorNameSplit = processorName.replace("_input", "")
+ .replace("_output", "").split("_");
+ displayProcessorName = processorNameSplit[processorNameSplit.length - 1];
+ } else {
+ displayProcessorName = activityProcessor.getName();
+ }
+ candidateName = displayProcessorName + "_" + displayName;
+ }
+
+ Processor splitterProcessor = new Processor();
+ splitterProcessor.setName(candidateName);
+
+ CrossProduct crossProduct = new CrossProduct();
+ crossProduct.setParent(splitterProcessor.getIterationStrategyStack());
+
+ ProcessorBinding processorBinding = new ProcessorBinding();
+ processorBinding.setBoundProcessor(splitterProcessor);
+
+ try {
+ if (activity.getType().equals(INPUT_SPLITTER_TYPE)) {
+ if (!isInput) {
+ throw new EditException(
+ "Can only add an input splitter to another input splitter");
+ }
+ if (typeDescriptor instanceof ArrayTypeDescriptor
+ && !((ArrayTypeDescriptor) typeDescriptor).isWrapped()) {
+ typeDescriptor = ((ArrayTypeDescriptor) typeDescriptor).getElementType();
+ }
+
+ Element element = XMLSplitterSerialisationHelper
+ .typeDescriptorToExtensionXML(typeDescriptor);
+// String wrappedType = new XMLOutputter().outputString(element);
+
+ splitter = new Activity();
+ splitter.setType(INPUT_SPLITTER_TYPE);
+ splitterConfiguration = new Configuration();
+ splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
+ splitterConfiguration.setConfigures(splitter);
+// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
+
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ splitterConfiguration.setJson(bean);
+
+ XMLSplitterPortBuilder.addPortsForInput(element, splitter, splitterProcessor,
+ processorBinding);
+
+ } else if (activity.getType().equals(OUTPUT_SPLITTER_TYPE)) {
+ if (isInput) {
+ throw new EditException(
+ "Can only add an output splitter to another output splitter");
+ }
+ if (typeDescriptor instanceof ArrayTypeDescriptor
+ && !((ArrayTypeDescriptor) typeDescriptor).isWrapped()) {
+ typeDescriptor = ((ArrayTypeDescriptor) typeDescriptor).getElementType();
+ }
+
+ Element element = XMLSplitterSerialisationHelper
+ .typeDescriptorToExtensionXML(typeDescriptor);
+// String wrappedType = new XMLOutputter().outputString(element);
+
+ splitter = new Activity();
+ splitter.setType(OUTPUT_SPLITTER_TYPE);
+ splitterConfiguration = new Configuration();
+ splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
+ splitterConfiguration.setConfigures(splitter);
+// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
+
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
+ splitterConfiguration.setJson(bean);
+
+ XMLSplitterPortBuilder.addPortsForOutput(element, splitter, splitterProcessor,
+ processorBinding);
+
+ } else if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
+ if (isInput) {
+ Element element = XMLSplitterSerialisationHelper
+ .typeDescriptorToExtensionXML(typeDescriptor);
+// String wrappedType = new XMLOutputter().outputString(element);
+
+ splitter = new Activity();
+ splitter.setType(WSDLServiceDescription.INPUT_SPLITTER_TYPE);
+ splitterConfiguration = new Configuration();
+ splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
+ splitterConfiguration.setConfigures(splitter);
+// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
+
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ splitterConfiguration.setJson(bean);
+
+ XMLSplitterPortBuilder.addPortsForInput(element, splitter, splitterProcessor,
+ processorBinding);
+
+ } else {
+ Element element = XMLSplitterSerialisationHelper
+ .typeDescriptorToExtensionXML(typeDescriptor);
+// String wrappedType = new XMLOutputter().outputString(element);
+
+ splitter = new Activity();
+ splitter.setType(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE);
+ splitterConfiguration = new Configuration();
+ splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
+ splitterConfiguration.setConfigures(splitter);
+// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
+
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
+ splitterConfiguration.setJson(bean);
+
+ XMLSplitterPortBuilder.addPortsForOutput(element, splitter, splitterProcessor,
+ processorBinding);
+ }
+ } else {
+ throw new EditException(
+ "The activity type is not suitable for adding xml processing processors");
+ }
+ } catch (Exception e) {
+ throw new EditException(
+ "An error occured whilst tyring to add an XMLSplitter to the activity:"
+ + activity, e);
+ }
+
+ if (isInput) {
+ sourcePortName = "output";
+ sinkPortName = portName;
+ sinkProcessor = activityProcessor;
+ sourceProcessor = splitterProcessor;
+ } else {
+ sourcePortName = portName;
+ sinkPortName = "input";
+ sinkProcessor = splitterProcessor;
+ sourceProcessor = activityProcessor;
+ }
+
+ processorBinding.setBoundActivity(splitter);
+
+ List<Edit<?>> editList = new ArrayList<Edit<?>>();
+ editList.add(new AddChildEdit<Profile>(profile, splitter));
+ editList.add(new AddChildEdit<Profile>(profile, splitterConfiguration));
+ editList.add(new AddChildEdit<Profile>(profile, processorBinding));
+ editList.add(new AddProcessorEdit(workflow, splitterProcessor));
+
+ compoundEdit1 = new CompoundEdit(editList);
+ compoundEdit1.doEdit();
+
+ List<Edit<?>> linkUpEditList = new ArrayList<Edit<?>>();
+
+ OutputProcessorPort source = sourceProcessor.getOutputPorts().getByName(sourcePortName);
+ InputProcessorPort sink = sinkProcessor.getInputPorts().getByName(sinkPortName);
+
+ if (source == null)
+ throw new EditException("Unable to find the source port when linking up "
+ + sourcePortName + " to " + sinkPortName);
+ if (sink == null)
+ throw new EditException("Unable to find the sink port when linking up "
+ + sourcePortName + " to " + sinkPortName);
+
+ DataLink dataLink = new DataLink();
+ dataLink.setReceivesFrom(source);
+ dataLink.setSendsTo(sink);
+ linkUpEditList.add(new AddDataLinkEdit(workflow, dataLink));
+
+ linkUpEdit = new CompoundEdit(linkUpEditList);
+ linkUpEdit.doEdit();
+ applied = true;
+ return workflow;
+ }
+
+ @Override
+ public void undo() {
+ if (!applied) {
+ throw new RuntimeException("Attempt to undo edit that was never applied");
+ }
+ if (linkUpEdit.isApplied())
+ linkUpEdit.undo();
+ if (compoundEdit1.isApplied())
+ compoundEdit1.undo();
+ applied = false;
+ }
+
+ @Override
+ public boolean isApplied() {
+ return applied;
+ }
+
+ @Override
+ public Object getSubject() {
+ return workflow;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/WSDLActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/WSDLActivityConfigureAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/WSDLActivityConfigureAction.java
new file mode 100644
index 0000000..ddf6002
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/WSDLActivityConfigureAction.java
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.Action;
+import javax.swing.JDialog;
+
+import org.apache.taverna.activities.wsdl.views.WSDLActivityConfigurationView;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class WSDLActivityConfigureAction extends ActivityConfigurationAction {
+
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final CredentialManager credentialManager;
+
+ public WSDLActivityConfigureAction(Activity activity, Frame owner, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry, CredentialManager credentialManager) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.credentialManager = credentialManager;
+ putValue(Action.NAME, "Configure security");
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ JDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+ final ActivityConfigurationPanel rshellConfigView = new WSDLActivityConfigurationView(
+ getActivity(), credentialManager);
+ final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
+ rshellConfigView, editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/XMLSplitterPortBuilder.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/XMLSplitterPortBuilder.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/XMLSplitterPortBuilder.java
new file mode 100644
index 0000000..fe89b5f
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/XMLSplitterPortBuilder.java
@@ -0,0 +1,126 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import org.apache.taverna.wsdl.parser.ArrayTypeDescriptor;
+import org.apache.taverna.wsdl.parser.BaseTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
+
+import org.jdom.Element;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+
+/**
+ * A helper class to facilitate in building XMLSplitter ports
+ * from the type descriptor XML.
+ *
+ * @author Stuart Owen
+ * @author David Withers
+ */
+public class XMLSplitterPortBuilder {
+
+ public static void addPortsForInput(Element element, Activity activity, Processor processor,
+ ProcessorBinding binding) {
+ TypeDescriptor descriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
+ addOutputPort("output", 0, activity, processor, binding);
+
+ if (descriptor instanceof ComplexTypeDescriptor) {
+ for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getElements()) {
+ addInputPort(typeDescriptor.getName(), depthForDescriptor(typeDescriptor), activity, processor,
+ binding);
+ }
+ NamedSet<InputActivityPort> inputPorts = activity.getInputPorts();
+ for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getAttributes()) {
+ String name = typeDescriptor.getName();
+ if (inputPorts.containsName(name)) {
+ name = "1" + name;
+ }
+ addInputPort(name, depthForDescriptor(typeDescriptor), activity, processor, binding);
+ }
+ } else if (descriptor instanceof ArrayTypeDescriptor) {
+ addInputPort(descriptor.getName(), 1, activity, processor, binding);
+ }
+ }
+
+ public static void addPortsForOutput(Element element, Activity activity, Processor processor,
+ ProcessorBinding binding) {
+ TypeDescriptor descriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
+ addInputPort("input", 0, activity, processor, binding);
+
+ if (descriptor instanceof ComplexTypeDescriptor) {
+ for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getElements()) {
+ addOutputPort(typeDescriptor.getName(), depthForDescriptor(typeDescriptor), activity, processor,
+ binding);
+ }
+ NamedSet<OutputActivityPort> outputPorts = activity.getOutputPorts();
+ for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getAttributes()) {
+ String name = typeDescriptor.getName();
+ if (outputPorts.containsName(name)) {
+ name = "1" + name;
+ }
+ addOutputPort(name, depthForDescriptor(typeDescriptor), activity, processor, binding);
+ }
+ } else if (descriptor instanceof ArrayTypeDescriptor) {
+ addOutputPort(descriptor.getName(), 1, activity, processor, binding);
+ }
+ }
+
+ private static int depthForDescriptor(TypeDescriptor desc) {
+ if (desc instanceof ArrayTypeDescriptor
+ && (!((ArrayTypeDescriptor) desc).isWrapped() || ((ArrayTypeDescriptor) desc)
+ .getElementType() instanceof BaseTypeDescriptor)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ private static void addOutputPort(String name, int depth, Activity activity,
+ Processor processor, ProcessorBinding binding) {
+ OutputActivityPort activityPort = new OutputActivityPort(activity, name);
+ activityPort.setDepth(depth);
+ activityPort.setGranularDepth(depth);
+ OutputProcessorPort processorPort = new OutputProcessorPort(processor, name);
+ processorPort.setDepth(depth);
+ processorPort.setGranularDepth(depth);
+ new ProcessorOutputPortBinding(binding, activityPort, processorPort);
+ }
+
+ private static void addInputPort(String name, int depth, Activity activity,
+ Processor processor, ProcessorBinding binding) {
+ InputActivityPort activityPort = new InputActivityPort(activity, name);
+ activityPort.setDepth(depth);
+ InputProcessorPort processorPort = new InputProcessorPort(processor, name);
+ processorPort.setDepth(depth);
+ new ProcessorInputPortBinding(binding, processorPort, activityPort);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
new file mode 100644
index 0000000..60212b3
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+
+public class AddXMLInputSplitterForWSDLActivityMenuAction extends AddXMLInputSplitterMenuAction {
+
+ public AddXMLInputSplitterForWSDLActivityMenuAction() {
+ super(WSDLServiceDescription.ACTIVITY_TYPE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
new file mode 100644
index 0000000..8f3892f
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+
+public class AddXMLInputSplitterForXMLInputSplitterMenuAction extends AddXMLInputSplitterMenuAction {
+
+ public AddXMLInputSplitterForXMLInputSplitterMenuAction() {
+ super(WSDLServiceDescription.INPUT_SPLITTER_TYPE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
new file mode 100644
index 0000000..be6b4be
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
@@ -0,0 +1,85 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import javax.swing.Action;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jdom.JDOMException;
+import org.xml.sax.SAXException;
+
+import org.apache.taverna.activities.wsdl.actions.AbstractAddXMLSplitterAction;
+import org.apache.taverna.activities.wsdl.actions.AddXMLInputSplitterAction;
+import org.apache.taverna.ui.menu.ContextualMenuComponent;
+import org.apache.taverna.ui.menu.MenuComponent;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+
+/**
+ * @author alanrw
+ */
+public abstract class AddXMLInputSplitterMenuAction extends AbstractConfigureActivityMenuAction
+ implements MenuComponent, ContextualMenuComponent {
+
+ private static final String ADD_XML_INPUT_SPLITTER = "Add XML Input Splitter";
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddXMLInputSplitterMenuAction(URI activityType) {
+ super(activityType);
+ }
+
+ @Override
+ protected Action createAction() {
+ AddXMLInputSplitterAction configAction = new AddXMLInputSplitterAction(findActivity(),
+ null, editManager, selectionManager);
+ Map<String, TypeDescriptor> descriptors;
+ try {
+ descriptors = configAction.getTypeDescriptors();
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ return null;
+ }
+ if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
+ configAction.putValue(Action.NAME, ADD_XML_INPUT_SPLITTER);
+ addMenuDots(configAction);
+ return configAction;
+ } else {
+ return null;
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
new file mode 100644
index 0000000..ba92806
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+
+public class AddXMLOutputSplitterForWSDLActivityMenuAction extends AddXMLOutputSplitterMenuAction {
+
+ public AddXMLOutputSplitterForWSDLActivityMenuAction() {
+ super(WSDLServiceDescription.ACTIVITY_TYPE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
new file mode 100644
index 0000000..8ac883d
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+
+public class AddXMLOutputSplitterForXMLOutputSplitterMenuAction extends AddXMLOutputSplitterMenuAction {
+
+ public AddXMLOutputSplitterForXMLOutputSplitterMenuAction() {
+ super(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
new file mode 100644
index 0000000..6acaad7
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
@@ -0,0 +1,82 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import javax.swing.Action;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.taverna.activities.wsdl.actions.AbstractAddXMLSplitterAction;
+import org.apache.taverna.activities.wsdl.actions.AddXMLOutputSplitterAction;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+
+import org.jdom.JDOMException;
+import org.xml.sax.SAXException;
+
+/**
+ * @author alanrw
+ */
+public abstract class AddXMLOutputSplitterMenuAction extends AbstractConfigureActivityMenuAction {
+
+ private static final String ADD_XML_OUTPUT_SPLITTER = "Add XML Output Splitter";
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddXMLOutputSplitterMenuAction(URI activityType) {
+ super(activityType);
+ }
+
+ @Override
+ protected Action createAction() {
+ AddXMLOutputSplitterAction configAction = new AddXMLOutputSplitterAction(
+ findActivity(), null, editManager, selectionManager);
+ Map<String, TypeDescriptor> descriptors;
+ try {
+ descriptors = configAction.getTypeDescriptors();
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ return null;
+ }
+ if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
+ configAction.putValue(Action.NAME, ADD_XML_OUTPUT_SPLITTER);
+ addMenuDots(configAction);
+ return configAction;
+ } else {
+ return null;
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/ConfigureWSDLMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/ConfigureWSDLMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/ConfigureWSDLMenuAction.java
new file mode 100644
index 0000000..fd110f6
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/menu/ConfigureWSDLMenuAction.java
@@ -0,0 +1,77 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.menu;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.wsdl.actions.WSDLActivityConfigureAction;
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.ContextualMenuComponent;
+import org.apache.taverna.ui.menu.MenuComponent;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+public class ConfigureWSDLMenuAction extends AbstractConfigureActivityMenuAction implements
+ MenuComponent, ContextualMenuComponent {
+
+ private EditManager editManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private CredentialManager credentialManager;
+ private FileManager fileManager;
+
+ public ConfigureWSDLMenuAction() {
+ super(WSDLServiceDescription.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ WSDLActivityConfigureAction configAction = new WSDLActivityConfigureAction(findActivity(),
+ getParentFrame(), editManager, fileManager, activityIconManager,
+ serviceDescriptionRegistry, credentialManager);
+ addMenuDots(configAction);
+ return configAction;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setCredentialManager(CredentialManager credentialManager) {
+ this.credentialManager = credentialManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
new file mode 100644
index 0000000..0965f35
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
@@ -0,0 +1,302 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.MainWindow;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Dialog that lets user specify a URL of a WSDL service they want
+ * to add to the Service Panel. In the case the WSDL URL is behind
+ * HTTPS or service's endpoints require HTTPS it will ask user to confirm
+ * if they want to trust it.
+ *
+ * @author Alex Nenadic
+ *
+ */
+@SuppressWarnings("serial")
+public abstract class AddWSDLServiceDialog extends HelpEnabledDialog {
+
+ private JTextField wsdlLocationField;
+ private Logger logger = Logger.getLogger(AddWSDLServiceDialog.class);
+
+ public AddWSDLServiceDialog() {
+ super(MainWindow.getMainWindow(), "Add WSDL service", true, null); // create a non-modal dialog
+ initComponents();
+ setLocationRelativeTo(getParent());
+ }
+
+ private void initComponents() {
+ JPanel mainPanel = new JPanel(new GridBagLayout());
+ mainPanel.setBorder(new EmptyBorder(10,10,10,10));
+
+ JLabel wsdlLocatitionLabel = new JLabel("WSDL location",WSDLActivityIcon.getWSDLIcon(), JLabel.LEFT);
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.weighty = 0.0;
+
+ gbc.weightx = 0.0;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 0);
+ mainPanel.add(wsdlLocatitionLabel, gbc);
+
+ wsdlLocationField = new JTextField("http://somehost/service?wsdl");
+ gbc.weightx = 1.0;
+ gbc.gridx = 1;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 5);
+ mainPanel.add(wsdlLocationField, gbc);
+
+ final JButton addServiceButton = new JButton("Add");
+ addServiceButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ addPressed();
+ }
+ });
+
+ // When user presses "Return" key fire the action on the "Add" button
+ addServiceButton.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyPressed(java.awt.event.KeyEvent evt) {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
+ addPressed();
+ }
+ }
+ });
+ getRootPane().setDefaultButton(addServiceButton);
+
+ JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ buttonsPanel.add(addServiceButton);
+
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(mainPanel, BorderLayout.CENTER);
+ getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
+
+ setSize(getPreferredSize());
+ pack();
+ }
+
+ /**
+ * 'Add service' button pressed or otherwise activated.
+ */
+ private void addPressed()
+ {
+ final String wsdlURLString = wsdlLocationField.getText().trim();
+ new Thread("Adding WSDL " + wsdlURLString) {
+ public void run() {
+ // Only add the service provider for this service if service URL
+ // starts with 'http'
+ // or if it starts with 'https' and user explicitly said they
+ // wanted to trust this service.
+ /*
+ * if (shouldTrust(wsdlURLString)){ addRegistry(wsdlURLString);
+ * }
+ */
+ try {
+ URL url = new URL(wsdlURLString);
+ URLConnection connection = url.openConnection();
+ try {
+ // If the url starts with 'https' - security hook for
+ // https connection's trust manager
+ // will be engaged and user will be asked automatically
+ // if they want
+ // to trust the connection (if it is not already
+ // trusted). If the urls starts with 'http' -
+ // this will not have any effect apart from checking if
+ // we can open a connection.
+ connection.connect(); // if this does not fail - add the
+ // WSDL
+ // service provider for this service to
+ // the registry
+ } finally {
+ try {
+ connection.getInputStream().close();
+ } catch (IOException ex) {
+ }
+ }
+ addRegistry(wsdlURLString);
+ } catch (Exception ex) { // anything failed
+ JOptionPane.showMessageDialog(null,
+ "Could not read the WSDL definition from "
+ + wsdlURLString + ":\n" + ex,
+ "Could not add WSDL service",
+ JOptionPane.ERROR_MESSAGE);
+
+ logger.error(
+ "Failed to add WSDL service provider for service: "
+ + wsdlURLString, ex);
+
+ }
+ };
+ }.start();
+ closeDialog();
+ }
+
+ /**
+ * If WSDL service's URL starts with 'https' - asks user
+ * whether to trust it or not. If it starts with 'http' -
+ * does not ask anything as the service is implicitly trusted (weird but true).
+ */
+ protected abstract void addRegistry(String wsdl);
+
+ /**
+ * Checks if a service is trusted and if not - asks user if they want to trust it.
+ */
+// public boolean shouldTrust(String wsdlURLString){
+// try {
+// URI wsdlURI = new URI(wsdlURLString);
+// URL wsdlURL = wsdlURI.toURL();
+// String protocol = wsdlURL.getProtocol();
+// if (protocol.toLowerCase().startsWith("https")){
+// logger.info("Checking if service " + wsdlURLString + " is already trusted.");
+// // Check if opening an HTTPS connection will cause a SSLHandshakeException.
+// // This is most probably due to the fact that we do not have this service's
+// // certificate in Credential Manager's truststore
+// try {
+// HttpsURLConnection httpsConnection;
+// httpsConnection = (HttpsURLConnection) wsdlURL.openConnection();
+// httpsConnection.connect();
+// logger.info("HTTPS works out of the box for service " + wsdlURLString);
+// return true; // Opening HTTPS connection worked - so we trust this service already
+// }
+// catch (SSLException sslex) { // most probably due to the fact that service is not trusted, i.e. its certificate is not in Credential Manager's Truststore
+// logger.info("Service " + wsdlURLString + " is not trusted out of the box. Trying to fetch its certificate.");
+// logger.info("The SSLException was caused by: " + sslex.getCause());
+// // Handshake most probably failed as we do not already trust this service -
+// // fetch its certificate and ask user if they want to add this service as trusted
+// try {
+//
+// // This controls SSL socket creation for HTTPS connections
+// // per thread so the damage of switching off certificates
+// // verification is limited
+// ThreadLocalSSLSocketFactory.install();
+// // switch certificate checking off for a moment so we can fetch
+// // service's certificate
+// ThreadLocalSSLSocketFactory.startTrustingEverything();
+//
+// HttpsURLConnection httpsConnection;
+// httpsConnection = (HttpsURLConnection) wsdlURL
+// .openConnection();
+// httpsConnection.connect();
+// // Stop being overly trusting
+// ThreadLocalSSLSocketFactory.stopTrustingEverything();
+// Certificate[] certificates = httpsConnection
+// .getServerCertificates();
+// logger.info("Need to ask user if they want to trust service " + wsdlURLString);
+// // Ask user if they want to trust this service
+// ConfirmTrustedCertificateDialog confirmCertTrustDialog = new ConfirmTrustedCertificateDialog(
+// this, "Untrusted HTTPS connection", true,
+// (X509Certificate) certificates[0]);
+// confirmCertTrustDialog.setLocationRelativeTo(null);
+// confirmCertTrustDialog.setVisible(true);
+// boolean shouldTrust = confirmCertTrustDialog
+// .shouldTrust();
+// if (shouldTrust) {
+// try {
+// CredentialManager credManager = CredentialManager
+// .getInstance();
+// credManager
+// .saveTrustedCertificate((X509Certificate) certificates[0]);
+// return true;
+// } catch (CMException cme) {
+// logger
+// .error(
+// "Failed to add WSDL service provider for service: "
+// + wsdlURLString
+// + " . Credential Manager failed to "
+// + "save trusted certificate.",
+// cme);
+// return false;
+// }
+// } else {
+// // Do not even add a WSDL service provider for this
+// // service and tell user the service will not be
+// // added to Service Panel
+// JOptionPane
+// .showMessageDialog(
+// this,
+// "As you refused to trust it, the service will not be added to Service Panel.",
+// "Add WSDL service",
+// JOptionPane.INFORMATION_MESSAGE);
+// return false;
+// }
+// } catch (Exception e1) {
+// logger
+// .error(
+// "Failed to add WSDL service provider for service: "
+// + wsdlURLString
+// + ". 'Trust everyone' HTTPS connection failed.",
+// e1);
+// return false;
+// } finally {// switch it off here as well if some unexpected exception occurred
+// ThreadLocalSSLSocketFactory.stopTrustingEverything();
+// }
+//
+// } catch (Exception e2) {
+// logger.error("Failed to add WSDL service provider for service: "+ wsdlURLString+". Connecting to service failed.", e2);
+// return false;
+// }
+// }
+// else{ // protocol starts with 'http'
+// return true;
+// }
+// } catch (MalformedURLException e3) {
+// logger.error("Failed to add WSDL service provider: URL "+ wsdlURLString+" was malformed.", e3);
+// return false;
+// } catch (URISyntaxException e4) {
+// logger.error("Failed to add WSDL service provider: URI "+ wsdlURLString+" could not be parsed.", e4);
+// return false;
+// }
+// }
+
+ /**
+ * Closes the dialog.
+ */
+ private void closeDialog() {
+ setVisible(false);
+ dispose();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
new file mode 100644
index 0000000..62c620a
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
@@ -0,0 +1,585 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.math.BigInteger;
+import java.util.HashMap;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.JSeparator;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+import javax.security.auth.x500.X500Principal;
+
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CMUtils;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+import org.bouncycastle.asn1.ASN1OctetString;
+import org.bouncycastle.asn1.DERBitString;
+import org.bouncycastle.asn1.DEROctetString;
+import org.bouncycastle.asn1.misc.NetscapeCertType;
+
+/**
+ * Displays the details of a X.509 certificate and asks user if they want to
+ * trust it.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class ConfirmTrustedCertificateDialog extends HelpEnabledDialog {
+
+ private static Logger logger = Logger.getLogger(ConfirmTrustedCertificateDialog.class);
+
+ // Stores certificate to display
+ private X509Certificate cert;
+
+ // Stores user's decision as whether to trust this service's certificaet or not.
+ private boolean shouldTrust;
+
+ /**
+ * Creates new ConfirmTrustedCertificateDialog where parent is a Frame.
+ */
+ public ConfirmTrustedCertificateDialog(Frame parent, String title,
+ boolean modal, X509Certificate crt)
+ throws CMException {
+ super(parent, title, modal, null);
+ this.cert = crt;
+ initComponents();
+ }
+
+ /**
+ * Creates new ConfirmTrustedCertificateDialog where parent is a Dialog.
+ */
+ public ConfirmTrustedCertificateDialog(Dialog parent, String title,
+ boolean modal, X509Certificate crt)
+ throws CMException {
+ super(parent, title, modal, null);
+ this.cert = crt;
+ initComponents();
+ }
+
+ /**
+ * Initialise the dialog's GUI components.
+ */
+ private void initComponents(){
+
+ // title panel
+ JPanel titlePanel = new JPanel(new BorderLayout());
+ titlePanel.setBackground(Color.WHITE);
+ JLabel titleLabel = new JLabel("View service's certificate");
+ titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
+ titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
+ DialogTextArea titleMessage = new DialogTextArea("This service requires HTTPS connection and has identified itself with the certificate below.\n" +
+ "Do you want to trust this service? (Refusing to trust means you will not be able to invoke it from a workflow.)");
+ titleMessage.setMargin(new Insets(5, 20, 10, 10));
+ titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
+ titleMessage.setEditable(false);
+ titleMessage.setFocusable(false);
+ titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10));
+ titlePanel.add(titleLabel, BorderLayout.NORTH);
+ titlePanel.add(titleMessage, BorderLayout.CENTER);
+
+ // Certificate details:
+
+ // Grid Bag Constraints templates for labels (column 1) and
+ // values (column 2) of certificate details
+ GridBagConstraints gbcLabel = new GridBagConstraints();
+ gbcLabel.gridx = 0;
+ gbcLabel.ipadx = 20;
+ gbcLabel.gridwidth = 1;
+ gbcLabel.gridheight = 1;
+ gbcLabel.insets = new Insets(2, 15, 2, 2);
+ gbcLabel.anchor = GridBagConstraints.LINE_START;
+
+ GridBagConstraints gbcValue = new GridBagConstraints();
+ gbcValue.gridx = 1;
+ gbcValue.gridwidth = 1;
+ gbcValue.gridheight = 1;
+ gbcValue.insets = new Insets(2, 5, 2, 2);
+ gbcValue.anchor = GridBagConstraints.LINE_START;
+
+ // Netscape Certificate Type non-critical extension (if any)
+ // defines the intended uses of the certificate - to make it look like
+ // firefox's view certificate dialog
+ byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); // Netscape Certificate Type OID
+ JLabel jlIntendedUses = null;
+ JTextField jtfIntendedUsesValue = null;
+ JPanel jpUses = null;
+ GridBagConstraints gbc_jpUses = null;
+ if (intendedUses != null) {
+ jlIntendedUses = new JLabel(
+ "This certificate has been approved for the following uses:");
+ jlIntendedUses.setFont(new Font(null, Font.BOLD, 11));
+ jlIntendedUses.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ jtfIntendedUsesValue = new JTextField(45);
+ jtfIntendedUsesValue.setText(getIntendedUses(intendedUses));
+ jtfIntendedUsesValue.setEditable(false);
+ jtfIntendedUsesValue.setFont(new Font(null, Font.PLAIN, 11));
+
+ jpUses = new JPanel(new BorderLayout());
+ jpUses.add(jlIntendedUses, BorderLayout.NORTH);
+ jpUses.add(jtfIntendedUsesValue, BorderLayout.CENTER);
+ JSeparator jsp = new JSeparator(JSeparator.HORIZONTAL);
+ jpUses.add(jsp, BorderLayout.SOUTH);
+
+ gbc_jpUses = (GridBagConstraints) gbcLabel.clone();
+ gbc_jpUses.gridy = 0;
+ gbc_jpUses.gridwidth = 2; // takes two columns
+ gbc_jpUses.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+ }
+
+ // Issued To
+ JLabel jlIssuedTo = new JLabel("Issued To");
+ jlIssuedTo.setFont(new Font(null, Font.BOLD, 11));
+ GridBagConstraints gbc_jlIssuedTo = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlIssuedTo.gridy = 1;
+ gbc_jlIssuedTo.gridwidth = 2; // takes two columns
+ gbc_jlIssuedTo.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+ // Distinguished Name (DN)
+ String sDN = cert.getSubjectX500Principal().getName(
+ X500Principal.RFC2253);
+ CMUtils util = new CMUtils();
+ util.parseDN(sDN);
+ // Extract the CN, O, OU and EMAILADDRESS fields
+ String sCN = util.getCN();
+ String sOrg = util.getO();
+ String sOU = util.getOU();
+ // String sEMAILADDRESS = CMX509Util.getEmilAddress();
+ // Common Name (CN)
+ JLabel jlCN = new JLabel("Common Name (CN)");
+ jlCN.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlCN = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlCN.gridy = 2;
+ JLabel jlCNValue = new JLabel(sCN);
+ jlCNValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlCNValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlCNValue.gridy = 2;
+ // Organisation (O)
+ JLabel jlOrg = new JLabel("Organisation (O)");
+ jlOrg.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlOrg = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlOrg.gridy = 3;
+ JLabel jlOrgValue = new JLabel(sOrg);
+ jlOrgValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlOrgValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlOrgValue.gridy = 3;
+ // Organisation Unit (OU)
+ JLabel jlOU = new JLabel("Organisation Unit (OU)");
+ jlOU.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlOU = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlOU.gridy = 4;
+ JLabel jlOUValue = new JLabel(sOU);
+ jlOUValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlOUValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlOUValue.gridy = 4;
+ // E-mail Address
+ // JLabel jlEmail = new JLabel("E-mail Address");
+ // jlEmail.setFont(new Font(null, Font.PLAIN, 11));
+ // GridBagConstraints gbc_jlEmail = (GridBagConstraints)
+ // gbcLabel.clone();
+ // gbc_jlEmail.gridy = 5;
+ // JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
+ // jlEmailValue.setFont(new Font(null, Font.PLAIN, 11));
+ // GridBagConstraints gbc_jlEmailValue = (GridBagConstraints)
+ // gbcValue.clone();
+ // gbc_jlEmailValue.gridy = 5;
+ // Serial Number
+ JLabel jlSN = new JLabel("Serial Number");
+ jlSN.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlSN = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlSN.gridy = 6;
+ JLabel jlSNValue = new JLabel();
+ // Get the hexadecimal serial number
+ StringBuffer strBuff = new StringBuffer(new BigInteger(1, cert
+ .getSerialNumber().toByteArray()).toString(16).toUpperCase());
+ // Place colons at every two hexadecimal characters
+ if (strBuff.length() > 2) {
+ for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3) {
+ strBuff.insert(iCnt, ':');
+ }
+ }
+ jlSNValue.setText(strBuff.toString());
+ jlSNValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlSNValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlSNValue.gridy = 6;
+ // Version
+ JLabel jlVersion = new JLabel("Version");
+ jlVersion.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlVersion.gridy = 7;
+ JLabel jlVersionValue = new JLabel(Integer.toString(cert.getVersion()));
+ jlVersionValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlVersionValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlVersionValue.gridy = 7;
+
+ // Issued By
+ JLabel jlIssuedBy = new JLabel("Issued By");
+ jlIssuedBy.setFont(new Font(null, Font.BOLD, 11));
+ GridBagConstraints gbc_jlIssuedBy = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlIssuedBy.gridy = 8;
+ gbc_jlIssuedBy.gridwidth = 2; // takes two columns
+ gbc_jlIssuedBy.insets = new Insets(5, 5, 5, 5);// has slightly bigger
+ // insets
+ // Distinguished Name (DN)
+ String iDN = cert.getIssuerX500Principal().getName(
+ X500Principal.RFC2253);
+ util.parseDN(iDN);
+ // Extract the CN, O and OU fields
+ String iCN = util.getCN();
+ String iOrg = util.getO();
+ String iOU = util.getOU();
+ // Common Name (CN)
+ JLabel jlICN = new JLabel("Common Name (CN)");
+ jlICN.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlICN = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlICN.gridy = 9;
+ JLabel jlICNValue = new JLabel(iCN);
+ jlICNValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlICNValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlICNValue.gridy = 9;
+ // Organisation (O)
+ JLabel jlIOrg = new JLabel("Organisation (O)");
+ jlIOrg.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIOrg = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlIOrg.gridy = 10;
+ JLabel jlIOrgValue = new JLabel(iOrg);
+ jlIOrgValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIOrgValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlIOrgValue.gridy = 10;
+ // Organisation Unit (OU)
+ JLabel jlIOU = new JLabel("Organisation Unit (OU)");
+ jlIOU.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIOU = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlIOU.gridy = 11;
+ JLabel jlIOUValue = new JLabel(iOU);
+ jlIOUValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIOUValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlIOUValue.gridy = 11;
+ // Validity
+ JLabel jlValidity = new JLabel("Validity");
+ jlValidity.setFont(new Font(null, Font.BOLD, 11));
+ GridBagConstraints gbc_jlValidity = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlValidity.gridy = 12;
+ gbc_jlValidity.gridwidth = 2; // takes two columns
+ gbc_jlValidity.insets = new Insets(5, 5, 5, 5);// has slightly bigger
+ // insets
+ // Issued On
+ JLabel jlIssuedOn = new JLabel("Issued On");
+ jlIssuedOn.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIssuedOn = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlIssuedOn.gridy = 13;
+ JLabel jlIssuedOnValue = new JLabel(cert.getNotBefore().toString());
+ jlIssuedOnValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlIssuedOnValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlIssuedOnValue.gridy = 13;
+ // Expires On
+ JLabel jlExpiresOn = new JLabel("Expires On");
+ jlExpiresOn.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlExpiresOn = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlExpiresOn.gridy = 14;
+ JLabel jlExpiresOnValue = new JLabel(cert.getNotAfter().toString());
+ jlExpiresOnValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlExpiresOnValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlExpiresOnValue.gridy = 14;
+
+ // Fingerprints
+ byte[] bCert = new byte[0];
+ try {
+ bCert = cert.getEncoded();
+ } catch (CertificateEncodingException ex) {
+ logger.error("Could not get the encoded form of the certificate.", ex);
+ }
+ JLabel jlFingerprints = new JLabel("Fingerprints");
+ jlFingerprints.setFont(new Font(null, Font.BOLD, 11));
+ GridBagConstraints gbc_jlFingerprints = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlFingerprints.gridy = 15;
+ gbc_jlFingerprints.gridwidth = 2; // takes two columns
+ gbc_jlFingerprints.insets = new Insets(5, 5, 5, 5);// has slightly
+ // bigger insets
+ // SHA-1 Fingerprint
+ JLabel jlSHA1Fingerprint = new JLabel("SHA1 Fingerprint");
+ jlSHA1Fingerprint.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlSHA1Fingerprint = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlSHA1Fingerprint.gridy = 16;
+ JLabel jlSHA1FingerprintValue = new JLabel(getMessageDigest(bCert,
+ "SHA1"));
+ jlSHA1FingerprintValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlSHA1FingerprintValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlSHA1FingerprintValue.gridy = 16;
+ // MD5 Fingerprint
+ JLabel jlMD5Fingerprint = new JLabel("MD5 Fingerprint");
+ jlMD5Fingerprint.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlMD5Fingerprint = (GridBagConstraints) gbcLabel
+ .clone();
+ gbc_jlMD5Fingerprint.gridy = 17;
+ JLabel jlMD5FingerprintValue = new JLabel(
+ getMessageDigest(bCert, "MD5"));
+ jlMD5FingerprintValue.setFont(new Font(null, Font.PLAIN, 11));
+ GridBagConstraints gbc_jlMD5FingerprintValue = (GridBagConstraints) gbcValue
+ .clone();
+ gbc_jlMD5FingerprintValue.gridy = 17;
+
+ // Empty label to add a bit space at the bottom of the panel
+ // to make it look like firefox's view certificate dialog
+ JLabel jlEmpty = new JLabel("");
+ GridBagConstraints gbc_jlEmpty = (GridBagConstraints) gbcLabel.clone();
+ gbc_jlEmpty.gridy = 18;
+ gbc_jlEmpty.gridwidth = 2; // takes two columns
+ gbc_jlEmpty.ipady = 40;
+
+ JPanel jpCertificate = new JPanel(new GridBagLayout());
+ jpCertificate.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
+ 15), new EtchedBorder()));
+
+ if (intendedUses != null) {
+ jpCertificate.add(jpUses, gbc_jpUses);
+ }
+ jpCertificate.add(jlIssuedTo, gbc_jlIssuedTo); // Issued To
+ jpCertificate.add(jlCN, gbc_jlCN);
+ jpCertificate.add(jlCNValue, gbc_jlCNValue);
+ jpCertificate.add(jlOrg, gbc_jlOrg);
+ jpCertificate.add(jlOrgValue, gbc_jlOrgValue);
+ jpCertificate.add(jlOU, gbc_jlOU);
+ jpCertificate.add(jlOUValue, gbc_jlOUValue);
+ // jpCertificate.add(jlEmail, gbc_jlEmail);
+ // jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
+ jpCertificate.add(jlSN, gbc_jlSN);
+ jpCertificate.add(jlSNValue, gbc_jlSNValue);
+ jpCertificate.add(jlVersion, gbc_jlVersion);
+ jpCertificate.add(jlVersionValue, gbc_jlVersionValue);
+ jpCertificate.add(jlIssuedBy, gbc_jlIssuedBy); // Issued By
+ jpCertificate.add(jlICN, gbc_jlICN);
+ jpCertificate.add(jlICNValue, gbc_jlICNValue);
+ jpCertificate.add(jlIOrg, gbc_jlIOrg);
+ jpCertificate.add(jlIOrgValue, gbc_jlIOrgValue);
+ jpCertificate.add(jlIOU, gbc_jlIOU);
+ jpCertificate.add(jlIOUValue, gbc_jlIOUValue);
+ jpCertificate.add(jlValidity, gbc_jlValidity); // Validity
+ jpCertificate.add(jlIssuedOn, gbc_jlIssuedOn);
+ jpCertificate.add(jlIssuedOnValue, gbc_jlIssuedOnValue);
+ jpCertificate.add(jlExpiresOn, gbc_jlExpiresOn);
+ jpCertificate.add(jlExpiresOnValue, gbc_jlExpiresOnValue);
+ jpCertificate.add(jlFingerprints, gbc_jlFingerprints); // Fingerprints
+ jpCertificate.add(jlSHA1Fingerprint, gbc_jlSHA1Fingerprint);
+ jpCertificate.add(jlSHA1FingerprintValue, gbc_jlSHA1FingerprintValue);
+ jpCertificate.add(jlMD5Fingerprint, gbc_jlMD5Fingerprint);
+ jpCertificate.add(jlMD5FingerprintValue, gbc_jlMD5FingerprintValue);
+ jpCertificate.add(jlEmpty, gbc_jlEmpty); // Empty label to get some vertical space on the frame
+
+ // OK button
+ JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
+
+ final JButton jbTrust = new JButton("Trust");
+ jbTrust.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ trustPressed();
+ }
+ });
+ final JButton jbDontTrust = new JButton("Do not trust");
+ jbDontTrust.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ dontTrustPressed();
+ }
+ });
+
+ jpButtons.add(jbTrust);
+ jpButtons.add(jbDontTrust);
+
+ // Put it all together
+ getContentPane().add(titlePanel, BorderLayout.NORTH);
+ getContentPane().add(jpCertificate, BorderLayout.CENTER);
+ getContentPane().add(jpButtons, BorderLayout.SOUTH);
+
+ // Resizing wreaks havoc
+ setResizable(false);
+
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent evt) {
+ closeDialog();
+ }
+ });
+
+ getRootPane().setDefaultButton(jbTrust);
+
+ pack();
+ }
+
+ /**
+ * Get the digest of a message as a formatted String.
+ *
+ * @param bMessage
+ * The message to digest
+ * @param digestType
+ * The message digest algorithm
+ * @return The message digest
+ */
+ public static String getMessageDigest(byte[] bMessage, String digestType) {
+ // Create message digest object using the supplied algorithm
+ MessageDigest messageDigest;
+ try {
+ messageDigest = MessageDigest.getInstance(digestType);
+ } catch (NoSuchAlgorithmException ex) {
+ logger.error("Failed to create message digest.", ex);
+ return "";
+ }
+
+ // Create raw message digest
+ byte[] bFingerPrint = messageDigest.digest(bMessage);
+
+ // Place the raw message digest into a StringBuffer as a Hex number
+ StringBuffer strBuff = new StringBuffer(new BigInteger(1, bFingerPrint)
+ .toString(16).toUpperCase());
+
+ // Odd number of characters so add in a padding "0"
+ if ((strBuff.length() % 2) != 0) {
+ strBuff.insert(0, '0');
+ }
+
+ // Place colons at every two hex characters
+ if (strBuff.length() > 2) {
+ for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3) {
+ strBuff.insert(iCnt, ':');
+ }
+ }
+
+ // Return the formatted message digest
+ return strBuff.toString();
+ }
+
+ /**
+ * Gets the intended certificate uses, i.e. Netscape Certificate Type
+ * extension (2.16.840.1.113730.1.1) value as a string
+ *
+ * @param value
+ * Extension value as a DER-encoded OCTET string
+ * @return Extension value as a string
+ */
+ private String getIntendedUses(byte[] value) {
+
+ // Netscape Certificate Types (2.16.840.1.113730.1.1)
+ int[] INTENDED_USES = new int[] { NetscapeCertType.sslClient,
+ NetscapeCertType.sslServer, NetscapeCertType.smime,
+ NetscapeCertType.objectSigning, NetscapeCertType.reserved,
+ NetscapeCertType.sslCA, NetscapeCertType.smimeCA,
+ NetscapeCertType.objectSigningCA, };
+
+ // Netscape Certificate Type strings (2.16.840.1.113730.1.1)
+ HashMap<String, String> INTENDED_USES_STRINGS = new HashMap<String, String>();
+ INTENDED_USES_STRINGS.put("128", "SSL Client");
+ INTENDED_USES_STRINGS.put("64", "SSL Server");
+ INTENDED_USES_STRINGS.put("32", "S/MIME");
+ INTENDED_USES_STRINGS.put("16", "Object Signing");
+ INTENDED_USES_STRINGS.put("8", "Reserved");
+ INTENDED_USES_STRINGS.put("4", "SSL CA");
+ INTENDED_USES_STRINGS.put("2", "S/MIME CA");
+ INTENDED_USES_STRINGS.put("1", "Object Signing CA");
+
+ // Get octet string from extension value
+ ASN1OctetString fromByteArray = new DEROctetString(value);
+ byte[] octets = fromByteArray.getOctets();
+ DERBitString fromByteArray2 = new DERBitString(octets);
+ int val = new NetscapeCertType(fromByteArray2).intValue();
+ StringBuffer strBuff = new StringBuffer();
+ for (int i = 0, len = INTENDED_USES.length; i < len; i++) {
+ int use = INTENDED_USES[i];
+ if ((val & use) == use) {
+ strBuff.append(INTENDED_USES_STRINGS.get(String.valueOf(use))
+ + ", \n");
+ }
+ }
+ // remove the last ", \n" from the end of the buffer
+ String str = strBuff.toString();
+ str = str.substring(0, str.length() - 3);
+ return str;
+ }
+
+ /**
+ * 'Trust' button pressed.
+ */
+ private void trustPressed() {
+ shouldTrust = true;
+ closeDialog();
+ }
+
+ /**
+ * 'Do not trust' button pressed.
+ */
+ private void dontTrustPressed() {
+ shouldTrust = false;
+ closeDialog();
+ }
+
+ /**
+ * Closes the dialog.
+ */
+ public void closeDialog() {
+ setVisible(false);
+ dispose();
+ }
+
+ public boolean shouldTrust() {
+ return shouldTrust;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
new file mode 100644
index 0000000..7994e55
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ *
+ */
+public class WSDLActivityIcon implements ActivityIconSPI {
+
+ private static Icon icon;
+
+ public int canProvideIconScore(URI activityType) {
+ if (activityType.equals(WSDLServiceDescription.ACTIVITY_TYPE))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getWSDLIcon();
+ }
+
+ public static Icon getWSDLIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(WSDLActivityIcon.class.getResource("/wsdl.png"));
+ }
+ return icon;
+ }
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceDescription.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
new file mode 100644
index 0000000..8b6af7f
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
@@ -0,0 +1,153 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class WSDLServiceDescription extends ServiceDescription {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/wsdl");
+ public static final URI INPUT_SPLITTER_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
+ public static final URI OUTPUT_SPLITTER_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
+
+ private static final String WSDL = "WSDL @ ";
+
+ private String use;
+ private URI uri;
+ private String style;
+ private String operation;
+ private final CredentialManager credentialManager;
+
+ private static Logger logger = Logger.getLogger(WSDLServiceDescription.class);
+
+ public WSDLServiceDescription(CredentialManager credentialManager) {
+ this.credentialManager = credentialManager;
+ }
+
+ public String getUse() {
+ return use;
+ }
+
+ public void setUse(String use) {
+ this.use = use;
+ }
+
+ public URI getURI() {
+ return uri;
+ }
+
+ public void setURI(URI url) {
+ this.uri = url;
+ }
+
+ public String getStyle() {
+ return style;
+ }
+
+ public void setStyle(String style) {
+ this.style = style;
+ }
+
+ public String getType() {
+ return "WSDL";
+ }
+
+ @Override
+ public String toString() {
+ return operation;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public Icon getIcon() {
+ return WSDLActivityIcon.getWSDLIcon();
+ }
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ ObjectNode json = (ObjectNode) configuration.getJson();
+ ObjectNode operation = json.objectNode();
+ json.put("operation", operation);
+ operation.put("wsdl", getURI().toString());
+ operation.put("name", getOperation());
+ return configuration;
+ }
+
+ public String getName() {
+ return getOperation();
+ }
+
+ public List<? extends Comparable<?>> getPath() {
+ return Collections.singletonList(WSDL + getURI());
+ }
+
+ protected List<Object> getIdentifyingData() {
+ return Arrays.<Object> asList(getURI(), getOperation());
+ }
+
+ @Override
+ public boolean isTemplateService() {
+ return needsSecurity();
+ }
+
+ protected boolean needsSecurity() {
+ if (credentialManager == null) {
+ // We don't know if it needs security or not
+ return false;
+ }
+ // A match is a good indicator that security configuration is needed
+ try {
+ return credentialManager.hasUsernamePasswordForService(getURI());
+ } catch (CMException e) {
+ logger.warn("Could not check if credential manager has username/password for " + getURI(), e);
+ return false;
+ }
+ }
+
+
+}
[12/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
deleted file mode 100644
index ff11dbe..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
+++ /dev/null
@@ -1,106 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-
-public class ExampleServiceProvider extends AbstractConfigurableServiceProvider<ExampleServiceProviderConfig>
- implements ConfigurableServiceProvider<ExampleServiceProviderConfig>
-{
- public ExampleServiceProvider()
- {
- super(new ExampleServiceProviderConfig());
- }
-
- /**
- * Do the actual search for services. Return using the callBack parameter.
- */
- @SuppressWarnings("unchecked")
- public void findServiceDescriptionsAsync(
- FindServiceDescriptionsCallBack callBack) {
- // Use callback.status() for long-running searches
- // callBack.status("Resolving example services");
-
- List<ServiceDescription> results = new ArrayList<ServiceDescription>();
-
- // FIXME: Implement the actual service search/lookup instead
- // of dummy for-loop
- for (int i = 1; i <= getConfiguration().getNumberOfServices(); i++) {
- ExampleServiceDesc service = new ExampleServiceDesc();
- // Populate the service description bean
- service.setExampleString("Example " + i);
- service.setExampleUri(getConfiguration().getUri());
-
- // Optional: set description
- service.setDescription("Service example number " + i);
- results.add(service);
- }
-
- // partialResults() can also be called several times from inside
- // for-loop if the full search takes a long time
- callBack.partialResults(results);
-
- // No more results will be coming
- callBack.finished();
- }
-
-
-// @Override
-// /**
-// * This allows to have a few configured service providers in the Service Panel at startup;
-// * useful if there are some prototypical ones that are useful + need to allow users to add their own
-// * through manual config.
-// */
-// public List<ExampleServiceProviderConfig> getDefaultConfigurations() {
-// ExampleServiceProviderConfig a = new ExampleServiceProviderConfig();
-// a.setUri(URI.create("http://localhost:8181/serviceA"));
-// ExampleServiceProviderConfig b = new ExampleServiceProviderConfig();
-// b.setUri(URI.create("http://fish.com/serviceB"));
-// b.setNumberOfServices(2);
-// return Arrays.asList(a, b);
-// }
-
-
-
- /**
- * Icon for service provider
- */
- public Icon getIcon() {
- return null;
- }
-
-
- /**
- * Appears in "Import new services..." in Service Panel
- */
- public String getName() {
- return "My example service";
- }
-
- @Override
- /**
- * Name of service provider, appears in right click for 'Remove service
- * provider'
- */
- public String toString() {
- return getName() + " " + getConfiguration().getUri();
- }
-
- @Override
- protected List<? extends Object> getIdentifyingData() {
- return Arrays.asList(getConfiguration().getUri());
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
deleted file mode 100644
index 22d8546..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
-import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
-
-public class ExampleServiceProviderConfig extends PropertyAnnotated
-{
- private URI uri = URI.create("http://www.example.com");
- private int numberOfServices = 5;
-
- @PropertyAnnotation(displayName="Provider URI", preferred=true)
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
- @PropertyAnnotation(displayName="Number of services")
- public int getNumberOfServices() {
- return numberOfServices;
- }
-
- public void setNumberOfServices(int numberOfServices) {
- this.numberOfServices = numberOfServices;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
deleted file mode 100644
index 3a55ea2..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.view;
-
-import javax.swing.Action;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-import net.sf.taverna.t2.activities.rest.ui.config.RESTActivityConfigureAction;
-import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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;
-
-/**
- * This action is responsible for enabling the contextual menu entry on processors that perform
- * RESTActivity'ies.
- * NB! As a side-effect this also enables the pop-up with for configuration of the processor when it
- * is added to the workflow from the Service Panel.
- *
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class ConfigureRESTActivityMenuAction extends AbstractConfigureActivityMenuAction {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public ConfigureRESTActivityMenuAction() {
- super(GenericRESTTemplateService.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- RESTActivityConfigureAction configAction = new RESTActivityConfigureAction(findActivity(),
- getParentFrame(), editManager, fileManager, activityIconManager,
- serviceDescriptionRegistry, serviceRegistry);
- configAction.putValue(Action.NAME, "Configure REST service");
- addMenuDots(configAction);
- return configAction;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
deleted file mode 100644
index 5213131..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.view;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-public class RESTActivityMainContextViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public boolean canHandle(Object selection) {
- return selection instanceof Activity
- && ((Activity) selection).getType()
- .equals(GenericRESTTemplateService.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity selection) {
- return Arrays.<ContextualView> asList(new RESTActivityMainContextualView(selection,
- editManager, fileManager, activityIconManager, colourManager,
- serviceDescriptionRegistry, serviceRegistry));
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
deleted file mode 100644
index fe0e409..0000000
--- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package net.sf.taverna.t2.activities.rest.ui.view;
-
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-
-import javax.swing.Action;
-import javax.swing.BorderFactory;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import net.sf.taverna.t2.activities.rest.RESTActivity;
-import net.sf.taverna.t2.activities.rest.RESTActivity.HTTP_METHOD;
-import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
-import net.sf.taverna.t2.activities.rest.ui.config.RESTActivityConfigureAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-@SuppressWarnings("serial")
-public class RESTActivityMainContextualView extends ContextualView {
-
- private final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- private final Activity activity;
-
- private JPanel jpMainPanel;
- private JTextField tfHTTPMethod;
- private JTextArea taURLSignature;
- private JTextField tfAcceptHeader;
- private JLabel jlContentType;
- private JTextField tfContentTypeHeader;
- private JLabel jlSendDataAs;
- private JTextField tfSendDataAs;
- private JLabel jlSendHTTPExpectRequestHeader;
- private JTextField tfSendHTTPExpectRequestHeader;
-
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ActivityIconManager activityIconManager;
- private final ColourManager colourManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
- private final ServiceRegistry serviceRegistry;
-
- public RESTActivityMainContextualView(Activity activity, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry,
- ServiceRegistry serviceRegistry) {
- this.activity = activity;
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.colourManager = colourManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- this.serviceRegistry = serviceRegistry;
- initView();
- }
-
- @Override
- public JComponent getMainFrame() {
- jpMainPanel = new JPanel(new GridBagLayout());
- jpMainPanel
- .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2,
- 4, 2), BorderFactory.createLineBorder(
- colourManager.getPreferredColour(RESTActivity.class.getCanonicalName()), 2)));
-
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.weighty = 0;
-
- c.gridx = 0;
- c.gridy = 0;
- c.insets = new Insets(5, 5, 5, 5);
- JLabel jlHTTPMethod = new JLabel("HTTP Method:");
- jlHTTPMethod.setFont(jlHTTPMethod.getFont().deriveFont(Font.BOLD));
- jpMainPanel.add(jlHTTPMethod, c);
-
- c.gridx++;
- c.weightx = 1.0;
- tfHTTPMethod = new JTextField();
- tfHTTPMethod.setEditable(false);
- jpMainPanel.add(tfHTTPMethod, c);
- c.weightx = 0;
-
- c.gridx = 0;
- c.gridy++;
- JLabel jlURLSignature = new JLabel("URL Template:");
- jlURLSignature.setFont(jlURLSignature.getFont().deriveFont(Font.BOLD));
- jpMainPanel.add(jlURLSignature, c);
-
- c.gridx++;
- taURLSignature = new JTextArea(3, 30);
- taURLSignature.setEditable(false);
- taURLSignature.setLineWrap(true);
- JScrollPane spURLSignature = new JScrollPane(taURLSignature);
- jpMainPanel.add(spURLSignature, c);
-
- c.gridx = 0;
- c.gridy++;
- JLabel jlAcceptHeader = new JLabel("'Accept' header:");
- jlAcceptHeader.setFont(jlAcceptHeader.getFont().deriveFont(Font.BOLD));
- jpMainPanel.add(jlAcceptHeader, c);
-
- c.gridx++;
- tfAcceptHeader = new JTextField();
- tfAcceptHeader.setEditable(false);
- jpMainPanel.add(tfAcceptHeader, c);
-
- c.gridx = 0;
- c.gridy++;
- jlContentType = new JLabel("'Content-Type' header:");
- jlContentType.setFont(jlContentType.getFont().deriveFont(Font.BOLD));
- jlContentType.setVisible(false);
- jpMainPanel.add(jlContentType, c);
-
- c.gridx++;
- tfContentTypeHeader = new JTextField();
- tfContentTypeHeader.setEditable(false);
- tfContentTypeHeader.setVisible(false);
- jpMainPanel.add(tfContentTypeHeader, c);
-
- c.gridx = 0;
- c.gridy++;
- jlSendDataAs = new JLabel("Send data as:");
- jlSendDataAs.setFont(jlSendDataAs.getFont().deriveFont(Font.BOLD));
- jlSendDataAs.setVisible(false);
- jpMainPanel.add(jlSendDataAs, c);
-
- c.gridx++;
- tfSendDataAs = new JTextField();
- tfSendDataAs.setEditable(false);
- tfSendDataAs.setVisible(false);
- jpMainPanel.add(tfSendDataAs, c);
-
- c.gridx = 0;
- c.gridy++;
- jlSendHTTPExpectRequestHeader = new JLabel("Send HTTP 'Expect' header:");
- jlSendHTTPExpectRequestHeader.setFont(jlSendHTTPExpectRequestHeader.getFont().deriveFont(
- Font.BOLD));
- jlSendHTTPExpectRequestHeader.setVisible(false);
- jpMainPanel.add(jlSendHTTPExpectRequestHeader, c);
-
- c.gridx++;
- tfSendHTTPExpectRequestHeader = new JTextField();
- tfSendHTTPExpectRequestHeader.setEditable(false);
- tfSendHTTPExpectRequestHeader.setVisible(false);
- jpMainPanel.add(tfSendHTTPExpectRequestHeader, c);
-
- // populate the view with values
- refreshView();
-
- return jpMainPanel;
- }
-
- @Override
- /**
- * This is the title of the contextual view - shown in the list of other available
- * views (even when this contextual view is collapsed).
- */
- public String getViewTitle() {
- return "REST Service Details";
- }
-
- /**
- * Typically called when the activity configuration has changed.
- */
- @Override
- public void refreshView() {
- Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
- RESTActivityConfigurationBean configurationBean = new RESTActivityConfigurationBean(configuration.getJson());
-
- // toggle visibility of the elements that do not always appear
- HTTP_METHOD httpMethod = configurationBean.getHttpMethod();
- jlContentType.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- tfContentTypeHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- jlSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- tfSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- jlSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- tfSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
- jpMainPanel.revalidate();
-
- tfHTTPMethod.setText("" + configurationBean.getHttpMethod());
- taURLSignature.setText(configurationBean.getUrlSignature());
- tfAcceptHeader.setText(configurationBean.getAcceptsHeaderValue());
- tfContentTypeHeader.setText(configurationBean.getContentTypeForUpdates());
- tfSendDataAs.setText("" + configurationBean.getOutgoingDataFormat());
- tfSendHTTPExpectRequestHeader.setText("" + configurationBean.getSendHTTPExpectRequestHeader());
- }
-
- /**
- * View position hint
- */
- @Override
- public int getPreferredPosition() {
- // want to be on top, as it's the main contextual view for this activity
- return 100;
- }
-
- @Override
- public Action getConfigureAction(final Frame owner) {
- // "Configure" button appears because of this action being returned
- return new RESTActivityConfigureAction(activity, owner, editManager, fileManager,
- activityIconManager, serviceDescriptionRegistry, serviceRegistry);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/HTTPHeadersTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/HTTPHeadersTableModel.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/HTTPHeadersTableModel.java
new file mode 100644
index 0000000..2b5fc85
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/HTTPHeadersTableModel.java
@@ -0,0 +1,138 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.config;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+import javax.swing.table.AbstractTableModel;
+
+@SuppressWarnings("serial")
+public class HTTPHeadersTableModel extends AbstractTableModel {
+
+ protected String[] columnNames;
+ protected ArrayList<ArrayList<String>> data;
+
+ public HTTPHeadersTableModel() {
+ columnNames = new String[] {"HTTP Header Name", "HTTP Header Value"};
+ data = new ArrayList<ArrayList<String>>();
+ }
+
+ public String getColumnName(int column) {
+ return columnNames[column];
+ }
+
+ public boolean isCellEditable(int row, int column) {
+ return true;
+ }
+
+ public int getColumnCount()
+ {
+ return columnNames.length;
+ }
+
+ public int getRowCount()
+ {
+ return data.size();
+ }
+
+ public Object getValueAt(int row, int column)
+ {
+ return data.get(row).get(column);
+ }
+
+ public void setValueAt(Object value, int row, int column) {
+ if ((row < 0) || (column < 0)) {
+ throw new IllegalArgumentException("Invalid row/column setting");
+ }
+ data.get(row).set(column, (String)value);
+ }
+
+ /**
+ * Get the class at of the cells at the given column position.
+ */
+ public Class<? extends Object> getColumnClass(int iCol)
+ {
+ return getValueAt(0, iCol).getClass();
+ }
+
+
+ public void addEmptyRow() {
+ data.add(new ArrayList<String>(Arrays.asList("", ""))); // add empty row
+ fireTableRowsInserted(
+ data.size() - 1,
+ data.size() - 1);
+ }
+
+ public void addRow(ArrayList<String> headerValuePair) {
+ data.add(headerValuePair);
+ fireTableRowsInserted(
+ data.size() - 1,
+ data.size() - 1);
+ }
+
+ public void removeRow(int row)
+ {
+ if (row >=0 && row < data.size()){
+ data.remove(row);
+ fireTableRowsDeleted(row, row);
+ }
+ }
+
+ public ArrayList<ArrayList<String>> getHTTPHeaderData(){
+ // Return a deep copy of the 2-dimensional array
+ return deepCopy(data);
+ }
+
+ public void setHTTPHeaderData(ArrayList<ArrayList<String>> data){
+ this.data = deepCopy(data);
+ fireTableChanged(null);
+ }
+
+ public ArrayList<String> getHTTPHeaderNames(){
+ ArrayList<String> headerNames = new ArrayList<String>();
+ for (ArrayList<String> headerNameValuePair : data){
+ headerNames.add(headerNameValuePair.get(0));
+ }
+ return headerNames;
+ }
+
+ public ArrayList<String> getHTTPHeaderValues(){
+ ArrayList<String> headerValues = new ArrayList<String>();
+ for (ArrayList<String> headerNameValuePair : data){
+ headerValues.add(headerNameValuePair.get(1));
+ }
+ return headerValues;
+ }
+
+ public static ArrayList<ArrayList<String>> deepCopy(ArrayList<ArrayList<String>> src)
+ {
+ ArrayList<ArrayList<String>> dest = new ArrayList<ArrayList<String>>();
+
+ for (int i = 0; i< src.size(); i++){
+ dest.add(new ArrayList<String>(Arrays.asList(new String[src.get(i).size()])));
+ Collections.copy(dest.get(i), src.get(i));
+ }
+ return dest;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigurationPanel.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigurationPanel.java
new file mode 100644
index 0000000..c29c4d1
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigurationPanel.java
@@ -0,0 +1,689 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.config;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.ListSelectionModel;
+
+import org.apache.taverna.activities.rest.RESTActivity;
+import org.apache.taverna.activities.rest.RESTActivity.DATA_FORMAT;
+import org.apache.taverna.activities.rest.RESTActivity.HTTP_METHOD;
+import org.apache.taverna.activities.rest.RESTActivityConfigurationBean;
+import org.apache.taverna.activities.rest.URISignatureHandler;
+import org.apache.taverna.activities.rest.URISignatureHandler.URISignatureParsingException;
+import org.apache.taverna.workbench.MainWindow;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+@SuppressWarnings("serial")
+public class RESTActivityConfigurationPanel extends MultiPageActivityConfigurationPanel {
+ private static final Icon infoIcon = new ImageIcon(
+ RESTActivityConfigurationPanel.class.getResource("information.png"));
+
+ // GENERAL tab
+ private JComboBox<HTTP_METHOD> cbHTTPMethod; // HTTP method of this REST activity
+ private JTextField tfURLSignature; // URL signature that determines its
+ // input ports
+ private JComboBox<String> cbAccepts; // for Accepts header
+ private JLabel jlContentTypeExplanation;
+ private JLabel jlContentTypeExplanationPlaceholder;
+ private JLabel jlContentType;
+ private JLabel jlContentTypeLabelPlaceholder; // this placeholder label will
+ // take up space of the
+ // ContentType combo-box
+ // when the latter is not
+ // shown
+ private JLabel jlContentTypeFieldPlaceholder;
+ private JComboBox<String> cbContentType; // for MIME type of data sent to the server
+ // by POST / PUT methods
+ private JLabel jlSendDataAs;
+ private JComboBox<DATA_FORMAT> cbSendDataAs;
+ private JLabel jlSendDataAsLabelPlaceholder;
+ private JLabel jlSendDataAsFieldPlaceholder;
+
+ // ADVANCED tab
+ private JCheckBox cbSendHTTPExpectHeader;
+ private JCheckBox cbShowRedirectionOutputPort;
+ private JCheckBox cbShowActualUrlPort;
+ private JCheckBox cbShowResponseHeadersPort;
+ private JCheckBox cbEscapeParameters;
+ private JButton addHeaderButton;
+ private JButton removeHeaderButton;
+ private JTable httpHeadersTable;
+ private HTTPHeadersTableModel httpHeadersTableModel;
+
+ private String[] mediaTypes;
+
+ private final ServiceRegistry serviceRegistry;
+
+ public RESTActivityConfigurationPanel(Activity activity, ServiceRegistry serviceRegistry) {
+ super(activity);
+ this.serviceRegistry = serviceRegistry;
+ initialise();
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+ removeAllPages();
+ addPage("General", createGeneralTab());
+ addPage("Advanced", createAdvancedTab());
+ refreshConfiguration();
+ }
+
+ @Override
+ public void noteConfiguration() {
+ ObjectNode requestNode = json.objectNode();
+
+ String methodName = ((HTTP_METHOD) cbHTTPMethod.getSelectedItem()).name();
+ requestNode.put("httpMethod", methodName);
+ requestNode.put("absoluteURITemplate", tfURLSignature.getText().trim());
+
+ ArrayNode headersNode = requestNode.arrayNode();
+ headersNode.addObject().put("header", "Accept").put("value", (String) cbAccepts.getSelectedItem());
+ headersNode.addObject().put("header", "Content-Type").put("value", (String) cbContentType.getSelectedItem());
+ if (cbSendHTTPExpectHeader.isSelected()) {
+ headersNode.addObject().put("header", "Expect").put("value", "100-continue");
+ }
+ ArrayList<String> headerNames = httpHeadersTableModel.getHTTPHeaderNames();
+ ArrayList<String> headerValues = httpHeadersTableModel.getHTTPHeaderValues();
+ for (int i = 0; i < headerNames.size(); i++) {
+ headersNode.addObject().put("header", headerNames.get(i)).put("value", headerValues.get(i));
+ }
+
+ requestNode.set("headers", headersNode);
+ json.set("request", requestNode);
+
+ json.put("outgoingDataFormat", ((DATA_FORMAT) cbSendDataAs.getSelectedItem()).name());
+ json.put("showRedirectionOutputPort", cbShowRedirectionOutputPort
+ .isSelected());
+ json.put("showActualURLPort", cbShowActualUrlPort.isSelected());
+ json.put("showResponseHeadersPort", cbShowResponseHeadersPort.isSelected());
+ json.put("escapeParameters", cbEscapeParameters.isSelected());
+
+ configureInputPorts(serviceRegistry);
+ configureOutputPorts(serviceRegistry);
+ }
+
+ /**
+ * Check that user values in the UI are valid.
+ */
+ @Override
+ public boolean checkValues() {
+ // HTTP method is a fixed selection combo-box - no validation required
+
+ // URL signature must be present and be valid
+ String candidateURLSignature = tfURLSignature.getText().trim();
+ if (candidateURLSignature == null
+ || candidateURLSignature.length() == 0) {
+ JOptionPane.showMessageDialog(MainWindow.getMainWindow(),
+ "URL signature must not be empty",
+ "REST Activity Configuration - Warning",
+ JOptionPane.WARNING_MESSAGE);
+ return (false);
+ } else {
+ try {
+ // Test if any exceptions will be thrown - if not, proceed to
+ // other validations
+ URISignatureHandler.validate(candidateURLSignature);
+ } catch (URISignatureParsingException e) {
+ JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e
+ .getMessage(), "REST Activity Configuration - Warning",
+ JOptionPane.WARNING_MESSAGE);
+ return (false);
+ }
+
+ // Test if the URL string contains "unsafe" characters, i.e. characters
+ // that need URL-encoding.
+ // From RFC 1738: "...Only alphanumerics [0-9a-zA-Z], the special
+ // characters "$-_.+!*'()," (not including the quotes) and reserved
+ // characters used for their reserved purposes may be
+ // used unencoded within a URL."
+ // Reserved characters are: ";/?:@&=" ..." (excluding quotes) and "%" used
+ // for escaping.
+ // We do not warn the user if they have not properly enclosed parameter
+ // names in curly braces as this check is already being done elsewhere in the code.
+ // We do not check the characters in parameter names either.
+ try {
+ // Test if any exceptions will be thrown - if not, proceed to
+ // other validations
+ URISignatureHandler.checkForUnsafeCharacters(candidateURLSignature);
+ } catch (URISignatureParsingException e) {
+ JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e
+ .getMessage(), "REST Activity Configuration - Warning",
+ JOptionPane.WARNING_MESSAGE);
+ return (false);
+ }
+
+ // Other HTTP headers configured must not have empty names
+ ArrayList<String> otherHTTPHeaderNames = httpHeadersTableModel.getHTTPHeaderNames();
+ for (String headerName : otherHTTPHeaderNames){
+ if (headerName.equals("")){
+ JOptionPane.showMessageDialog(MainWindow.getMainWindow(), "One of the HTTP header names is empty", "REST Activity Configuration - Warning",
+ JOptionPane.WARNING_MESSAGE);
+ return false;
+ }
+ }
+ }
+
+ // All valid, return true
+ return true;
+ }
+
+ /**
+ * Update GUI from a changed configuration bean (perhaps by undo / redo).
+ */
+ @Override
+ public void refreshConfiguration() {
+ RESTActivityConfigurationBean configBean = new RESTActivityConfigurationBean(json);
+
+ cbHTTPMethod.setSelectedItem(configBean.getHttpMethod());
+ tfURLSignature.setText(configBean.getUrlSignature());
+ tfURLSignature.setCaretPosition(0);
+ cbAccepts.setSelectedItem(configBean.getAcceptsHeaderValue());
+ cbContentType.setSelectedItem(configBean.getContentTypeForUpdates());
+ cbSendDataAs.setSelectedItem(configBean.getOutgoingDataFormat());
+ cbSendHTTPExpectHeader.setSelected(configBean
+ .getSendHTTPExpectRequestHeader());
+ cbShowRedirectionOutputPort.setSelected(configBean
+ .getShowRedirectionOutputPort());
+ cbShowActualUrlPort.setSelected(configBean.getShowActualUrlPort());
+ cbShowResponseHeadersPort.setSelected(configBean.getShowResponseHeadersPort());
+ cbEscapeParameters.setSelected(configBean.getEscapeParameters());
+ httpHeadersTableModel.setHTTPHeaderData(configBean.getOtherHTTPHeaders());
+ }
+
+ private JPanel createGeneralTab() {
+ JPanel jpGeneral = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ // All components to be anchored WEST
+ c.anchor = GridBagConstraints.WEST;
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.gridwidth = 1;
+ c.insets = new Insets(7, 7, 3, 3);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ JLabel labelMethod = new JLabel("HTTP Method:", infoIcon, JLabel.LEFT);
+ labelMethod
+ .setToolTipText("<html>HTTP method determines how a request to the remote server will be made.<br><br>"
+ + "Supported HTTP methods are normally used for different purposes:<br>"
+ + "<b>GET</b> - to fetch data;<br>"
+ + "<b>POST</b> - to create new resources;<br>"
+ + "<b>PUT</b> - to update existing resources;<br>"
+ + "<b>DELETE</b> - to remove existing resources.<br><br>"
+ + "Documentation of the server that is about to be used may suggest the<br>"
+ + "HTTP method that should be used.</html>");
+ jpGeneral.add(labelMethod, c);
+
+ // the HTTP method combo-box will always contain the same values - it is
+ // the selected
+ // method which is important; therefore, can prepopulate as the set of
+ // values is known
+ c.gridx++;
+ c.insets = new Insets(7, 3, 3, 7);
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1.0;
+ cbHTTPMethod = new JComboBox<>(HTTP_METHOD.values());
+ cbHTTPMethod.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ boolean contentTypeSelEnabled = RESTActivity
+ .hasMessageBodyInputPort((HTTP_METHOD) cbHTTPMethod
+ .getSelectedItem());
+
+ jlContentTypeExplanation.setVisible(contentTypeSelEnabled);
+ jlContentType.setVisible(contentTypeSelEnabled);
+ cbContentType.setVisible(contentTypeSelEnabled);
+ jlSendDataAs.setVisible(contentTypeSelEnabled);
+ cbSendDataAs.setVisible(contentTypeSelEnabled);
+
+ jlContentTypeExplanationPlaceholder
+ .setVisible(!contentTypeSelEnabled);
+ jlContentTypeLabelPlaceholder
+ .setVisible(!contentTypeSelEnabled);
+ jlContentTypeFieldPlaceholder
+ .setVisible(!contentTypeSelEnabled);
+ jlSendDataAsLabelPlaceholder.setVisible(!contentTypeSelEnabled);
+ jlSendDataAsFieldPlaceholder.setVisible(!contentTypeSelEnabled);
+ }
+ });
+ jpGeneral.add(cbHTTPMethod, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 7, 3, 3);
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0.0;
+ JLabel labelString = new JLabel("URL Template:", infoIcon, JLabel.LEFT);
+ labelString
+ .setToolTipText("<html>URL template enables to define a URL with <b>configurable<br>"
+ + "parameters</b> that will be used to access a remote server.<br><br>"
+ + "The template may contain zero or more <b>parameters</b> - each<br>"
+ + "enclosed within curly braces <b>\"{\"</b> and <b>\"}\"</b>.<br>"
+ + "Taverna will automatically create an individual input port for<br>"
+ + "this activity for each parameter.<br><br>"
+ + "Values extracted from these input ports during the workflow<br>"
+ + "execution these will be used to replace the parameters to<br>"
+ + "produce complete URLs.<br><br>"
+ + "For example, if the URL template is configured as<br>"
+ + "\"<i>http://www.myexperiment.org/user.xml?id={userID}</i>\", a<br>"
+ + "single input port with the name \"<i>userID</i>\" will be created.</html>");
+ labelString.setLabelFor(tfURLSignature);
+ jpGeneral.add(labelString, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 3, 7);
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1.0;
+ tfURLSignature = new JTextField(40);
+ tfURLSignature.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ tfURLSignature.selectAll();
+ }
+
+ public void focusLost(FocusEvent e) { /* do nothing */
+ }
+ });
+ jpGeneral.add(tfURLSignature, c);
+
+ c.gridx = 0;
+ c.gridwidth = 2;
+ c.gridy++;
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ c.insets = new Insets(18, 7, 3, 7);
+ JLabel jlAcceptsExplanation = new JLabel(
+ "Preferred MIME type for data to be fetched from the remote server --");
+ jpGeneral.add(jlAcceptsExplanation, c);
+ c.gridwidth = 1;
+
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 7, 3, 3);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ JLabel jlAccepts = new JLabel("'Accept' header:", infoIcon, JLabel.LEFT);
+ jlAccepts
+ .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</br>");
+ jlAccepts.setLabelFor(cbAccepts);
+ jpGeneral.add(jlAccepts, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 3, 7);
+ c.weightx = 1.0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ cbAccepts = new JComboBox<>(getMediaTypes());
+ cbAccepts.setEditable(true);
+ cbAccepts.getEditor().getEditorComponent().addFocusListener(
+ new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ cbAccepts.getEditor().selectAll();
+ }
+
+ public void focusLost(FocusEvent e) { /* do nothing */
+ }
+ });
+ jpGeneral.add(cbAccepts, c);
+
+ c.gridx = 0;
+ c.gridwidth = 2;
+ c.gridy++;
+ c.insets = new Insets(18, 7, 3, 7);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ jlContentTypeExplanation = new JLabel(
+ "MIME type of data that will be sent to the remote server --");
+ jpGeneral.add(jlContentTypeExplanation, c);
+ c.gridwidth = 1;
+
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 7, 3, 3);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ jlContentType = new JLabel("'Content-Type' header:", infoIcon,
+ JLabel.LEFT);
+ jlContentType
+ .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</html>");
+ jlContentType.setLabelFor(cbContentType);
+ jpGeneral.add(jlContentType, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 3, 7);
+ c.weightx = 1.0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ cbContentType = new JComboBox<>(getMediaTypes());
+ cbContentType.setEditable(true);
+ cbContentType.getEditor().getEditorComponent().addFocusListener(
+ new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ cbContentType.getEditor().selectAll();
+ }
+
+ public void focusLost(FocusEvent e) { /* do nothing */
+ }
+ });
+ cbContentType.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ // change selection in the "Send data as" combo-box, based on
+ // the selection of Content-Type
+ String selectedContentType = (String) cbContentType
+ .getSelectedItem();
+ if (selectedContentType.startsWith("text")) {
+ cbSendDataAs.setSelectedItem(DATA_FORMAT.String);
+ } else {
+ cbSendDataAs.setSelectedItem(DATA_FORMAT.Binary);
+ }
+ }
+ });
+ jpGeneral.add(cbContentType, c);
+
+ c.gridx = 0;
+ c.gridwidth = 2;
+ c.gridy++;
+ c.insets = new Insets(18, 7, 3, 7);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ jlContentTypeExplanationPlaceholder = new JLabel();
+ jlContentTypeExplanationPlaceholder
+ .setPreferredSize(jlContentTypeExplanation.getPreferredSize());
+ jpGeneral.add(jlContentTypeExplanationPlaceholder, c);
+ c.gridwidth = 1;
+
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 7, 3, 3);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ jlContentTypeLabelPlaceholder = new JLabel();
+ jlContentTypeLabelPlaceholder.setPreferredSize(jlContentType
+ .getPreferredSize());
+ jpGeneral.add(jlContentTypeLabelPlaceholder, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 3, 7);
+ c.weightx = 1.0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ jlContentTypeFieldPlaceholder = new JLabel();
+ jlContentTypeFieldPlaceholder.setPreferredSize(cbContentType
+ .getPreferredSize());
+ jpGeneral.add(jlContentTypeFieldPlaceholder, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ c.insets = new Insets(3, 7, 8, 3);
+ jlSendDataAs = new JLabel("Send data as:", infoIcon, JLabel.LEFT);
+ jlSendDataAs
+ .setToolTipText("Select the format for the data to be sent to the remote server");
+ jlSendDataAs.setLabelFor(cbSendDataAs);
+ jpGeneral.add(jlSendDataAs, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 8, 7);
+ c.weightx = 1.0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ cbSendDataAs = new JComboBox<>(DATA_FORMAT.values());
+ cbSendDataAs.setEditable(false);
+ jpGeneral.add(cbSendDataAs, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 7, 8, 3);
+ c.weightx = 0.0;
+ c.fill = GridBagConstraints.NONE;
+ jlSendDataAsLabelPlaceholder = new JLabel();
+ jlSendDataAsLabelPlaceholder.setPreferredSize(jlSendDataAs
+ .getPreferredSize());
+ jpGeneral.add(jlSendDataAsLabelPlaceholder, c);
+
+ c.gridx++;
+ c.insets = new Insets(3, 3, 8, 7);
+ c.weightx = 1.0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ jlSendDataAsFieldPlaceholder = new JLabel();
+ jlSendDataAsFieldPlaceholder.setPreferredSize(cbSendDataAs
+ .getPreferredSize());
+ jpGeneral.add(jlSendDataAsFieldPlaceholder, c);
+
+ JPanel finalPanel = new JPanel(new BorderLayout());
+ finalPanel.add(jpGeneral, BorderLayout.NORTH);
+ return (finalPanel);
+ }
+
+ private String[] getMediaTypes() {
+ if (mediaTypes != null) {
+ return mediaTypes;
+ }
+ List<String> types = new ArrayList<String>();
+ InputStream typesStream = getClass().getResourceAsStream(
+ "mediatypes.txt");
+ try {
+ // media types must be ASCII and can't have whitespace
+ Scanner scanner = new Scanner(typesStream, "ascii");
+ while (scanner.hasNext()) {
+ types.add(scanner.next());
+ }
+ scanner.close();
+ } finally {
+ try {
+ typesStream.close();
+ } catch (IOException ex) {
+ }
+ }
+ mediaTypes = types.toArray(new String[0]);
+
+ return mediaTypes;
+ }
+
+ private JPanel createAdvancedTab() {
+ JPanel jpAdvanced = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.BOTH;
+ c.insets = new Insets(8, 10, 2, 4);
+ JLabel jlExpectHeaderInfoIcon = new JLabel(infoIcon);
+ jlExpectHeaderInfoIcon
+ .setToolTipText("<html>Ticking this checkbox may significantly improve performance when<br>"
+ + "large volumes of data are sent to the remote server and a redirect<br>"
+ + "from the original URL to the one specified by the server is likely.<br>"
+ + "<br>"
+ + "However, this checkbox <b>must not</b> be ticked to allow this activity<br>"
+ + "to post updates to Twitter.</html>");
+ jpAdvanced.add(jlExpectHeaderInfoIcon, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(8, 0, 2, 8);
+ cbSendHTTPExpectHeader = new JCheckBox(
+ "Send HTTP Expect request-header field");
+ jpAdvanced.add(cbSendHTTPExpectHeader, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ c.insets = new Insets(2, 10, 5, 4);
+ JLabel jlShowRedirectionOutputPortInfoIcon = new JLabel(infoIcon);
+ jlShowRedirectionOutputPortInfoIcon
+ .setToolTipText("<html>\"Redirection\" output port displays the URL of the final redirect<br>"
+ + "that has yielded the output data on the \"Response Body\" port.</html>");
+ jpAdvanced.add(jlShowRedirectionOutputPortInfoIcon, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(2, 0, 5, 8);
+ cbShowRedirectionOutputPort = new JCheckBox(
+ "Show \"Redirection\" output port");
+ jpAdvanced.add(cbShowRedirectionOutputPort, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ c.insets = new Insets(2, 10, 5, 4);
+ JLabel jlShowActualUrlPortInfoIcon = new JLabel(infoIcon);
+ jlShowActualUrlPortInfoIcon
+ .setToolTipText("<html>\"Actual URL\" output port displays the URL used by the REST service<br>"
+ + "with the actual parameter values.</html>");
+ jpAdvanced.add(jlShowActualUrlPortInfoIcon, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(2, 0, 5, 8);
+ cbShowActualUrlPort = new JCheckBox(
+ "Show \"Actual URL\" output port");
+ jpAdvanced.add(cbShowActualUrlPort, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ c.insets = new Insets(2, 10, 5, 4);
+ JLabel jlShowResponseHeadersPortInfoIcon = new JLabel(infoIcon);
+ jlShowResponseHeadersPortInfoIcon
+ .setToolTipText("<html>\"Response headers\" output port displays the HTTP headers<br>"
+ + "received from the final (after redirection) HTTP call.</html>");
+ jpAdvanced.add(jlShowResponseHeadersPortInfoIcon, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(2, 0, 5, 8);
+ cbShowResponseHeadersPort = new JCheckBox(
+ "Show \"Response headers\" output port");
+ jpAdvanced.add(cbShowResponseHeadersPort, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ c.insets = new Insets(2, 10, 5, 4);
+ JLabel jlEscapeParametersInfoIcon = new JLabel(infoIcon);
+ jlEscapeParametersInfoIcon
+ .setToolTipText("<html>Determines if parameters you pass to form the full URL<br>" +
+ " of the REST service will be URL-escaped.</html>");
+ jpAdvanced.add(jlEscapeParametersInfoIcon, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(2, 0, 5, 8);
+ cbEscapeParameters = new JCheckBox("Escape URL parameter values");
+ jpAdvanced.add(cbEscapeParameters, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.NONE;
+ c.insets = new Insets(2, 10, 5, 4);
+ JLabel jlHTTPHeadersInfoIcon = new JLabel(infoIcon);
+ jlHTTPHeadersInfoIcon
+ .setToolTipText("<html>Set additional HTTP headers</html>");
+ jpAdvanced.add(jlHTTPHeadersInfoIcon, c);
+
+ c.gridx = 1;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.NONE;
+ c.insets = new Insets(2, 10, 5, 4);
+ addHeaderButton = new JButton("Add HTTP header");
+ addHeaderButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ httpHeadersTableModel.addEmptyRow();
+ httpHeadersTable.getSelectionModel().setSelectionInterval(httpHeadersTableModel.getRowCount() - 1, httpHeadersTableModel.getRowCount() - 1); }
+ });
+ removeHeaderButton = new JButton("Remove HTTP header");
+ removeHeaderButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int row = httpHeadersTable.getSelectedRow();
+ httpHeadersTableModel.removeRow(row);
+ }
+ });
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(addHeaderButton, FlowLayout.LEFT);
+ buttonPanel.add(removeHeaderButton);
+ jpAdvanced.add(buttonPanel, c);
+
+ c.gridx = 1;
+ c.gridy++;
+ c.weightx = 0;
+ c.weighty = 1.0;
+ c.fill = GridBagConstraints.BOTH;
+ c.insets = new Insets(2, 10, 5, 4);
+ httpHeadersTableModel = new HTTPHeadersTableModel();
+ httpHeadersTable = new JTable(httpHeadersTableModel);
+ httpHeadersTable.setGridColor(Color.GRAY);
+ httpHeadersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ setVisibleRowCount(httpHeadersTable, 3);
+ JScrollPane headersTableScrollPane = new JScrollPane(httpHeadersTable);
+ jpAdvanced.add(headersTableScrollPane, c);
+
+ return (jpAdvanced);
+ }
+
+ /*
+ * Based on http://www.javalobby.org/java/forums/t19559.html
+ */
+ public static void setVisibleRowCount(JTable table, int visibleRows){
+ int height = 0;
+ for(int row = 0; row < visibleRows; row++)
+ height += table.getRowHeight(row);
+
+ table.setPreferredScrollableViewportSize(new Dimension(
+ table.getPreferredScrollableViewportSize().width,
+ height));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigureAction.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigureAction.java
new file mode 100644
index 0000000..45dec42
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/config/RESTActivityConfigureAction.java
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.config;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+/**
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class RESTActivityConfigureAction extends ActivityConfigurationAction {
+
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ServiceRegistry serviceRegistry;
+
+ public RESTActivityConfigureAction(Activity activity, Frame owner, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+ .getDialog(getActivity());
+
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+
+ RESTActivityConfigurationPanel panel = new RESTActivityConfigurationPanel(getActivity(), serviceRegistry);
+ ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(), panel,
+ editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateAction.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateAction.java
new file mode 100644
index 0000000..d11080d
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateAction.java
@@ -0,0 +1,106 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action to add a REST activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddRESTTemplateAction extends AbstractContextualMenuAction {
+
+ private static final String ADD_REST = "REST";
+
+ private static final URI insertSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/insert");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceRegistry serviceRegistry;
+
+ public AddRESTTemplateAction() {
+ super(insertSection, 500);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+
+ return new AddRestAction();
+ }
+
+ protected class AddRestAction extends AbstractAction {
+ AddRestAction() {
+ super(ADD_REST, activityIconManager
+ .iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(
+ GenericRESTTemplateService.getServiceDescription(), false, editManager,
+ menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateMenuAction.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
new file mode 100644
index 0000000..457423a
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
@@ -0,0 +1,113 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * An action to add a REST activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddRESTTemplateMenuAction extends AbstractMenuAction {
+
+ private static final String ADD_REST = "REST";
+
+ private static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ private static final URI ADD_REST_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddREST");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceRegistry serviceRegistry;
+
+ public AddRESTTemplateMenuAction() {
+ super(INSERT, 500, ADD_REST_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddRESTMenuAction();
+ }
+
+ protected class AddRESTMenuAction extends AbstractAction implements DesignOnlyAction {
+ AddRESTMenuAction() {
+ super();
+ putValue(SMALL_ICON, activityIconManager.iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE));
+ putValue(NAME, ADD_REST);
+ putValue(SHORT_DESCRIPTION, "REST service");
+ putValue(
+ Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.SHIFT_DOWN_MASK
+ | InputEvent.ALT_DOWN_MASK));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(
+ GenericRESTTemplateService.getServiceDescription(), false, editManager,
+ menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/GenericRESTTemplateService.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
new file mode 100644
index 0000000..d2fc6a8
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
@@ -0,0 +1,101 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.servicedescription;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.activities.rest.RESTActivity;
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+/**
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class GenericRESTTemplateService extends AbstractTemplateService {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/rest");
+
+ private static final String REST = "REST";
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ ObjectNode json = (ObjectNode) configuration.getJson();
+ ObjectNode requestNode = json.objectNode();
+
+ requestNode.put("httpMethod", RESTActivity.HTTP_METHOD.GET.name());
+ requestNode.put("absoluteURITemplate", "http://www.uniprot.org/uniprot/{id}.xml");
+
+ ArrayNode headersNode = requestNode.arrayNode();
+ headersNode.addObject().put("header", "Accept").put("value", "application/xml");
+ headersNode.addObject().put("header", "Content-Type").put("value", "application/xml");
+
+ requestNode.set("headers", headersNode);
+ json.set("request", requestNode);
+ json.put("outgoingDataFormat", RESTActivity.DATA_FORMAT.String.name());
+ json.put("showRedirectionOutputPort", false);
+ json.put("showActualURLPort", false);
+ json.put("showResponseHeadersPort", false);
+ json.put("escapeParameters", true);
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return RESTActivityIcon.getRESTActivityIcon();
+ }
+
+ public String getName() {
+ return REST;
+ }
+
+ public String getDescription() {
+ return "A generic REST service that can handle all HTTP methods";
+ }
+
+ public static ServiceDescription getServiceDescription() {
+ GenericRESTTemplateService gts = new GenericRESTTemplateService();
+ return gts.templateService;
+ }
+
+ public String getId() {
+ return "http://www.taverna.org.uk/2010/services/rest";
+ }
+
+ @Override
+ public ServiceDescriptionProvider newInstance() {
+ return new GenericRESTTemplateService();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/RESTActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/RESTActivityIcon.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/RESTActivityIcon.java
new file mode 100644
index 0000000..8d6c4c8
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/servicedescription/RESTActivityIcon.java
@@ -0,0 +1,73 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.servicedescription;
+
+import java.awt.Color;
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class RESTActivityIcon implements ActivityIconSPI {
+ private static final Color PROCESSOR_COLOUR = Color.decode("#7AAFFF");
+
+ private static ImageIcon icon;
+
+ public int canProvideIconScore(URI activityType) {
+ if (GenericRESTTemplateService.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getRESTActivityIcon();
+ }
+
+ public static Icon getRESTActivityIcon() {
+ if (icon == null) {
+ synchronized (RESTActivityIcon.class) {
+ if (icon == null) {
+ try {
+ icon = new ImageIcon(
+ RESTActivityIcon.class.getResource("service_type_rest.png"));
+ } catch (NullPointerException e) {
+ /* icon wasn't found - do nothing, but no icon will be available */
+ }
+ }
+ }
+ }
+ return (icon);
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ // set colour for REST processors in the workflow diagram
+ colourManager.setPreferredColour(GenericRESTTemplateService.ACTIVITY_TYPE.toString(), PROCESSOR_COLOUR);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
new file mode 100644
index 0000000..5d9848d
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak
@@ -0,0 +1,99 @@
+package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+
+import net.sf.taverna.t2.activities.rest.RESTActivity;
+import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
+
+public class ExampleServiceDesc extends ServiceDescription<RESTActivityConfigurationBean>
+{
+ /**
+ * The subclass of Activity which should be instantiated when adding a service
+ * for this description
+ */
+ @Override
+ public Class<? extends Activity<RESTActivityConfigurationBean>> getActivityClass() {
+ return RESTActivity.class;
+ }
+
+ /**
+ * The configuration bean which is to be used for configuring the instantiated activity.
+ * Making this bean will typically require some of the fields set on this service
+ * description, like an endpoint URL or method name.
+ *
+ */
+ @Override
+ public RESTActivityConfigurationBean getActivityConfiguration() {
+ RESTActivityConfigurationBean bean = new RESTActivityConfigurationBean();
+ bean.setExampleString(exampleString);
+ bean.setExampleUri(exampleUri);
+ return bean;
+ }
+
+ /**
+ * An icon to represent this service description in the service palette.
+ */
+ @Override
+ public Icon getIcon() {
+ return null;
+ }
+
+ /**
+ * The display name that will be shown in service palette and will
+ * be used as a template for processor name when added to workflow.
+ */
+ @Override
+ public String getName() {
+ return exampleString;
+ }
+
+ /**
+ * The path to this service description in the service palette. Folders
+ * will be created for each element of the returned path.
+ */
+ @Override
+ public List<String> getPath() {
+ // For deeper paths you may return several strings
+ return Arrays.asList("Service templates", "Examples " + exampleUri);
+ }
+
+ /**
+ * Return a list of data values uniquely identifying this service
+ * description (to avoid duplicates). Include only primary key like fields,
+ * ie. ignore descriptions, icons, etc.
+ */
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ // FIXME: Use your fields instead of example fields
+ return Arrays.<Object>asList(exampleString, exampleUri);
+ }
+
+
+ // FIXME: Replace example fields and getters/setters with any required
+ // and optional fields. (All fields are searchable in the Service palette,
+ // for instance try a search for exampleString:3)
+ private String exampleString;
+ private URI exampleUri;
+ public String getExampleString() {
+ return exampleString;
+ }
+ public URI getExampleUri() {
+ return exampleUri;
+ }
+ public void setExampleString(String exampleString) {
+ this.exampleString = exampleString;
+ }
+ public void setExampleUri(URI exampleUri) {
+ this.exampleUri = exampleUri;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
new file mode 100644
index 0000000..ff11dbe
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProvider.java.bak
@@ -0,0 +1,106 @@
+package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JOptionPane;
+
+import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
+import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
+import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
+import net.sf.taverna.t2.workflowmodel.ConfigurationException;
+
+public class ExampleServiceProvider extends AbstractConfigurableServiceProvider<ExampleServiceProviderConfig>
+ implements ConfigurableServiceProvider<ExampleServiceProviderConfig>
+{
+ public ExampleServiceProvider()
+ {
+ super(new ExampleServiceProviderConfig());
+ }
+
+ /**
+ * Do the actual search for services. Return using the callBack parameter.
+ */
+ @SuppressWarnings("unchecked")
+ public void findServiceDescriptionsAsync(
+ FindServiceDescriptionsCallBack callBack) {
+ // Use callback.status() for long-running searches
+ // callBack.status("Resolving example services");
+
+ List<ServiceDescription> results = new ArrayList<ServiceDescription>();
+
+ // FIXME: Implement the actual service search/lookup instead
+ // of dummy for-loop
+ for (int i = 1; i <= getConfiguration().getNumberOfServices(); i++) {
+ ExampleServiceDesc service = new ExampleServiceDesc();
+ // Populate the service description bean
+ service.setExampleString("Example " + i);
+ service.setExampleUri(getConfiguration().getUri());
+
+ // Optional: set description
+ service.setDescription("Service example number " + i);
+ results.add(service);
+ }
+
+ // partialResults() can also be called several times from inside
+ // for-loop if the full search takes a long time
+ callBack.partialResults(results);
+
+ // No more results will be coming
+ callBack.finished();
+ }
+
+
+// @Override
+// /**
+// * This allows to have a few configured service providers in the Service Panel at startup;
+// * useful if there are some prototypical ones that are useful + need to allow users to add their own
+// * through manual config.
+// */
+// public List<ExampleServiceProviderConfig> getDefaultConfigurations() {
+// ExampleServiceProviderConfig a = new ExampleServiceProviderConfig();
+// a.setUri(URI.create("http://localhost:8181/serviceA"));
+// ExampleServiceProviderConfig b = new ExampleServiceProviderConfig();
+// b.setUri(URI.create("http://fish.com/serviceB"));
+// b.setNumberOfServices(2);
+// return Arrays.asList(a, b);
+// }
+
+
+
+ /**
+ * Icon for service provider
+ */
+ public Icon getIcon() {
+ return null;
+ }
+
+
+ /**
+ * Appears in "Import new services..." in Service Panel
+ */
+ public String getName() {
+ return "My example service";
+ }
+
+ @Override
+ /**
+ * Name of service provider, appears in right click for 'Remove service
+ * provider'
+ */
+ public String toString() {
+ return getName() + " " + getConfiguration().getUri();
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ return Arrays.asList(getConfiguration().getUri());
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
new file mode 100644
index 0000000..22d8546
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/serviceprovider/ExampleServiceProviderConfig.java.bak
@@ -0,0 +1,31 @@
+package net.sf.taverna.t2.activities.rest.ui.serviceprovider;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
+import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
+
+public class ExampleServiceProviderConfig extends PropertyAnnotated
+{
+ private URI uri = URI.create("http://www.example.com");
+ private int numberOfServices = 5;
+
+ @PropertyAnnotation(displayName="Provider URI", preferred=true)
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ @PropertyAnnotation(displayName="Number of services")
+ public int getNumberOfServices() {
+ return numberOfServices;
+ }
+
+ public void setNumberOfServices(int numberOfServices) {
+ this.numberOfServices = numberOfServices;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
new file mode 100644
index 0000000..2be0b21
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
@@ -0,0 +1,85 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.view;
+
+import javax.swing.Action;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+import org.apache.taverna.activities.rest.ui.config.RESTActivityConfigureAction;
+import org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * This action is responsible for enabling the contextual menu entry on processors that perform
+ * RESTActivity'ies.
+ * NB! As a side-effect this also enables the pop-up with for configuration of the processor when it
+ * is added to the workflow from the Service Panel.
+ *
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+public class ConfigureRESTActivityMenuAction extends AbstractConfigureActivityMenuAction {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public ConfigureRESTActivityMenuAction() {
+ super(GenericRESTTemplateService.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ RESTActivityConfigureAction configAction = new RESTActivityConfigureAction(findActivity(),
+ getParentFrame(), editManager, fileManager, activityIconManager,
+ serviceDescriptionRegistry, serviceRegistry);
+ configAction.putValue(Action.NAME, "Configure REST service");
+ addMenuDots(configAction);
+ return configAction;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
[14/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.AskWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.AskWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.AskWorker
index f094efa..98a83d8 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.AskWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.AskWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.swing.JOptionPane;
answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (title == void ? null : title), JOptionPane.QUESTION_MESSAGE);
@@ -7,7 +7,7 @@ answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -16,8 +16,8 @@ answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -26,16 +26,16 @@ answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>answer</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.ChooseWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.ChooseWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.ChooseWorker
index 5244d77..32df40b 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.ChooseWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.ChooseWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
@@ -36,7 +36,7 @@ for (JRadioButton button : buttonArray) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -45,8 +45,8 @@ for (JRadioButton button : buttonArray) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -55,8 +55,8 @@ for (JRadioButton button : buttonArray) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -65,16 +65,16 @@ for (JRadioButton button : buttonArray) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>answer</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker
index e594b7f..92ad1fc 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.awt.CardLayout;
import java.awt.Image;
import java.awt.Toolkit;
@@ -72,7 +72,7 @@ selectedFile = file.getAbsolutePath();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -81,8 +81,8 @@ selectedFile = file.getAbsolutePath();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -91,8 +91,8 @@ selectedFile = file.getAbsolutePath();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -101,16 +101,16 @@ selectedFile = file.getAbsolutePath();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>selectedFile</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectWorker
index 1745844..5bc3296 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.SelectWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.swing.JOptionPane;
if ((valueList == void) || (valueList == null) || (valueList.isEmpty())) {
@@ -9,7 +9,7 @@ answer = (String) JOptionPane.showInputDialog(null, (message == void ? null : me
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -18,8 +18,8 @@ answer = (String) JOptionPane.showInputDialog(null, (message == void ? null : me
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -28,8 +28,8 @@ answer = (String) JOptionPane.showInputDialog(null, (message == void ? null : me
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -38,16 +38,16 @@ answer = (String) JOptionPane.showInputDialog(null, (message == void ? null : me
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>answer</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.TellWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.TellWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.TellWorker
index 99ee6ab..32e404f 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.TellWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.TellWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.swing.JOptionPane;
JOptionPane.showMessageDialog(null, (message == void ? null : message), (title == void ? null : title), JOptionPane.INFORMATION_MESSAGE);
@@ -8,7 +8,7 @@ answer = "answer";
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -17,8 +17,8 @@ answer = "answer";
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -27,16 +27,16 @@ answer = "answer";
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>answer</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.WarnWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.WarnWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.WarnWorker
index b211ba5..e3df2d3 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.WarnWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ui.WarnWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.swing.JOptionPane;
JOptionPane.showMessageDialog(null, (message == void ? null : message), (title == void ? null : title), JOptionPane.WARNING_MESSAGE);
@@ -8,7 +8,7 @@ answer = "answer";
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -17,8 +17,8 @@ answer = "answer";
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -27,16 +27,16 @@ answer = "answer";
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>answer</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker
index 0395225..95fef69 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.dom4j.Document;
import org.dom4j.Node;
import org.dom4j.io.SAXReader;
@@ -33,7 +33,7 @@ List nodelistAsXML=outputXmlList;</script>
<string>dom4j:dom4j:1.6</string>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -42,8 +42,8 @@ List nodelistAsXML=outputXmlList;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -52,24 +52,24 @@ List nodelistAsXML=outputXmlList;</script>
<mimeTypes>
<string>'text/xml'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>nodelist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>nodelistAsXML</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorker
index 1532b63..3805887 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputStr" to="outputStr" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputStr" to="outputStr" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
@@ -98,7 +98,7 @@ sourceReader.close();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -107,8 +107,8 @@ sourceReader.close();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -117,8 +117,8 @@ sourceReader.close();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -127,8 +127,8 @@ sourceReader.close();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -137,16 +137,16 @@ sourceReader.close();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputStr</name>
<depth>0</depth>
<mimeTypes>
<string>'text/xml'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters
index 768c8f9..f3ba114 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters
@@ -1,5 +1,5 @@
<activity xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class>
+ <class>org.apache.taverna.activities.localworker.LocalworkerActivity</class>
<inputMap>
<map from="xsltString" to="xsltString" />
<map from="paramList" to="paramList" />
@@ -9,9 +9,9 @@
<map from="outputString" to="outputString" />
</outputMap>
<configBean encoding="xstream">
- <net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+ <org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>sourceString</name>
<depth>0</depth>
<mimeTypes>
@@ -20,8 +20,8 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>xsltString</name>
<depth>0</depth>
<mimeTypes>
@@ -30,8 +30,8 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>paramList</name>
<depth>1</depth>
<mimeTypes>
@@ -40,15 +40,15 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<name>outputString</name>
<depth>0</depth>
<mimeTypes />
<granularDepth>0</granularDepth>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
<classLoaderSharing>workflow</classLoaderSharing>
<localDependencies />
@@ -97,4 +97,4 @@ Writer outputWriter = new StringWriter();
tnf.transform(inSource, new StreamResult(outputWriter));
outputString = outputWriter.toString();</script>
<dependencies />
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ByteArrayToString
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ByteArrayToString b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ByteArrayToString
index 35b50d0..907447d 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ByteArrayToString
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ByteArrayToString
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((bytes == void) || (bytes == null)) {
throw new RuntimeException("The 'bytes' parameter must be specified");
}
@@ -10,7 +10,7 @@ if (encoding == void) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>[B</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -19,8 +19,8 @@ if (encoding == void) {
<mimeTypes>
<string>'application/octet-stream'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -29,16 +29,16 @@ if (encoding == void) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>string</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.DecodeBase64
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.DecodeBase64 b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.DecodeBase64
index 62c01bd..67172f7 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.DecodeBase64
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.DecodeBase64
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.apache.commons.codec.binary.Base64;
bytes = Base64.decodeBase64(base64.getBytes());
@@ -7,7 +7,7 @@ bytes = Base64.decodeBase64(base64.getBytes());
<element class="string">commons-codec:commons-codec:1.3</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -16,16 +16,16 @@ bytes = Base64.decodeBase64(base64.getBytes());
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>bytes</name>
<depth>0</depth>
<mimeTypes>
<string>'application/octet-stream'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EchoList
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EchoList b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EchoList
index 615c762..d6cc91b 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EchoList
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EchoList
@@ -1,8 +1,8 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>outputlist = inputlist;</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>[B</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -11,16 +11,16 @@
<mimeTypes>
<string>l('')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>outputlist</name>
<depth>1</depth>
<mimeTypes>
<string>l('')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings
index 6045d0a..1e160ad 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>List strings = new ArrayList();
for (int i = 0; i < 40; i++) {
strings.add("String" + i);
@@ -7,13 +7,13 @@ for (int i = 0; i < 40; i++) {
<dependencies />
<inputs />
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>strings</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EncodeBase64
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EncodeBase64 b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EncodeBase64
index 8f6bcd0..579d614 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EncodeBase64
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.EncodeBase64
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.apache.commons.codec.binary.Base64;
base64 = new String(Base64.encodeBase64(bytes));</script>
@@ -6,7 +6,7 @@ base64 = new String(Base64.encodeBase64(bytes));</script>
<element class="string">commons-codec:commons-codec:1.3</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>[B</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -15,16 +15,16 @@ base64 = new String(Base64.encodeBase64(bytes));</script>
<mimeTypes>
<string>'application/octet-stream'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>base64</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks
index 05946b1..32fd6c3 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>String lowerCaseContent = document.toLowerCase();
int index = 0;
List imagelinks = new ArrayList();
@@ -17,7 +17,7 @@ while ((index = lowerCaseContent.indexOf("<img", index)) != -1) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -26,16 +26,16 @@ while ((index = lowerCaseContent.indexOf("<img", index)) != -1) {
<mimeTypes>
<string>'text/html'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>imagelinks</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/x-taverna-web-url')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FilterStringList
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FilterStringList b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FilterStringList
index 7b107e6..a248298 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FilterStringList
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FilterStringList
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>filteredlist = new ArrayList();
for (Iterator i = stringlist.iterator(); i.hasNext();) {
String item = (String) i.next();
@@ -9,7 +9,7 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -18,8 +18,8 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -28,16 +28,16 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>filteredlist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FlattenList
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FlattenList b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FlattenList
index 558cc99..1343d9b 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FlattenList
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.FlattenList
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>flatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
@@ -15,7 +15,7 @@ outputlist = new ArrayList();
flatten(inputlist, outputlist, 1);</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>[B</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -24,16 +24,16 @@ flatten(inputlist, outputlist, 1);</script>
<mimeTypes>
<string>l(l(''))</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>outputlist</name>
<depth>1</depth>
<mimeTypes>
<string>l('')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.PadNumber
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.PadNumber b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.PadNumber
index 3edd0cf..deb0124 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.PadNumber
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.PadNumber
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>int targetLengthInt = 7;
if (targetlength != void) {
targetLengthInt = Integer.parseInt(targetlength);
@@ -10,7 +10,7 @@ while (input.length() < targetLengthInt) {
padded = input;</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -19,8 +19,8 @@ padded = input;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -29,16 +29,16 @@ padded = input;</script>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>padded</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList
index 7a4165a..dde969a 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.util.regex.*;
filteredlist = new ArrayList();
@@ -16,7 +16,7 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -25,8 +25,8 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -35,8 +35,8 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -45,16 +45,16 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>filteredlist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SendEmail
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SendEmail b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SendEmail
index f847773..042f4ba 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SendEmail
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SendEmail
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
@@ -30,7 +30,7 @@ Transport.send(message);
<string>javax.activation:activation:1.1</string>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -39,8 +39,8 @@ Transport.send(message);
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -49,8 +49,8 @@ Transport.send(message);
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -59,8 +59,8 @@ Transport.send(message);
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -69,8 +69,8 @@ Transport.send(message);
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -79,7 +79,7 @@ Transport.send(message);
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs />
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SplitByRegex
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SplitByRegex b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SplitByRegex
index 7c296f3..25e59f1 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SplitByRegex
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.SplitByRegex
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>List split = new ArrayList();
if (!string.equals("")) {
String regexString = ",";
@@ -13,7 +13,7 @@ if (!string.equals("")) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -22,8 +22,8 @@ if (!string.equals("")) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -32,16 +32,16 @@ if (!string.equals("")) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>split</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringConcat
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringConcat b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringConcat
index 7993975..f361d3a 100644
--- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringConcat
+++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringConcat
@@ -1,8 +1,8 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>output = string1 + string2;</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -11,8 +11,8 @@
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -21,16 +21,16 @@
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>output</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
[17/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/InvocationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/InvocationPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/InvocationPanel.java
new file mode 100644
index 0000000..217d2e3
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/InvocationPanel.java
@@ -0,0 +1,394 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityHealthChecker;
+import org.apache.taverna.activities.externaltool.configuration.ToolInvocationConfiguration;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroup;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroupAddedEvent;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroupRemovedEvent;
+import org.apache.taverna.activities.externaltool.manager.InvocationManagerEvent;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanismAddedEvent;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanismRemovedEvent;
+import org.apache.taverna.activities.externaltool.manager.ToolInvocationConfigurationPanel;
+import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import net.sf.taverna.t2.workbench.ui.impl.configuration.ui.T2ConfigurationFrame;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author alanrw
+ *
+ */
+public class InvocationPanel extends JPanel implements Observer<InvocationManagerEvent> {
+
+ private static final String LOCATION_DESCRIPTION = ToolInvocationConfigurationPanel.HEADER_TEXT;
+ private final JComboBox mechanismSelection;
+ private final JComboBox groupSelection;
+
+ private DefaultComboBoxModel mechanismSelectionModel = new DefaultComboBoxModel();
+ private DefaultComboBoxModel groupSelectionModel = new DefaultComboBoxModel();
+
+ private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance();
+
+ private static Logger logger = Logger
+ .getLogger(InvocationPanel.class);
+
+ private JRadioButton unmanagedLocation;
+ private JRadioButton groupSelected;
+ private JRadioButton mechanismSelected;
+ private JButton manageInvocation;
+ private ButtonGroup mechanismOrGroup;
+ private ExternalToolActivityConfigurationBean configuration;
+
+ private ActionListener radioChangeListener;
+
+ boolean unmanagedShown = false;
+
+ public InvocationPanel(ExternalToolActivityConfigurationBean configuration) {
+ super();
+ manager.addObserver(this);
+
+ mechanismSelection = new JComboBox();
+ populateMechanismList();
+ mechanismSelection.setModel(mechanismSelectionModel);
+
+ groupSelection = new JComboBox();
+ populateGroupList();
+ groupSelection.setModel(groupSelectionModel);
+ populateInvocationPanel(configuration);
+
+ radioChangeListener = new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (unmanagedShown && unmanagedLocation.isSelected()) {
+ setUnmanagedLocationSelectability(true);
+ setMechanismSelectability(false);
+ setGroupSelectability(false);
+ return;
+ }
+ if (mechanismSelected.isSelected()) {
+ if (unmanagedShown) {
+ setUnmanagedLocationSelectability(false);
+ }
+ setMechanismSelectability(true);
+ setGroupSelectability(false);
+ return;
+ }
+ if (unmanagedShown) {
+ setUnmanagedLocationSelectability(false);
+ }
+ setMechanismSelectability(false);
+ setGroupSelectability(true);
+ return; }
+
+ };
+ if (unmanagedShown) {
+ unmanagedLocation.addActionListener(radioChangeListener);
+ }
+ groupSelected.addActionListener(radioChangeListener);
+ mechanismSelected.addActionListener(radioChangeListener);
+ }
+
+ private void populateMechanismList() {
+ InvocationMechanism currentSelection = (InvocationMechanism) mechanismSelection.getSelectedItem();
+ InvocationMechanism[] mechanisms = InvocationGroupManagerImpl.getInstance()
+ .getMechanisms().toArray(new InvocationMechanism[] {});
+ Arrays.sort(mechanisms, new Comparator<InvocationMechanism>() {
+
+ @Override
+ public int compare(InvocationMechanism arg0, InvocationMechanism arg1) {
+ return arg0.getName().compareTo(
+ arg1.getName());
+ }
+ });
+ mechanismSelectionModel.removeAllElements();
+ for (InvocationMechanism mechanism : mechanisms) {
+ mechanismSelectionModel.addElement(mechanism);
+ logger.info("Added mechanism " + mechanism.hashCode());
+ }
+ if (currentSelection != null) {
+ mechanismSelection.setSelectedItem(currentSelection);
+ }
+
+ }
+
+ private void populateGroupList() {
+ InvocationGroup currentSelection = (InvocationGroup) groupSelection.getSelectedItem();
+ InvocationGroup[] groups = InvocationGroupManagerImpl.getInstance()
+ .getInvocationGroups().toArray(new InvocationGroup[] {});
+ Arrays.sort(groups, new Comparator<InvocationGroup>() {
+
+ @Override
+ public int compare(InvocationGroup arg0, InvocationGroup arg1) {
+ return arg0.getName().compareTo(
+ arg1.getName());
+ }
+ });
+ groupSelectionModel.removeAllElements();
+ for (InvocationGroup group : groups) {
+ groupSelectionModel.addElement(group);
+ logger.info("Added group " + group.hashCode());
+ }
+ if (currentSelection != null) {
+ groupSelection.setSelectedItem(currentSelection);
+ }
+
+ }
+
+
+ private void populateInvocationPanel(ExternalToolActivityConfigurationBean configuration) {
+ this.configuration = configuration;
+ this.removeAll();
+ this.setLayout(new BorderLayout());
+
+ JTextArea descriptionText = new JTextArea(
+ LOCATION_DESCRIPTION);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+ descriptionText.setRows(3);
+ this.add(descriptionText, BorderLayout.NORTH);
+
+ JPanel innerPanel = new JPanel(new BorderLayout());
+
+ mechanismOrGroup = new ButtonGroup();
+
+ JPanel subPanel = new JPanel(new GridLayout(4,1));
+
+ if (isUnmanaged(configuration)) {
+ createUnmanagedLocation(subPanel);
+ unmanagedShown = true;
+ }
+
+ subPanel.add(createMechanismPanel());
+
+ subPanel.add(createGroupPanel());
+
+ subPanel.add(createButtonPanel());
+
+ innerPanel.add(subPanel, BorderLayout.NORTH);
+ innerPanel.add(new JPanel(), BorderLayout.CENTER);
+
+ initializeSelectability();
+ this.add(innerPanel, BorderLayout.CENTER);
+ this.repaint();
+ }
+
+ private boolean isUnmanaged(
+ ExternalToolActivityConfigurationBean configuration2) {
+ return (!ExternalToolActivityHealthChecker.updateLocation(configuration2));
+ }
+
+ private void initializeSelectability() {
+ if (isUnmanaged(configuration)) {
+ unmanagedLocation.setSelected(true);
+ setUnmanagedLocationSelectability(true);
+ setMechanismSelectability(false);
+ setGroupSelectability(false);
+ return;
+ }
+ if (configuration.getInvocationGroup() == null) {
+ mechanismSelected.setSelected(true);
+ if (unmanagedShown) {
+ setUnmanagedLocationSelectability(false);
+ }
+ setMechanismSelectability(true);
+ setGroupSelectability(false);
+ return;
+ }
+ groupSelected.setSelected(true);
+ if (unmanagedShown) {
+ setUnmanagedLocationSelectability(false);
+ }
+ setMechanismSelectability(false);
+ setGroupSelectability(true);
+ return;
+ }
+
+ private void setGroupSelectability(boolean b) {
+ groupSelection.setEnabled(b);
+ }
+
+ private void setMechanismSelectability(boolean b) {
+ mechanismSelection.setEnabled(b);
+ }
+
+ private void setUnmanagedLocationSelectability(boolean b) {
+ // Nothing to do
+ }
+
+ private JPanel createGroupPanel() {
+ JPanel groupPanel = new JPanel(new BorderLayout());
+
+ JPanel groupSelectionPanel = new JPanel(new GridLayout(1, 2));
+ groupSelected = new JRadioButton("Select a symbolic location");
+ mechanismOrGroup.add(groupSelected);
+ groupSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
+ groupSelectionPanel.add(groupSelected);
+
+ groupSelection.setRenderer(new DefaultListCellRenderer() {
+
+ @Override
+ public Component getListCellRendererComponent(JList arg0,
+ Object arg1, int arg2, boolean arg3, boolean arg4) {
+ if (arg1 instanceof InvocationGroup) {
+ return super.getListCellRendererComponent(arg0,
+ ((InvocationGroup) arg1).getName(),
+ arg2, arg3, arg4);
+ }
+ return super.getListCellRendererComponent(arg0, arg1, arg2,
+ arg3, arg4);
+ }
+ });
+
+ groupSelectionPanel.add(groupSelection);
+
+ groupPanel.add(groupSelectionPanel, BorderLayout.CENTER);
+
+ if (configuration.getInvocationGroup() != null) {
+ groupSelection.setSelectedItem(configuration.getInvocationGroup());
+ } else {
+ groupSelection.setSelectedItem(manager.getDefaultGroup());
+ }
+
+ return groupPanel;
+ }
+
+ private JPanel createMechanismPanel() {
+ JPanel mechanismPanel = new JPanel(new BorderLayout());
+ JPanel mechanismSelectionPanel = new JPanel(new GridLayout(1, 3));
+ mechanismSelected = new JRadioButton("Select an explicit location");
+ mechanismOrGroup.add(mechanismSelected);
+ mechanismSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
+ mechanismSelectionPanel.add(mechanismSelected);
+
+ mechanismSelection.setRenderer(new DefaultListCellRenderer() {
+
+ @Override
+ public Component getListCellRendererComponent(JList arg0,
+ Object arg1, int arg2, boolean arg3, boolean arg4) {
+ if (arg1 instanceof InvocationMechanism) {
+ return super.getListCellRendererComponent(arg0,
+ ((InvocationMechanism) arg1).getName(),
+ arg2, arg3, arg4);
+ }
+ return super.getListCellRendererComponent(arg0, arg1, arg2,
+ arg3, arg4);
+ }
+ });
+
+ mechanismSelectionPanel.add(mechanismSelection);
+
+ mechanismPanel.add(mechanismSelectionPanel, BorderLayout.CENTER);
+ if (configuration.getMechanism() != null) {
+ mechanismSelection.setSelectedItem(configuration.getMechanism());
+ } else {
+ mechanismSelection.setSelectedItem(manager.getDefaultMechanism());
+ }
+ return mechanismPanel;
+
+ }
+
+ private JPanel createButtonPanel() {
+ JPanel buttonPanel = new JPanel(new FlowLayout());
+ manageInvocation = new DeselectingButton("Manage locations",
+ new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ T2ConfigurationFrame.showConfiguration(ToolInvocationConfiguration.getInstance().getDisplayName());
+ }});
+ buttonPanel.add(manageInvocation);
+ return buttonPanel;
+ }
+
+ private void createUnmanagedLocation(JPanel subPanel) {
+ unmanagedLocation = new JRadioButton("Continue using unmanaged location");
+ subPanel.add(unmanagedLocation);
+ mechanismOrGroup.add(unmanagedLocation);
+ }
+
+ private void handleInvocationManagerMessage(InvocationManagerEvent message) {
+ if (message instanceof InvocationMechanismRemovedEvent) {
+ InvocationMechanism removedMechanism = ((InvocationMechanismRemovedEvent) message).getRemovedMechanism();
+ InvocationMechanism replacementMechanism = ((InvocationMechanismRemovedEvent) message).getReplacementMechanism();
+ if (mechanismSelection.getSelectedItem().equals(removedMechanism)) {
+ mechanismSelection.setSelectedItem(replacementMechanism);
+ }
+ mechanismSelectionModel.removeElement(removedMechanism);
+ } else if (message instanceof InvocationMechanismAddedEvent) {
+ populateMechanismList();
+ }
+ else if (message instanceof InvocationGroupRemovedEvent) {
+ InvocationGroup removedGroup = ((InvocationGroupRemovedEvent) message).getRemovedGroup();
+ InvocationGroup replacementGroup = ((InvocationGroupRemovedEvent) message).getReplacementGroup();
+ if (groupSelection.getSelectedItem().equals(removedGroup)) {
+ groupSelection.setSelectedItem(replacementGroup);
+ }
+ groupSelectionModel.removeElement(removedGroup);
+ } else if (message instanceof InvocationGroupAddedEvent) {
+ populateGroupList();
+ }
+ }
+
+ @Override
+ public void notify(Observable<InvocationManagerEvent> sender,
+ final InvocationManagerEvent message) throws Exception {
+ if (SwingUtilities.isEventDispatchThread()) {
+ handleInvocationManagerMessage(message);
+ } else {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ handleInvocationManagerMessage(message);
+ }
+ });
+ } }
+
+ public void fillInConfiguration(
+ ExternalToolActivityConfigurationBean newConfiguration) {
+ if (unmanagedShown && unmanagedLocation.isSelected()) {
+ return;
+ }
+ if (mechanismSelected.isSelected()) {
+ newConfiguration.setMechanism((InvocationMechanism) mechanismSelection.getSelectedItem());
+ return;
+ }
+ newConfiguration.setInvocationGroup((InvocationGroup) groupSelection.getSelectedItem());
+ }
+
+ public void stopObserving() {
+ manager.removeObserver(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/LoadDescriptionAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/LoadDescriptionAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/LoadDescriptionAction.java
new file mode 100644
index 0000000..ca5efa8
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/LoadDescriptionAction.java
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.StringBufferInputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.lang.ui.FileTools;
+
+import org.jdom.Document;
+import org.jdom.JDOMException;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
+
+final class LoadDescriptionAction extends AbstractAction {
+ /**
+ *
+ */
+ private final ScriptPanel scriptPanel;
+ private final ExternalToolConfigView view;
+
+ LoadDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
+ this.scriptPanel = scriptPanel;
+ this.view = view;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ String descriptionsString = FileTools.readStringFromFile(
+ this.scriptPanel, "Load tool description",
+ ".xml");
+ if (descriptionsString != null) {
+ String errorMessage = null;
+ try {
+ Document doc = ScriptPanel.builder
+ .build(new StringReader(descriptionsString));
+ List<UseCaseDescription> descriptions = UseCaseEnumeration.readDescriptionsFromStream(new StringBufferInputStream(descriptionsString));
+ if (descriptions.isEmpty()) {
+ JOptionPane.showMessageDialog(this.scriptPanel, "No tool descriptions found", "File content", JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ if (descriptions.size() == 1) {
+ view.getConfiguration().setUseCaseDescription(descriptions.get(0));
+ view.refreshConfiguration(view.getConfiguration());
+ return;
+ }
+
+ List<String> descriptionNames = new ArrayList();
+ for (UseCaseDescription ud : descriptions) {
+ descriptionNames.add(ud.getUsecaseid());
+ }
+ Collections.sort(descriptionNames);
+ String chosenName = (String) JOptionPane.showInputDialog(this.scriptPanel, "Please select a tool description",
+ "Select tool description", JOptionPane.PLAIN_MESSAGE, null, descriptionNames.toArray(), descriptionNames.get(0));
+ if (chosenName != null) {
+ for (UseCaseDescription ud : descriptions) {
+ if (ud.getUsecaseid().equals(chosenName)) {
+ view.getConfiguration().setUseCaseDescription(ud);
+ view.refreshConfiguration(view.getConfiguration());
+ return;
+
+ }
+ }
+ }
+ } catch (JDOMException e1) {
+ errorMessage = e1.getMessage();
+ } catch (IOException e1) {
+ errorMessage = e1.getMessage();
+ } catch (Exception e1) {
+ errorMessage = e1.getMessage();
+ }
+ if (errorMessage != null) {
+ JOptionPane.showMessageDialog(null, errorMessage,
+ "Tool description load error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/SaveDescriptionAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/SaveDescriptionAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/SaveDescriptionAction.java
new file mode 100644
index 0000000..977b228
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/SaveDescriptionAction.java
@@ -0,0 +1,124 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.lang.ui.ExtensionFileFilter;
+import org.apache.taverna.lang.ui.FileTools;
+
+import org.apache.log4j.Logger;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
+
+final class SaveDescriptionAction extends AbstractAction {
+ /**
+ *
+ */
+ private final ScriptPanel scriptPanel;
+ private final ExternalToolConfigView view;
+
+ private static Logger logger = Logger.getLogger(SaveDescriptionAction.class);
+
+ private static XMLOutputter outputter = new XMLOutputter(Format
+ .getPrettyFormat());
+
+ SaveDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
+ this.scriptPanel = scriptPanel;
+ this.view = view;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ UseCaseDescription currentDescription = view.makeConfiguration().getUseCaseDescription();
+ String usecaseid = currentDescription.getUsecaseid();
+ String description = currentDescription.getDescription();
+ String group = currentDescription.getGroup();
+ if ((usecaseid == null) || usecaseid.isEmpty() || (description == null) || description.isEmpty() || (group == null) || group.isEmpty()) {
+ JOptionPane.showMessageDialog(view, "Please fill in the tool annotation and\nthen re-export the description", "Missing annotation", JOptionPane.PLAIN_MESSAGE, null);
+ view.showAnnotationPanel();
+ } else {
+ saveStringToFile(this.scriptPanel,
+ "Save tool description", ".xml", currentDescription);
+ }
+ }
+
+ public static boolean saveStringToFile(Component parent, String dialogTitle, String extension, UseCaseDescription description) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setDialogTitle(dialogTitle);
+
+ fileChooser.resetChoosableFileFilters();
+ fileChooser.setAcceptAllFileFilterUsed(true);
+
+ fileChooser.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
+
+ Preferences prefs = Preferences.userNodeForPackage(FileTools.class);
+ String curDir = prefs
+ .get("currentDir", System.getProperty("user.home"));
+ fileChooser.setCurrentDirectory(new File(curDir));
+
+ boolean tryAgain = true;
+ while (tryAgain) {
+ tryAgain = false;
+ int returnVal = fileChooser.showSaveDialog(parent);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ prefs.put("currentDir", fileChooser.getCurrentDirectory()
+ .toString());
+ File file = fileChooser.getSelectedFile();
+ if (!file.getName().contains(".")) {
+ String newName = file.getName() + extension;
+ file = new File(file.getParentFile(), newName);
+ }
+
+ // TODO: Open in separate thread to avoid hanging UI
+ try {
+ List<UseCaseDescription> currentDescriptions;
+ if (file.exists()) {
+ currentDescriptions = UseCaseEnumeration.readDescriptionsFromStream(new FileInputStream(file));
+ } else {
+ currentDescriptions = new ArrayList<UseCaseDescription>();
+ }
+ Element overallElement = new Element("usecases");
+ for (UseCaseDescription ud : currentDescriptions) {
+ if (!ud.getUsecaseid().equals(description.getUsecaseid())) {
+ overallElement.addContent(ud.writeToXMLElement());
+ }
+ }
+
+ overallElement.addContent(description.writeToXMLElement());
+ BufferedWriter out = new BufferedWriter(new FileWriter(file));
+ out.write(outputter.outputString(overallElement));
+ out.close();
+ logger.info("Saved content by overwriting " + file);
+ return true;
+ } catch (IOException ex) {
+ logger.warn("Could not save content to " + file, ex);
+ JOptionPane.showMessageDialog(parent,
+ "Could not save to " + file + ": \n\n"
+ + ex.getMessage(), "Warning",
+ JOptionPane.WARNING_MESSAGE);
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ScriptPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ScriptPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ScriptPanel.java
new file mode 100644
index 0000000..c36ac8c
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ScriptPanel.java
@@ -0,0 +1,148 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+import javax.swing.text.JTextComponent;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.LineEnabledTextPanel;
+
+import org.jdom.input.SAXBuilder;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
+
+
+/**
+ * @author alanrw
+ *
+ */
+public class ScriptPanel extends JPanel {
+
+ private static final String SCRIPT_DESCRIPTION = "Specify the commands that you want to run. You can use data arriving at an input port to replace parts of the command or to write to a file. You can also take data written to a file and send it to an output port.";
+ static SAXBuilder builder = new SAXBuilder();
+ private final JTextComponent scriptTextArea;
+
+ public ScriptPanel(final ExternalToolConfigView view, JTextComponent scriptTextArea, JCheckBox stdInCheckBox, JCheckBox stdOutCheckBox, JCheckBox stdErrCheckBox, JTextField returnCodesField) {
+ super();
+ this.setLayout(new BorderLayout());
+
+ JTextArea descriptionText = new JTextArea(
+ SCRIPT_DESCRIPTION);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+ this.add(descriptionText, BorderLayout.NORTH);
+
+ this.scriptTextArea = scriptTextArea;
+
+ this.add(new LineEnabledTextPanel(scriptTextArea),
+ BorderLayout.CENTER);
+
+
+ UseCaseDescription useCaseDescription = view.getConfiguration().getUseCaseDescription();
+ stdInCheckBox.setSelected(useCaseDescription.isIncludeStdIn());
+ stdOutCheckBox.setSelected(useCaseDescription.isIncludeStdOut());
+ stdErrCheckBox.setSelected(useCaseDescription.isIncludeStdErr());
+ returnCodesField.setText(useCaseDescription.getReturnCodesAsText());
+
+ JPanel codesPanel = new JPanel(new FlowLayout());
+ codesPanel.add(new JLabel("Valid return codes:"));
+ codesPanel.add(returnCodesField);
+
+ JPanel streamPanel = new JPanel(new FlowLayout());
+ streamPanel.add(stdInCheckBox);
+ streamPanel.add(stdOutCheckBox);
+ streamPanel.add(stdErrCheckBox);
+
+ JPanel buttonPanel = new JPanel(new FlowLayout());
+ if (view.isOriginallyFromRepository()) {
+ JButton revertButton = new DeselectingButton("Revert to original description",
+ new AbstractAction(){
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ExternalToolActivityConfigurationBean bean = view.makeConfiguration();
+ String repositoryUrl = bean.getRepositoryUrl();
+ String id = bean.getExternaltoolid();
+ UseCaseDescription usecase = null;
+ try {
+ usecase = UseCaseEnumeration.readDescriptionFromUrl(
+ repositoryUrl, id);
+ }
+ catch (IOException ex) {
+ // Already logged
+ }
+ if (usecase != null) {
+ bean.setUseCaseDescription(usecase);
+ view.setEditable(false, bean);
+ } else {
+ JOptionPane.showMessageDialog(view, "Unable to find tool description " + id, "Missing tool description", JOptionPane.ERROR_MESSAGE);
+ }
+ }});
+ revertButton.setToolTipText("Revert to the tool description from the repository");
+ buttonPanel.add(revertButton);
+ }
+ JButton loadScriptButton = new DeselectingButton("Load description",
+ new LoadDescriptionAction(this, view));
+ loadScriptButton.setToolTipText("Load tool description from a file");
+
+ JButton saveScriptButton = new DeselectingButton("Export description",
+ new SaveDescriptionAction(this, view));
+ saveScriptButton.setToolTipText("Export the tool description to a file");
+
+ JButton clearScriptButton = new DeselectingButton("Clear script",
+ new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+ clearScript();
+ }
+
+ });
+ clearScriptButton.setToolTipText("Clear the script from the edit area");
+
+ buttonPanel.add(loadScriptButton);
+ buttonPanel.add(saveScriptButton);
+ buttonPanel.add(clearScriptButton);
+
+ JPanel subPanel = new JPanel(new GridLayout(3,1));
+ subPanel.add(codesPanel);
+ subPanel.add(streamPanel);
+ subPanel.add(buttonPanel);
+
+ this.add(subPanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Method for clearing the script
+ *
+ */
+ private void clearScript() {
+ if (JOptionPane.showConfirmDialog(this,
+ "Do you really want to clear the tool description?",
+ "Clearing the tool description", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
+ scriptTextArea.setText("");
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticStringPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticStringPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticStringPanel.java
new file mode 100644
index 0000000..3a1dc64
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticStringPanel.java
@@ -0,0 +1,104 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ReadOnlyTextArea;
+
+/**
+ * @author alanrw
+ *
+ */
+public class StaticStringPanel extends JPanel {
+
+ private static final String STATIC_STRING_DESCRIPTION = "A fixed string can be written to the specified file.";
+ private final List<ExternalToolStaticStringViewer> staticStringViewList;
+
+ int staticGridy = 1;
+
+ private static String[] elementLabels = new String[] {"String to copy", "To file"};
+
+ public StaticStringPanel(final List<ExternalToolStaticStringViewer> staticStringViewList) {
+ super(new BorderLayout());
+ this.staticStringViewList = staticStringViewList;
+ final JPanel staticEditPanel = new JPanel(new GridBagLayout());
+
+ final GridBagConstraints staticConstraint = new GridBagConstraints();
+ staticConstraint.insets = new Insets(5, 5, 5, 5);
+ staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ staticConstraint.gridx = 0;
+ staticConstraint.gridy = 0;
+ staticConstraint.weightx = 0.1;
+ staticConstraint.fill = GridBagConstraints.BOTH;
+
+ staticConstraint.gridx = 0;
+ synchronized (staticStringViewList) {
+ for (ExternalToolStaticStringViewer staticView : staticStringViewList) {
+ addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
+ staticView);
+ }
+ }
+
+ JTextArea descriptionText = new ReadOnlyTextArea(
+ STATIC_STRING_DESCRIPTION);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+ this.add(descriptionText, BorderLayout.NORTH);
+
+ this.add(new JScrollPane(staticEditPanel),
+ BorderLayout.CENTER);
+ JButton addStaticStringButton = new DeselectingButton("Add string",
+ new AbstractAction() {
+ // FIXME refactor this into a method
+ public void actionPerformed(ActionEvent e) {
+
+ ExternalToolStaticStringViewer newViewer = new ExternalToolStaticStringViewer();
+ synchronized (staticStringViewList) {
+ staticStringViewList.add(newViewer);
+ addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
+ newViewer);
+ staticEditPanel.revalidate();
+ staticEditPanel.repaint();
+ }
+ }
+
+ });
+
+ JPanel buttonPanel = new JPanel(new BorderLayout());
+
+ buttonPanel.add(addStaticStringButton, BorderLayout.EAST);
+
+ this.add(buttonPanel, BorderLayout.SOUTH);
+
+ }
+
+ private void addStaticStringViewer(final JPanel outerPanel,
+ final JPanel panel, ExternalToolStaticStringViewer viewer) {
+ Tools.addViewer(panel,
+ elementLabels,
+ new JComponent[] {new JScrollPane(viewer.getContentField()), viewer.getValueField()},
+ staticStringViewList,
+ viewer,
+ outerPanel);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticUrlPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticUrlPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticUrlPanel.java
new file mode 100644
index 0000000..4f1dbd6
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StaticUrlPanel.java
@@ -0,0 +1,106 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ReadOnlyTextArea;
+
+/**
+ * @author alanrw
+ *
+ */
+public class StaticUrlPanel extends JPanel {
+
+ private static final String STATIC_URL_DESCRIPTION = "The data at a URL can be downloaded and stored in the specified file.";
+ private final List<ExternalToolStaticUrlViewer> staticUrlViewList;
+ private int staticGridy = 1;
+
+ private static String[] elementLabels = new String[] {"Copy from URL", "To file"};
+
+
+ public StaticUrlPanel(final List<ExternalToolStaticUrlViewer> staticUrlViewList) {
+
+ super(new BorderLayout());
+ this.staticUrlViewList = staticUrlViewList;
+ final JPanel staticEditPanel = new JPanel(new GridBagLayout());
+
+ final GridBagConstraints staticConstraint = new GridBagConstraints();
+ staticConstraint.insets = new Insets(5, 5, 5, 5);
+ staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ staticConstraint.gridx = 0;
+ staticConstraint.gridy = 0;
+ staticConstraint.weightx = 0.1;
+ staticConstraint.fill = GridBagConstraints.BOTH;
+
+ staticConstraint.gridx = 0;
+ synchronized (staticUrlViewList) {
+ for (ExternalToolStaticUrlViewer staticView : staticUrlViewList) {
+ addStaticUrlViewer(this, staticEditPanel,
+ staticView);
+ }
+ }
+
+ this.add(new JScrollPane(staticEditPanel),
+ BorderLayout.CENTER);
+
+ JTextArea descriptionText = new ReadOnlyTextArea(
+ STATIC_URL_DESCRIPTION);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+
+ this.add(descriptionText, BorderLayout.NORTH);
+
+ JButton addstaticPortButton = new DeselectingButton("Add URL",
+ new AbstractAction() {
+ // FIXME refactor this into a method
+ public void actionPerformed(ActionEvent e) {
+
+ ExternalToolStaticUrlViewer newViewer = new ExternalToolStaticUrlViewer();
+ synchronized (staticUrlViewList) {
+ staticUrlViewList.add(newViewer);
+ addStaticUrlViewer(StaticUrlPanel.this, staticEditPanel,
+ newViewer);
+ staticEditPanel.revalidate();
+ staticEditPanel.repaint();
+ }
+ }
+
+ });
+ JPanel buttonPanel = new JPanel(new BorderLayout());
+
+ buttonPanel.add(addstaticPortButton, BorderLayout.EAST);
+
+ this.add(buttonPanel, BorderLayout.SOUTH);
+
+ }
+
+ private void addStaticUrlViewer(final JPanel outerPanel,
+ final JPanel panel, ExternalToolStaticUrlViewer viewer) {
+ Tools.addViewer(panel,
+ elementLabels,
+ new JComponent[] {viewer.getContentField(), viewer.getValueField()},
+ staticUrlViewList,
+ viewer,
+ outerPanel);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StringReplacementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StringReplacementPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StringReplacementPanel.java
new file mode 100644
index 0000000..45b1d7f
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/StringReplacementPanel.java
@@ -0,0 +1,130 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author alanrw
+ *
+ */
+public class StringReplacementPanel extends JPanel {
+
+ private static final String STRING_REPLACEMENT_DESCRIPTION = "You can use a string replacement to " +
+ "feed data into the service via an input port and have that data replace part of the " +
+ "command.";
+ private final List<ExternalToolStringReplacementViewer> stringReplacementViewList;
+ private int stringReplacementGridy = 1;
+ private final ExternalToolConfigView view;
+
+ private static Insets insets = new Insets(1,5,1,5);
+
+ private static String[] elementLabels = new String[] {"Taverna port name", "Replace port name", "String to replace"};
+
+ private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
+
+
+ public StringReplacementPanel(final ExternalToolConfigView view, final List<ExternalToolStringReplacementViewer> stringReplacementViewList) {
+ super(new BorderLayout());
+ this.view = view;
+ this.stringReplacementViewList = stringReplacementViewList;
+
+ final JPanel inputEditPanel = new JPanel(new GridBagLayout());
+
+ final GridBagConstraints inputConstraint = new GridBagConstraints();
+
+ inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy = 0;
+ inputConstraint.weightx = 0.1;
+ inputConstraint.fill = GridBagConstraints.BOTH;
+
+ inputConstraint.gridx = 0;
+ synchronized (stringReplacementViewList) {
+ for (ExternalToolStringReplacementViewer inputView : stringReplacementViewList) {
+ addStringReplacementViewer(this, inputEditPanel,
+ inputView, elementLabels);
+
+ }
+ }
+
+ JTextArea descriptionText = new JTextArea(
+ STRING_REPLACEMENT_DESCRIPTION);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+
+ this.add(descriptionText, BorderLayout.NORTH);
+ this.add(new JScrollPane(inputEditPanel),
+ BorderLayout.CENTER);
+ JButton addInputPortButton = new DeselectingButton("Add string replacement",
+ new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+
+ int portNumber = 1;
+ String name2 = "in" + portNumber++;
+ boolean nameExists = true;
+ while (nameExists == true) {
+ nameExists = view.portNameExists(name2);
+ if (nameExists) {
+ name2 = "in" + portNumber++;
+ }
+ }
+
+ ExternalToolStringReplacementViewer newViewer = new ExternalToolStringReplacementViewer(
+ name2);
+ synchronized (stringReplacementViewList) {
+ stringReplacementViewList.add(newViewer);
+ addStringReplacementViewer(StringReplacementPanel.this, inputEditPanel,
+ newViewer, elementLabels);
+ inputEditPanel.revalidate();
+ inputEditPanel.repaint();
+ }
+
+ }
+
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BorderLayout());
+
+ buttonPanel.add(addInputPortButton, BorderLayout.EAST);
+
+ this.add(buttonPanel, BorderLayout.SOUTH);
+ }
+
+ private void addStringReplacementViewer(final JPanel outerPanel,
+ final JPanel innerPanel, final ExternalToolStringReplacementViewer viewer, String[] elementLabels) {
+ Tools.addViewer(innerPanel,
+ elementLabels,
+ new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField()},
+ stringReplacementViewList,
+ viewer,
+ outerPanel);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ToolXMLPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ToolXMLPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ToolXMLPanel.java
new file mode 100644
index 0000000..f3e8b9b
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ToolXMLPanel.java
@@ -0,0 +1,33 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import org.apache.taverna.renderers.impl.XMLTree;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ToolXMLPanel extends JPanel {
+
+ public ToolXMLPanel(UseCaseDescription useCaseDescription) {
+ super(new BorderLayout());
+ XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
+ this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
+ }
+
+ public void regenerateTree(UseCaseDescription useCaseDescription) {
+ this.removeAll();
+ XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
+ this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
deleted file mode 100644
index 9307977..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.local.LocalInvocationMechanismEditor
-net.sf.taverna.t2.activities.externaltool.manager.ssh.SshInvocationMechanismEditor
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index e94cf6e..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolServiceProvider
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index db316f2..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,4 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.menu.ConfigureExternalToolMenuAction
-# net.sf.taverna.t2.activities.externaltool.menu.FeedbackMenuAction
-net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolContextualMenuAction
-net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
deleted file mode 100644
index e6686a0..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerShutdownHook
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
deleted file mode 100644
index 0dd97e4..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerStartupHook
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index cdafd5d..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolActivityIcon
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index b3d1525..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationUIFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index ca0d30f..0000000
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.views.ExternalToolActivityViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor
new file mode 100644
index 0000000..c7e77f2
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor
@@ -0,0 +1,2 @@
+org.apache.taverna.activities.externaltool.manager.local.LocalInvocationMechanismEditor
+org.apache.taverna.activities.externaltool.manager.ssh.SshInvocationMechanismEditor
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..85b2281
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1,2 @@
+org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolServiceProvider
+org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..3ecf793
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,4 @@
+org.apache.taverna.activities.externaltool.menu.ConfigureExternalToolMenuAction
+# org.apache.taverna.activities.externaltool.menu.FeedbackMenuAction
+org.apache.taverna.activities.externaltool.menu.AddExternalToolContextualMenuAction
+org.apache.taverna.activities.externaltool.menu.AddExternalToolMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
new file mode 100644
index 0000000..196d2af
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.externaltool.manager.InvocationGroupManagerShutdownHook
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
new file mode 100644
index 0000000..25ab1dd
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.externaltool.manager.InvocationGroupManagerStartupHook
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..95db995
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolActivityIcon
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..b5cec7c
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.externaltool.manager.ToolInvocationConfigurationUIFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..30770cc
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.externaltool.views.ExternalToolActivityViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml b/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
index 3d7110c..996fbc9 100644
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
@@ -8,32 +8,32 @@
<service ref="ToolInvocationConfigurationUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
- <service ref="InvocationGroupManagerStartupHook" interface="net.sf.taverna.t2.workbench.StartupSPI" />
+ <service ref="InvocationGroupManagerStartupHook" interface="org.apache.taverna.workbench.StartupSPI" />
- <service ref="ExternalToolActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="ExternalToolActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="LocalInvocationMechanismEditor" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" />
- <service ref="SshInvocationMechanismEditor" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" />
+ <service ref="LocalInvocationMechanismEditor" interface="org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor" />
+ <service ref="SshInvocationMechanismEditor" interface="org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor" />
- <service ref="ExternalToolServiceProvider" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
- <service ref="ExternalToolTemplateServiceDescription" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="ExternalToolServiceProvider" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="ExternalToolTemplateServiceDescription" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="ConfigureExternalToolMenuAction" auto-export="interfaces" />
<service ref="AddExternalToolContextualMenuAction" auto-export="interfaces" />
<service ref="AddExternalToolMenuAction" auto-export="interfaces" />
- <service ref="InvocationGroupManagerShutdownHook" interface="net.sf.taverna.t2.workbench.ShutdownSPI" />
+ <service ref="InvocationGroupManagerShutdownHook" interface="org.apache.taverna.workbench.ShutdownSPI" />
- <service ref="ExternalToolActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="ExternalToolActivityViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <list id="mechanismCreators" interface="net.sf.taverna.t2.activities.externaltool.manager.MechanismCreator" cardinality="0..N" />
- <list id="invocationMechanismEditors" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" cardinality="0..N" />
+ <list id="mechanismCreators" interface="org.apache.taverna.activities.externaltool.manager.MechanismCreator" cardinality="0..N" />
+ <list id="invocationMechanismEditors" interface="org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor" cardinality="0..N" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml b/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
index 7cf7f63..54f9cd7 100644
--- a/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
+++ b/taverna-external-tool-activity-ui/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
@@ -3,44 +3,44 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="ToolInvocationConfigurationUIFactory" class="net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationUIFactory">
+ <bean id="ToolInvocationConfigurationUIFactory" class="org.apache.taverna.activities.externaltool.manager.ToolInvocationConfigurationUIFactory">
<property name="mechanismCreators" ref="mechanismCreators" />
<property name="invocationMechanismEditors" ref="invocationMechanismEditors" />
</bean>
- <bean id="InvocationGroupManagerStartupHook" class="net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerStartupHook" />
+ <bean id="InvocationGroupManagerStartupHook" class="org.apache.taverna.activities.externaltool.manager.InvocationGroupManagerStartupHook" />
- <bean id="ExternalToolActivityIcon" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolActivityIcon">
+ <bean id="ExternalToolActivityIcon" class="org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolActivityIcon">
<property name="colourManager" ref="colourManager" />
</bean>
- <bean id="LocalInvocationMechanismEditor" class="net.sf.taverna.t2.activities.externaltool.manager.local.LocalInvocationMechanismEditor" />
- <bean id="SshInvocationMechanismEditor" class="net.sf.taverna.t2.activities.externaltool.manager.ssh.SshInvocationMechanismEditor" />
+ <bean id="LocalInvocationMechanismEditor" class="org.apache.taverna.activities.externaltool.manager.local.LocalInvocationMechanismEditor" />
+ <bean id="SshInvocationMechanismEditor" class="org.apache.taverna.activities.externaltool.manager.ssh.SshInvocationMechanismEditor" />
- <bean id="ExternalToolServiceProvider" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolServiceProvider" />
- <bean id="ExternalToolTemplateServiceDescription" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription" />
+ <bean id="ExternalToolServiceProvider" class="org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolServiceProvider" />
+ <bean id="ExternalToolTemplateServiceDescription" class="org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription" />
- <bean id="ConfigureExternalToolMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.ConfigureExternalToolMenuAction">
+ <bean id="ConfigureExternalToolMenuAction" class="org.apache.taverna.activities.externaltool.menu.ConfigureExternalToolMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
</bean>
- <bean id="AddExternalToolContextualMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolContextualMenuAction">
+ <bean id="AddExternalToolContextualMenuAction" class="org.apache.taverna.activities.externaltool.menu.AddExternalToolContextualMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
<property name="activityIconManager" ref="activityIconManager" />
</bean>
- <bean id="AddExternalToolMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolMenuAction">
+ <bean id="AddExternalToolMenuAction" class="org.apache.taverna.activities.externaltool.menu.AddExternalToolMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
<property name="activityIconManager" ref="activityIconManager" />
</bean>
- <bean id="InvocationGroupManagerShutdownHook" class="net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerShutdownHook" />
+ <bean id="InvocationGroupManagerShutdownHook" class="org.apache.taverna.activities.externaltool.manager.InvocationGroupManagerShutdownHook" />
- <bean id="ExternalToolActivityViewFactory" class="net.sf.taverna.t2.activities.externaltool.views.ExternalToolActivityViewFactory">
+ <bean id="ExternalToolActivityViewFactory" class="org.apache.taverna.activities.externaltool.views.ExternalToolActivityViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/actions/LocalworkerActivityConfigurationAction.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
deleted file mode 100644
index 056e868..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
+++ /dev/null
@@ -1,117 +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.localworker.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.Action;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.activities.localworker.views.LocalworkerActivityConfigView;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * The {@link LocalworkerActivity}s have pre-defined scripts, ports etc in a serialised form on
- * disk. So if the user wants to change them they have to do so at own risk.
- *
- * @author Ian Dunlop
- */
-@SuppressWarnings("serial")
-public class LocalworkerActivityConfigurationAction extends ActivityConfigurationAction {
-
- public static final String EDIT_LOCALWORKER_SCRIPT = "Edit beanshell script";
-
- private final EditManager editManager;
-
- private final FileManager fileManager;
-
- private final ApplicationConfiguration applicationConfiguration;
-
- private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- public LocalworkerActivityConfigurationAction(Activity activity, Frame owner,
- EditManager editManager, FileManager fileManager,
- ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry,
- ApplicationConfiguration applicationConfiguration) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.applicationConfiguration = applicationConfiguration;
- putValue(Action.NAME, EDIT_LOCALWORKER_SCRIPT);
- }
-
- /**
- * If the localworker has not been changed it pops up a {@link JOptionPane} warning the user
- * that they change things at their own risk. Otherwise just show the config view
- */
- public void actionPerformed(ActionEvent e) {
- Object[] options = { "Continue", "Cancel" };
- Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
- JsonNode json = configuration.getJson();
- if (!json.get("isAltered").booleanValue()) {
- int n = JOptionPane
- .showOptionDialog(
- null,
- "Changing the properties of a Local Worker may affect its behaviour. Do you want to continue?",
- "WARNING", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
- null, // do not use a
- // custom Icon
- options, options[0]);
-
- if (n == 0) {
- // continue was clicked so prepare for config
- openDialog();
- } else {
- // do nothing
- }
- } else {
- openDialog();
- }
- }
-
- private void openDialog() {
- ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
- .getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
- final LocalworkerActivityConfigView localworkerConfigView = new LocalworkerActivityConfigView(
- getActivity(), applicationConfiguration);
- final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
- localworkerConfigView, editManager);
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/menu/ConfigureLocalworkerMenuAction.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
deleted file mode 100644
index 3afed8d..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package net.sf.taverna.t2.activities.localworker.menu;
-
-import javax.swing.Action;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-import net.sf.taverna.t2.activities.beanshell.actions.BeanshellActivityConfigurationAction;
-import net.sf.taverna.t2.activities.localworker.actions.LocalworkerActivityConfigurationAction;
-import net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
-import net.sf.taverna.t2.ui.menu.MenuComponent;
-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 ConfigureLocalworkerMenuAction extends AbstractConfigureActivityMenuAction implements
- MenuComponent, ContextualMenuComponent {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ApplicationConfiguration applicationConfiguration;
-
- public ConfigureLocalworkerMenuAction() {
- super(LocalworkerServiceDescription.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- Action result = null;
- result = new LocalworkerActivityConfigurationAction(findActivity(), getParentFrame(),
- editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
- applicationConfiguration);
- result.putValue(Action.NAME, BeanshellActivityConfigurationAction.EDIT_BEANSHELL_SCRIPT);
- addMenuDots(result);
- return result;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
deleted file mode 100644
index 7d6bb5a..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
+++ /dev/null
@@ -1,58 +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.localworker.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- * @author David Withers
- */
-public class LocalworkerActivityIcon implements ActivityIconSPI {
-
- private static Icon icon;
-
- public int canProvideIconScore(URI activityType) {
- if (LocalworkerServiceDescription.ACTIVITY_TYPE.equals(activityType))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getLocalworkerIcon();
- }
-
- public static Icon getLocalworkerIcon() {
- if (icon == null) {
- icon = new ImageIcon(LocalworkerActivityIcon.class
- .getResource("/localworker.png"));
- }
- return icon;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
deleted file mode 100644
index 713de2c..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package net.sf.taverna.t2.activities.localworker.servicedescriptions;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class LocalworkerServiceDescription extends ServiceDescription {
-
- public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/localworker");
-
- private static final String LOCALWORKER = ServiceDescription.LOCAL_SERVICES;
-
- private JsonNode json;
- private String operation;
- private String category;
- private String provider;
- private String localworkerName;
-
- public JsonNode getJson() {
- return json;
- }
-
- public void setJson(JsonNode json) {
- this.json = json;
- }
-
- public String getOperation() {
- return operation;
- }
-
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getLocalworkerName() {
- return localworkerName;
- }
-
- public void setLocalworkerName(String localworkerName) {
- this.localworkerName = localworkerName;
- }
-
- public String getType() {
- return "Localworker";
- }
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- configuration.setJson(getJson());
- return configuration;
- }
-
- @Override
- public Icon getIcon() {
- return LocalworkerActivityIcon.getLocalworkerIcon();
- }
-
- @Override
- public String getName() {
- return operation;
- }
-
- @Override
- public List<? extends Comparable<?>> getPath() {
- List<String> result =
- Arrays.asList (LOCALWORKER, category);
- return result;
- }
-
- @Override
- protected List<Object> getIdentifyingData() {
- return Arrays.<Object>asList(getJson());
- }
-
-}
[18/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
new file mode 100644
index 0000000..54a516f
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroupManager;
+import org.apache.taverna.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+
+/**
+ * ExternalToolServiceDescription stores the repository URL and the use case id so
+ * that it can create an ExternalToolActivityConfigurationBean
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolServiceDescription extends ServiceDescription<ExternalToolActivityConfigurationBean> {
+
+ private static Logger logger = Logger
+ .getLogger(ExternalToolServiceDescription.class);
+
+
+ private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+
+ private String repositoryUrl;
+ private String externaltoolid;
+ private UseCaseDescription useCaseDescription;
+
+ public String getRepositoryUrl() {
+ return repositoryUrl;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ public String getExternaltoolid() {
+ return externaltoolid;
+ }
+
+ public void setExternaltoolid(String externaltoolid) {
+ this.externaltoolid = externaltoolid;
+ }
+
+ public Icon getIcon() {
+ if (useCaseDescription != null) {
+ String icon_url = useCaseDescription.getIcon_url();
+ if ((icon_url != null) && !icon_url.isEmpty() && !icon_url.endsWith(".ico"))
+ try {
+ ImageIcon result = new ImageIcon(new URL(icon_url));
+ if ((result != null) && (result.getIconHeight() != 0) && (result.getIconWidth() != 0)){
+ return result;
+ }
+ } catch (MalformedURLException e) {
+ logger.error("Problematic URL" + icon_url, e);
+ }
+ }
+ return ExternalToolActivityIcon.getExternalToolIcon();
+ }
+
+ public Class<? extends Activity<ExternalToolActivityConfigurationBean>> getActivityClass() {
+ return ExternalToolActivity.class;
+ }
+
+ public ExternalToolActivityConfigurationBean getActivityConfiguration() {
+ ExternalToolActivityConfigurationBean bean = new ExternalToolActivityConfigurationBean();
+ bean.setRepositoryUrl(repositoryUrl);
+ bean.setExternaltoolid(externaltoolid);
+ bean.setUseCaseDescription(useCaseDescription);
+ bean.setMechanism(manager.getDefaultMechanism());
+
+ return bean;
+ }
+
+ public String getName() {
+ return externaltoolid;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<? extends Comparable> getPath() {
+ List<String> result = new ArrayList<String>();
+ result.add("Tools decribed @ " + repositoryUrl);
+ String group = useCaseDescription.getGroup();
+ if ((group != null) && !group.isEmpty()) {
+ String[] groups = group.split(":");
+ for (String g : groups) {
+ result.add(g);
+ }
+ }
+ return result;
+ }
+
+ protected List<Object> getIdentifyingData() {
+ // we require use cases inside one XML file to have unique IDs, which
+ // means every externaltool is uniquely identified by its repository URL and
+ // its use case ID.
+ return Arrays.<Object> asList(repositoryUrl, externaltoolid);
+ }
+
+ public String getDescription() {
+ if (useCaseDescription != null) {
+ String description = useCaseDescription.getDescription();
+ if (description == null) {
+ return "";
+ }
+ return description;
+ }
+ return "";
+ }
+
+ public void setUseCaseDescription(UseCaseDescription usecase) {
+ this.useCaseDescription = usecase;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
new file mode 100644
index 0000000..7ba6ae3
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.AbstractConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
+
+/**
+ * ExternalToolServiceProvider searches an use case repository XML for use case
+ * descriptions.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolServiceProvider extends AbstractConfigurableServiceProvider<ExternalToolServiceProviderConfig>
+ implements CustomizedConfigurePanelProvider<ExternalToolServiceProviderConfig> {
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/externaltool");
+
+ public ExternalToolServiceProvider() {
+ super(new ExternalToolServiceProviderConfig("http://taverna.nordugrid.org/sharedRepository/xml.php"));
+ }
+
+ public String getName() {
+ return "Tool service";
+ }
+
+ public List<ExternalToolServiceProviderConfig> getDefaultConfigurations() {
+ List<ExternalToolServiceProviderConfig> defaults = new ArrayList<ExternalToolServiceProviderConfig>();
+ // Disabled until sensible set
+// defaults.add(new ExternalToolServiceProviderConfig("http://taverna.nordugrid.org/sharedRepository/xml.php"));
+ return defaults;
+ }
+
+ public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
+ String repositoryUrl = serviceProviderConfig.getRepositoryUrl();
+ callBack.status("Parsing use case repository:" + repositoryUrl);
+ // prepare a list of all use case descriptions which are stored in
+ // the given repository URL
+ List<UseCaseDescription> usecases = new ArrayList<UseCaseDescription> ();
+ try {
+ usecases = UseCaseEnumeration.readDescriptionsFromUrl(
+ repositoryUrl);
+ } catch (IOException e) {
+ callBack.fail("Unable to read tool descriptions", e);
+ }
+ callBack.status("Found " + usecases.size() + " use cases:" + repositoryUrl);
+ // convert all the UseCaseDescriptions in the XML file into
+ // ExternalToolServiceDescription items
+ List<ExternalToolServiceDescription> items = new ArrayList<ExternalToolServiceDescription>();
+ for (UseCaseDescription usecase : usecases) {
+ ExternalToolServiceDescription item = new ExternalToolServiceDescription();
+ item.setRepositoryUrl(repositoryUrl);
+ item.setExternaltoolid(usecase.getUsecaseid());
+ item.setUseCaseDescription(usecase);
+ items.add(item);
+ }
+ // we dont have streaming data loading or partial results, so return
+ // results and finish
+ callBack.partialResults(items);
+ callBack.finished();
+ }
+
+ @Override
+ public String toString() {
+ return getName() + " " + getConfiguration().getRepositoryUrl();
+ }
+
+ public Icon getIcon() {
+ return ExternalToolActivityIcon.getExternalToolIcon();
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ List<String> result;
+ // one can fully identify an use case repository by its URL
+ result = Arrays.asList(getConfiguration().getRepositoryUrl());
+ return result;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry registry) {
+ }
+
+ @SuppressWarnings("serial")
+ public void createCustomizedConfigurePanel(final CustomizedConfigureCallBack<ExternalToolServiceProviderConfig> callBack) {
+
+ AddExternalToolServiceDialog addWSDLServiceDialog = new AddExternalToolServiceDialog() {
+ @Override
+ protected void addRegistry(String externalToolURL) {
+
+ ExternalToolServiceProviderConfig providerConfig = new ExternalToolServiceProviderConfig(externalToolURL);
+ callBack.newProviderConfiguration(providerConfig);
+ }
+ };
+ addWSDLServiceDialog.setVisible(true);
+ }
+
+
+ public String getId() {
+ return providerId.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
new file mode 100644
index 0000000..a95fdb3
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import org.apache.taverna.lang.beans.PropertyAnnotated;
+import org.apache.taverna.lang.beans.PropertyAnnotation;
+
+/**
+ * ExternalToolServiceProviderConfig stores the URL of the use case repository XML file
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolServiceProviderConfig extends PropertyAnnotated {
+ private String repositoryUrl;
+
+ public ExternalToolServiceProviderConfig() {
+ }
+
+ public ExternalToolServiceProviderConfig(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ @PropertyAnnotation(displayName = "Tool registry location", preferred = true)
+ public String getRepositoryUrl() {
+ return repositoryUrl;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ @Override
+ public String toString() {
+ return repositoryUrl;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
new file mode 100644
index 0000000..835db90
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
@@ -0,0 +1,77 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import java.net.URI;
+import java.util.UUID;
+
+import javax.swing.Icon;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroupManager;
+import org.apache.taverna.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolTemplateServiceDescription extends
+ AbstractTemplateService<ExternalToolActivityConfigurationBean> {
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/external-tool");
+
+ private static final String EXTERNAL_TOOL = "Tool";
+
+ private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+
+ @Override
+ public Class<? extends Activity<ExternalToolActivityConfigurationBean>> getActivityClass() {
+ return ExternalToolActivity.class;
+ }
+
+ @Override
+ public ExternalToolActivityConfigurationBean getActivityConfiguration() {
+ ExternalToolActivityConfigurationBean result = new ExternalToolActivityConfigurationBean();
+ result.setExternaltoolid(UUID.randomUUID().toString());
+ result.setUseCaseDescription(new UseCaseDescription(""));
+ result.setMechanism(manager.getDefaultMechanism());
+ return result;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return ExternalToolActivityIcon.getExternalToolIcon();
+ }
+
+ @Override
+ public String getDescription() {
+ return "A service that allows tools to be used as services";
+ }
+
+ @SuppressWarnings("unchecked")
+ public static ServiceDescription getServiceDescription() {
+ ExternalToolTemplateServiceDescription bts = new ExternalToolTemplateServiceDescription();
+ return bts.templateService;
+ }
+
+
+
+ @Override
+ public String getId() {
+ return providerId.toString();
+ }
+
+ @Override
+ public String getName() {
+ return EXTERNAL_TOOL;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/utils/Tools.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/utils/Tools.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/utils/Tools.java
new file mode 100644
index 0000000..e2bed9b
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/utils/Tools.java
@@ -0,0 +1,129 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.utils;
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.CompoundBorder;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author alanrw
+ *
+ */
+public class Tools {
+
+ private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
+
+ private static Insets insets = new Insets(5,5,5,5);
+
+ public static void addViewer(final JPanel innerPanel, String[] labels, JComponent[] elements,
+ final List viewerList, final Object viewer, final JPanel outerPanel) {
+ final JPanel subPanel = new JPanel();
+ subPanel.setLayout(new GridBagLayout());
+ subPanel.setBorder(border);
+
+ final GridBagConstraints labelConstraint = new GridBagConstraints();
+ labelConstraint.insets = insets;
+ labelConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ labelConstraint.fill = GridBagConstraints.BOTH;
+ labelConstraint.gridy = 0;
+ labelConstraint.gridx = 0;
+ labelConstraint.weightx = 0;
+
+ final GridBagConstraints elementConstraint = new GridBagConstraints();
+ elementConstraint.insets = insets;
+ elementConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ elementConstraint.fill = GridBagConstraints.BOTH;
+ elementConstraint.gridy = 0;
+ elementConstraint.gridx = 1;
+ elementConstraint.weightx = 1.0;
+
+ final GridBagConstraints removeConstraint = new GridBagConstraints();
+ removeConstraint.insets = insets;
+ removeConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ removeConstraint.fill = GridBagConstraints.BOTH;
+ removeConstraint.gridx = 1;
+ removeConstraint.weightx = 0;
+ removeConstraint.fill = GridBagConstraints.NONE;
+ removeConstraint.anchor = GridBagConstraints.EAST;
+
+ final GridBagConstraints subPanelConstraint = new GridBagConstraints();
+ subPanelConstraint.insets = insets;
+ subPanelConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ subPanelConstraint.fill = GridBagConstraints.BOTH;
+ subPanelConstraint.gridx = 1;
+// subPanelConstraint.gridy = ++stringReplacementGridy;
+ subPanelConstraint.weightx = 1.00;
+ subPanelConstraint.fill = GridBagConstraints.HORIZONTAL;
+ subPanelConstraint.anchor = GridBagConstraints.WEST;
+
+ for (int i = 0; i < labels.length; i++) {
+ subPanel.add(new JLabel(labels[i] + ":"), labelConstraint);
+ subPanel.add(elements[i], elementConstraint);
+ labelConstraint.gridy++;
+ elementConstraint.gridy++;
+ }
+
+ removeConstraint.gridy = labelConstraint.gridy + 1;
+ final JButton removeButton = new DeselectingButton("Remove",
+ new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+ synchronized (viewerList) {
+ viewerList.remove(viewer);
+ }
+ innerPanel.remove(subPanel);
+ innerPanel.revalidate();
+ innerPanel.repaint();
+ outerPanel.revalidate();
+ outerPanel.repaint();
+ }
+
+ });
+ subPanel.add(removeButton, removeConstraint);
+ innerPanel.add(subPanel, subPanelConstraint);
+ }
+
+ public static boolean isStringReplacement(ScriptInputUser si) {
+ return !si.isList() && !si.isFile() && !si.isTempFile();
+ }
+
+ public static boolean isInputFile(ScriptInputUser si) {
+ return !si.isList() && si.isFile();
+ }
+
+ public static boolean isFileList(ScriptInputUser si) {
+ return si.isList() && si.isFile();
+ }
+
+ public static boolean isUnderstood(ScriptInputUser si) {
+ return isStringReplacement(si) || isInputFile(si) || isFileList(si);
+ }
+
+ public static boolean areAllUnderstood(Map<String, ScriptInput> inputs) {
+ for (ScriptInput si : inputs.values()) {
+ if ((si instanceof ScriptInputUser) && !isUnderstood((ScriptInputUser) si)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/AnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/AnnotationPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/AnnotationPanel.java
new file mode 100644
index 0000000..3f977c4
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/AnnotationPanel.java
@@ -0,0 +1,41 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+/**
+ * @author alanrw
+ *
+ */
+public class AnnotationPanel extends JPanel {
+
+ public AnnotationPanel(Component nameField, Component descriptionArea, Component groupField) {
+ super();
+ this.setLayout(new BorderLayout());
+ JPanel subPanel = new JPanel(new BorderLayout());
+ JPanel namePanel = new JPanel();
+ namePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+ namePanel.add(new JLabel("Name: "));
+ namePanel.add(nameField);
+ subPanel.add(namePanel, BorderLayout.NORTH);
+ JPanel groupPanel = new JPanel();
+ groupPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
+ groupPanel.add(new JLabel("Group: "));
+ groupPanel.add(groupField);
+ subPanel.add(groupPanel, BorderLayout.SOUTH);
+ this.add(subPanel, BorderLayout.NORTH);
+ JPanel descriptionPanel = new JPanel();
+ descriptionPanel.setLayout(new BorderLayout());
+ descriptionPanel.add(new JLabel("Description:"), BorderLayout.NORTH);
+ descriptionPanel.add(descriptionArea, BorderLayout.CENTER);
+ this.add(descriptionPanel, BorderLayout.CENTER);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/EditablePanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/EditablePanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/EditablePanel.java
new file mode 100644
index 0000000..9b32218
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/EditablePanel.java
@@ -0,0 +1,72 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author alanrw
+ *
+ */
+public class EditablePanel extends JPanel {
+ public EditablePanel(final ExternalToolConfigView view) {
+ super(new FlowLayout());
+
+ JButton update = new DeselectingButton("Update tool description",
+ new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ExternalToolActivityConfigurationBean bean = view.getConfiguration();
+ String repositoryUrl = bean.getRepositoryUrl();
+ String id = bean.getExternaltoolid();
+ UseCaseDescription usecase = null;
+ try {
+ usecase = UseCaseEnumeration.readDescriptionFromUrl(
+ repositoryUrl, id);
+ }
+ catch (IOException ex) {
+ // Already logged
+ }
+ if (usecase != null) {
+ bean.setUseCaseDescription(usecase);
+ view.refreshConfiguration(bean);
+ } else {
+ JOptionPane.showMessageDialog(view, "Unable to find tool description " + id, "Missing tool description", JOptionPane.ERROR_MESSAGE);
+ }
+ }});
+ this.add(update);
+
+ JButton makeEditable = new DeselectingButton("Edit tool description",
+ new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ ExternalToolActivityConfigurationBean config = view.makeConfiguration();
+ view.setEditable(true, config);
+
+ }
+ });
+ makeEditable.setToolTipText("Edit the tool description");
+ if (Tools.areAllUnderstood(view.getConfiguration().getUseCaseDescription().getInputs())) {
+ this.add(makeEditable);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityContextualView.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityContextualView.java
new file mode 100644
index 0000000..c1c819e
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityContextualView.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (C) 2010 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.views;
+
+import java.awt.Frame;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.actions.ExternalToolActivityConfigureAction;
+import org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolActivityIcon;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+
+/**
+ * ExternalToolActivityContextualView displays the use case information in a HTML table. Currently,
+ * this is only the use case ID.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolActivityContextualView extends
+ HTMLBasedActivityContextualView<ExternalToolActivityConfigurationBean> {
+ private static final long serialVersionUID = 1L;
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+
+ public ExternalToolActivityContextualView(Activity<?> activity, EditManager editManager,
+ FileManager fileManager, ColourManager colourManager, ActivityIconManager activityIconManager) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ String html = "";
+ ExternalToolActivityConfigurationBean bean = getConfigBean();
+ String repositoryUrl = bean.getRepositoryUrl();
+ if ((repositoryUrl == null) || repositoryUrl.isEmpty()) {
+ repositoryUrl = "<b>Not specified</b>";
+ }
+ html += "<tr><td>Repository URL</td><td>" + repositoryUrl + "</td></tr>";
+
+ String id = bean.getExternaltoolid();
+ if ((id == null) || id.isEmpty()) {
+ id = "<b>Not specified</b>";
+ }
+ html += "<tr><td>Id</td><td>" + id + "</td></tr>";
+
+ UseCaseDescription useCaseDescription = bean.getUseCaseDescription();
+ String name = useCaseDescription.getUsecaseid();
+ if ((name == null) || name.isEmpty()) {
+ name = "<b>Not specified</b>";
+ }
+ html += "<tr><td>Name</td><td>" + name + "</td></tr>";
+
+ Map<String, ScriptInput> stringReplacements = new TreeMap<String, ScriptInput>();
+ Map<String, ScriptInput> fileInputs = new TreeMap<String, ScriptInput>();
+
+ for (Entry<String, ScriptInput> entry : useCaseDescription.getInputs().entrySet()) {
+ String key = entry.getKey();
+ ScriptInput value = entry.getValue();
+ if (value.isFile()) {
+ fileInputs.put(key, value);
+ } else if (value.isTempFile()) {
+ // Nothing
+ } else {
+ stringReplacements.put(key, value);
+ }
+ }
+
+ if (!stringReplacements.isEmpty()) {
+ html += "<tr><td colspan=2 align=center><b>String replacements</b></td></tr>";
+ html += "<tr><td><b>Port name</b></td><td><b>Replaces</b></td></tr>";
+ for (String siName : stringReplacements.keySet()) {
+ html += "<tr><td>" + siName + "</td>";
+ ScriptInput si = stringReplacements.get(siName);
+ html += "<td>%%" + si.getTag() + "%%</td>";
+
+ html += "</tr>";
+ }
+ }
+
+ if (!fileInputs.isEmpty()) {
+ html += "<tr><td colspan=2 align=center><b>File inputs</b></td></tr>";
+ html += "<tr><td><b>Port name</b></td><td><b>To file</b></td></tr>";
+ for (String siName : fileInputs.keySet()) {
+ html += "<tr><td>" + siName + "</td>";
+ ScriptInput si = fileInputs.get(siName);
+ html += "<td>" + si.getTag() + "</td>";
+
+ html += "</tr>";
+ }
+ }
+
+ List<ScriptInputStatic> staticInputs = useCaseDescription.getStatic_inputs();
+ if (!staticInputs.isEmpty()) {
+ html += "<tr><td colspan=2 align=center><b>Static inputs</b></td></tr>";
+ html += "<tr><td><b>Type</b></td><td><b>To file</b></td></tr>";
+ for (ScriptInputStatic si : staticInputs) {
+ if (si.getUrl() != null) {
+ html += "<td><b>URL</b></td>";
+ } else {
+ html += "<td><b>Explicit content</b></td>";
+ }
+ if (si.isFile()) {
+ html += "<td>" + si.getTag() + "</td>";
+ }
+ html += "</tr>";
+ }
+ }
+ Map<String, ScriptOutput> outputs = useCaseDescription.getOutputs();
+ if (!outputs.isEmpty()) {
+ html += "<tr><td colspan=2 align=center><b>File outputs</b></td></tr>";
+ html += "<tr><td><b>Port name</b></td><td><b>From file</b></td></tr>";
+ for (String soName : outputs.keySet()) {
+ html += "<tr><td>" + soName + "</td>";
+ ScriptOutput so = outputs.get(soName);
+ html += "<td>" + so.getPath() + "</td>";
+ html += "</tr>";
+ }
+ }
+ return html;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Tool service";
+ }
+
+ @Override
+ public Action getConfigureAction(final Frame owner) {
+ return new ExternalToolActivityConfigureAction((ExternalToolActivity) getActivity(), owner,
+ editManager, fileManager, activityIconManager);
+ }
+
+ public String getBackgroundColour() {
+
+ return ExternalToolActivityIcon.getColourString();
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityViewFactory.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityViewFactory.java
new file mode 100644
index 0000000..202c018
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolActivityViewFactory.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (C) 2010 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+/**
+ * ExternalToolActivityViewFactory produces an ExternalToolActivityContextualView to show
+ * information for a use case activity.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolActivityViewFactory implements ContextualViewFactory<ExternalToolActivity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+
+ public boolean canHandle(Object object) {
+ if (object instanceof ExternalToolActivity) {
+ return true;
+ }
+ return false;
+ }
+
+ public List<ContextualView> getViews(ExternalToolActivity selection) {
+ return Arrays.asList(new ContextualView[] { new ExternalToolActivityContextualView(
+ selection, editManager, fileManager, colourManager, activityIconManager) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolConfigView.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolConfigView.java
new file mode 100644
index 0000000..6327ac2
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolConfigView.java
@@ -0,0 +1,868 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.externaltool.views;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.help.CSH;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JEditorPane;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTextPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityHealthChecker;
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.KeywordDocument;
+import org.apache.taverna.lang.ui.LinePainter;
+import org.apache.taverna.lang.ui.NoWrapEditorKit;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+
+import org.apache.log4j.Logger;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
+import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
+
+/**
+ * Provides the configurable view for a {@link ExternalToolActivity} through
+ * it's {@link ExternalToolActivityConfigurationBean}. Has 3 main tabs - Script,
+ * Ports & Dependencies. The {@link #inputViewList} contains the
+ * {@link ExternalToolInputViewer}s describing the input ports and
+ * {@link #outputViewList} has the {@link ExternalToolFileViewer}s
+ *
+ * @author Ian Dunlop
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ *
+ */
+@SuppressWarnings("serial")
+public class ExternalToolConfigView
+ extends
+ ActivityConfigurationPanel<ExternalToolActivity, ExternalToolActivityConfigurationBean> {
+
+ private static final Color LINE_COLOR = new Color(225,225,225);
+
+ private static final String FILE_INPUT_DESCRIPTION = "You can use a file input to feed data into " +
+ "the service via an input port and have that data written to the specified file.";
+
+ private static final String FILE_OUTPUT_DESCRIPTION = "You can use a file output to take the " +
+ "content of a file produced by the tool and send it to an output port of the service.";
+
+ private static final String FILE_LIST_DESCRIPTION = "If you feed a list of data into a file list " +
+ "input, then each data item is written to a temporary file. A file is produced containing " +
+ "the names of those temporary file. That index file can then be used as part of the tool " +
+ "command.";
+
+ private static final String VALID_NAME_REGEX = "[\\p{L}\\p{Digit}_]+";
+
+ private static Logger logger = Logger
+ .getLogger(ExternalToolConfigView.class);
+
+ /** The activity which this view describes */
+ protected ExternalToolActivity activity;
+
+ /** The configuration bean used to configure the activity */
+ private ExternalToolActivityConfigurationBean configuration;
+
+ private JTabbedPane tabbedPane = null;
+ private JPanel advancedPanel = null;
+ private JTabbedPane advancedTab = null;
+ private AnnotationPanel annotationPanel = null;
+
+ private int stringReplacementGridy = 1;
+ private List<ExternalToolStringReplacementViewer> stringReplacementViewList = new ArrayList<ExternalToolStringReplacementViewer>();
+
+ private List<ExternalToolFileViewer> inputFileViewList = new ArrayList<ExternalToolFileViewer>();
+
+ private List<ExternalToolFileViewer> fileListViewList = new ArrayList<ExternalToolFileViewer>();
+
+ private int inputGridy = 1;
+
+ private int outputGridy = 1;
+ private List<ExternalToolFileViewer> outputViewList = new ArrayList<ExternalToolFileViewer>();
+
+ private int staticGridy = 1;
+ private List<ExternalToolStaticUrlViewer> staticUrlViewList = new ArrayList<ExternalToolStaticUrlViewer>();
+
+ private List<ExternalToolStaticStringViewer> staticStringViewList = new ArrayList<ExternalToolStaticStringViewer>();
+
+/* private List<ExternalToolRuntimeEnvironmentViewer> runtimeEnvironmentViewList = new ArrayList<ExternalToolRuntimeEnvironmentViewer>();
+*/
+
+ private JTextField nameField = new JTextField(20);
+ private JTextField groupField = new JTextField(20);
+ private JTextArea descriptionArea = new JTextArea(6, 40);
+
+ private JEditorPane scriptTextArea;
+
+ private InvocationPanel invocationPanel;
+
+ private JCheckBox stdInCheckBox = new JCheckBox("Show STDIN");
+ private JCheckBox stdOutCheckBox = new JCheckBox("Show STDOUT");
+ private JCheckBox stdErrCheckBox = new JCheckBox("Show STDERR");
+
+ private JTextField returnCodesField = new JTextField(20);
+
+ /**
+ * Stores the {@link ExternalToolActivity}, gets its
+ * {@link ExternalToolActivityConfigurationBean}, sets the layout and calls
+ * {@link #initialise()} to get the view going
+ *
+ * @param activity
+ * the {@link ExternalToolActivity} that the view is over
+ */
+ public ExternalToolConfigView(ExternalToolActivity activity) {
+ this.activity = activity;
+ ExternalToolActivityHealthChecker.updateLocation(activity.getConfiguration());
+ configuration = (ExternalToolActivityConfigurationBean) cloneBean(activity
+ .getConfiguration());
+ setLayout(new GridBagLayout());
+ initialise(configuration);
+ }
+
+ public void noteConfiguration() {
+ configuration = makeConfiguration();
+ }
+
+ public ExternalToolActivityConfigurationBean makeConfiguration() {
+ ExternalToolActivityConfigurationBean newConfiguration = (ExternalToolActivityConfigurationBean) cloneBean(configuration);
+ ExternalToolActivityHealthChecker.updateLocation(newConfiguration);
+
+
+ if (!isFromRepository()) {
+ UseCaseDescription ucd = newConfiguration.getUseCaseDescription();
+
+ ucd.setUsecaseid(nameField.getText());
+ if (groupField.getText().isEmpty()) {
+ ucd.setGroup(null);
+ } else {
+ ucd.setGroup(groupField.getText());
+ }
+ ucd.setDescription(descriptionArea.getText());
+ ucd.setCommand(scriptTextArea.getText());
+ ucd.setReturnCodesAsText(returnCodesField.getText());
+ ucd.setIncludeStdIn(stdInCheckBox.isSelected());
+ ucd.setIncludeStdOut(stdOutCheckBox.isSelected());
+ ucd.setIncludeStdErr(stdErrCheckBox.isSelected());
+
+ ucd.getInputs().clear();
+ ucd.getTags().clear();
+ synchronized (fileListViewList) {
+ for (ExternalToolFileViewer viewer : fileListViewList) {
+ ScriptInputUser si = new ScriptInputUser();
+ si.setBinary(viewer.isBinary());
+ si.setList(true);
+ si.setTag(viewer.getValue());
+ si.setTempFile(false);
+ si.setFile(true);
+ ucd.getInputs().put(viewer.getName(), si);
+ }
+ }
+
+ synchronized (stringReplacementViewList) {
+ for (ExternalToolStringReplacementViewer viewer : stringReplacementViewList) {
+ ScriptInputUser si = new ScriptInputUser();
+ si.setBinary(false);
+ si.setList(false);
+ si.setTag(viewer.getValue());
+ si.setTempFile(false);
+ si.setFile(false);
+ ucd.getTags().add(si.getTag());
+ ucd.getInputs().put(viewer.getName(), si);
+ }
+ }
+
+ synchronized (inputFileViewList) {
+ for (ExternalToolFileViewer viewer : inputFileViewList) {
+ ScriptInputUser si = new ScriptInputUser();
+ si.setBinary(viewer.isBinary());
+ si.setList(false);
+ si.setTag(viewer.getValue());
+ si.setTempFile(false);
+ si.setFile(true);
+ ucd.getInputs().put(viewer.getName(), si);
+ }
+ }
+
+ synchronized (outputViewList) {
+ ucd.getOutputs().clear();
+ for (ExternalToolFileViewer viewer : outputViewList) {
+ ScriptOutput so = new ScriptOutput();
+ so.setBinary(viewer.isBinary());
+ so.setPath(viewer.getValue());
+ ucd.getOutputs().put(viewer.getName(), so);
+ }
+ }
+ ucd.getStatic_inputs().clear();
+ synchronized (staticStringViewList) {
+ for (ExternalToolStaticStringViewer viewer : staticStringViewList) {
+ ScriptInputStatic sis = new ScriptInputStatic();
+ sis.setContent(viewer.getContent());
+ sis.setTag(viewer.getValue());
+ sis.setTempFile(false);
+ sis.setFile(true);
+ ucd.getStatic_inputs().add(sis);
+ }
+ }
+ synchronized (staticUrlViewList) {
+ for (ExternalToolStaticUrlViewer viewer : staticUrlViewList) {
+ ScriptInputStatic sis = new ScriptInputStatic();
+ sis.setUrl(viewer.getContent());
+ sis.setTag(viewer.getValue());
+ sis.setTempFile(false);
+ sis.setFile(true);
+ ucd.getStatic_inputs().add(sis);
+ }
+ }
+
+/* synchronized (runtimeEnvironmentViewList) {
+ ucd.getREs().clear();
+ for (ExternalToolRuntimeEnvironmentViewer viewer : runtimeEnvironmentViewList) {
+ RuntimeEnvironmentConstraint newConstraint = new RuntimeEnvironmentConstraint(
+ viewer.getId(), viewer.getRelation());
+ ucd.getREs().add(newConstraint);
+ }
+ }*/
+ }
+ invocationPanel.fillInConfiguration(newConfiguration);
+
+ return newConfiguration;
+ }
+
+ public boolean isConfigurationChanged() {
+ String configurationString = convertBeanToString(activity
+ .getConfiguration());
+ return (!convertBeanToString(makeConfiguration()).equals(
+ configurationString));
+ }
+
+ /**
+ * Adds a {@link JButton} which handles the reconfiguring of the
+ * {@link ExternalToolActivity} through the altered
+ * {@link ExternalToolActivityConfigurationBean}. Sets up the initial tabs -
+ * Script (also sets the initial value), Ports & Dependencies and their
+ * initial values through {@link #setDependencies()},
+ * {@link #getPortPanel()}
+ */
+ private void initialise(ExternalToolActivityConfigurationBean configuration) {
+ CSH.setHelpIDString(
+ this,
+ "net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ExternalToolConfigView");
+ this.configuration = configuration;
+ setBorder(javax.swing.BorderFactory.createTitledBorder(null, null,
+ javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+ javax.swing.border.TitledBorder.DEFAULT_POSITION,
+ new java.awt.Font("Lucida Grande", 1, 12)));
+
+ tabbedPane = new JTabbedPane();
+
+ if (invocationPanel != null) {
+ invocationPanel.stopObserving();
+ }
+
+ if (!isFromRepository()) {
+ UseCaseDescription useCaseDescription = configuration
+ .getUseCaseDescription();
+
+ nameField.setText(useCaseDescription.getUsecaseid());
+ if (useCaseDescription.getGroup() != null) {
+ groupField.setText(useCaseDescription.getGroup());
+ }
+ descriptionArea.setText(useCaseDescription.getDescription());
+ stringReplacementViewList = new ArrayList<ExternalToolStringReplacementViewer>();
+ inputFileViewList = new ArrayList<ExternalToolFileViewer>();
+ fileListViewList = new ArrayList<ExternalToolFileViewer>();
+ outputViewList = new ArrayList<ExternalToolFileViewer>();
+ staticUrlViewList = new ArrayList<ExternalToolStaticUrlViewer>();
+ staticStringViewList = new ArrayList<ExternalToolStaticStringViewer>();
+/* runtimeEnvironmentViewList = new ArrayList<ExternalToolRuntimeEnvironmentViewer>();*/
+
+ for (Entry<String, ScriptInput> entry : useCaseDescription
+ .getInputs().entrySet()) {
+ String name = entry.getKey();
+ ScriptInputUser si = (ScriptInputUser) entry.getValue();
+ if (Tools.isStringReplacement(si)) {
+ final ExternalToolStringReplacementViewer inputView = new ExternalToolStringReplacementViewer(
+ name, si);
+ stringReplacementViewList.add(inputView);
+ }
+
+ }
+ Collections.sort(stringReplacementViewList,
+ new Comparator<ExternalToolStringReplacementViewer>() {
+
+ @Override
+ public int compare(
+ ExternalToolStringReplacementViewer o1,
+ ExternalToolStringReplacementViewer o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ for (Entry<String, ScriptInput> entry : useCaseDescription
+ .getInputs().entrySet()) {
+ String name = entry.getKey();
+ ScriptInputUser si = (ScriptInputUser) entry.getValue();
+ if (Tools.isInputFile(si)) {
+ final ExternalToolFileViewer inputView = new ExternalToolFileViewer(
+ name, si.getTag(), si.isBinary());
+ inputFileViewList.add(inputView);
+ }
+
+ }
+ Collections.sort(inputFileViewList,
+ new Comparator<ExternalToolFileViewer>() {
+
+ @Override
+ public int compare(ExternalToolFileViewer o1,
+ ExternalToolFileViewer o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ for (Entry<String, ScriptInput> entry : useCaseDescription
+ .getInputs().entrySet()) {
+ String name = entry.getKey();
+ ScriptInputUser si = (ScriptInputUser) entry.getValue();
+ if (Tools.isFileList(si)) {
+ final ExternalToolFileViewer inputView = new ExternalToolFileViewer(
+ name, si.getTag(), si.isBinary());
+ fileListViewList.add(inputView);
+ }
+
+ }
+ Collections.sort(fileListViewList,
+ new Comparator<ExternalToolFileViewer>() {
+
+ @Override
+ public int compare(ExternalToolFileViewer o1,
+ ExternalToolFileViewer o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ for (Entry<String, ScriptOutput> entry : useCaseDescription
+ .getOutputs().entrySet()) {
+ ScriptOutput so = entry.getValue();
+ final ExternalToolFileViewer outputView = new ExternalToolFileViewer(
+ entry.getKey(), so.getPath(), so.isBinary());
+ outputViewList.add(outputView);
+ }
+ Collections.sort(outputViewList,
+ new Comparator<ExternalToolFileViewer>() {
+
+ @Override
+ public int compare(ExternalToolFileViewer o1,
+ ExternalToolFileViewer o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+
+ for (ScriptInputStatic siss : useCaseDescription.getStatic_inputs()) {
+ if ((siss.getUrl() == null) && siss.isFile()) {
+ final ExternalToolStaticStringViewer staticView = new ExternalToolStaticStringViewer(
+ siss);
+ staticStringViewList.add(staticView);
+ }
+ }
+ Collections.sort(staticStringViewList,
+ new Comparator<ExternalToolStaticStringViewer>() {
+
+ @Override
+ public int compare(ExternalToolStaticStringViewer o1,
+ ExternalToolStaticStringViewer o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+
+ for (ScriptInputStatic sis : useCaseDescription.getStatic_inputs()) {
+ if ((sis.getUrl() != null) && sis.isFile()) {
+ final ExternalToolStaticUrlViewer staticView = new ExternalToolStaticUrlViewer(
+ sis);
+ staticUrlViewList.add(staticView);
+ }
+ }
+ Collections.sort(staticUrlViewList,
+ new Comparator<ExternalToolStaticUrlViewer>() {
+
+ @Override
+ public int compare(ExternalToolStaticUrlViewer o1,
+ ExternalToolStaticUrlViewer o2) {
+ return o1.getContent().compareTo(o2.getContent());
+ }
+ });
+
+/* for (RuntimeEnvironmentConstraint rec : useCaseDescription.getREs()) {
+ final ExternalToolRuntimeEnvironmentViewer newView = new ExternalToolRuntimeEnvironmentViewer(
+ rec.getID(), rec.getRelation());
+ runtimeEnvironmentViewList.add(newView);
+ }
+ Collections.sort(runtimeEnvironmentViewList,
+ new Comparator<ExternalToolRuntimeEnvironmentViewer>() {
+
+ @Override
+ public int compare(
+ ExternalToolRuntimeEnvironmentViewer o1,
+ ExternalToolRuntimeEnvironmentViewer o2) {
+ return o1.getId().compareTo(o2.getId());
+ }
+ });*/
+
+ scriptTextArea = new JTextPane();
+ new LinePainter(scriptTextArea, LINE_COLOR);
+
+ final KeywordDocument doc = new KeywordDocument(
+ new HashSet<String>());
+ // NOTE: Due to T2-1145 - always set editor kit BEFORE setDocument
+ scriptTextArea.setEditorKit(new NoWrapEditorKit());
+ scriptTextArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
+ scriptTextArea.setDocument(doc);
+ scriptTextArea.setText(useCaseDescription.getCommand());
+ scriptTextArea.setCaretPosition(0);
+ scriptTextArea.setPreferredSize(new Dimension(200, 100));
+
+ tabbedPane.addTab("Command", new ScriptPanel(this, scriptTextArea, stdInCheckBox, stdOutCheckBox, stdErrCheckBox, returnCodesField));
+ tabbedPane.addTab("String replacements",
+ new StringReplacementPanel(this, stringReplacementViewList));
+ tabbedPane.addTab(
+ "File inputs",
+ new FilePanel(this, inputFileViewList, "To file", "File type",
+ "in", FILE_INPUT_DESCRIPTION, "Add file input"));
+ tabbedPane.addTab(
+ "File outputs",
+ new FilePanel(this, outputViewList, "From file", "File type",
+ "out", FILE_OUTPUT_DESCRIPTION, "Add file output"));
+ advancedPanel = new JPanel();
+ advancedPanel.setLayout(new GridBagLayout());
+ GridBagConstraints advancedConstraint = new GridBagConstraints();
+ advancedConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ advancedConstraint.gridx = 0;
+ advancedConstraint.gridy = 0;
+
+ advancedConstraint.fill = GridBagConstraints.BOTH;
+ advancedConstraint.weighty = 0.1;
+ advancedConstraint.weightx = 0.1;
+ advancedTab = new JTabbedPane();
+ advancedTab.addTab("Strings", new StaticStringPanel(staticStringViewList));
+ advancedTab.addTab("URLs", new StaticUrlPanel(staticUrlViewList));
+ advancedTab.addTab(
+ "File lists",
+ new FilePanel(this, fileListViewList,
+ "To file containing list", "Individual file type",
+ "in", FILE_LIST_DESCRIPTION, "Add file list"));
+ annotationPanel = new AnnotationPanel(nameField, descriptionArea, groupField);
+ advancedTab.addTab("Annotation", annotationPanel);
+ final ToolXMLPanel toolXMLPanel = new ToolXMLPanel(configuration.getUseCaseDescription());
+ advancedTab.addTab("XML", toolXMLPanel);
+ advancedTab.addChangeListener(new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ if (advancedTab.getSelectedComponent() == toolXMLPanel) {
+ toolXMLPanel.regenerateTree(makeConfiguration().getUseCaseDescription());
+ }
+ }});
+ tabbedPane.addChangeListener(new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ if ((tabbedPane.getSelectedComponent() == advancedPanel) &&
+ (advancedTab.getSelectedComponent() == toolXMLPanel)) {
+ toolXMLPanel.regenerateTree(makeConfiguration().getUseCaseDescription());
+ }
+ }
+
+ });
+/* advancedTab.addTab("Runtime environments",
+ createRuntimeEnvironmentPanel(runtimeEnvironmentViewList));*/
+ advancedPanel.add(advancedTab, advancedConstraint);
+ tabbedPane.addTab("Advanced", advancedPanel);
+ }
+ invocationPanel = new InvocationPanel(configuration);
+
+ tabbedPane.addTab("Location", invocationPanel);
+ if (isFromRepository()) {
+ tabbedPane.addTab("Edit", new EditablePanel(this));
+ }
+ GridBagConstraints outerConstraint = new GridBagConstraints();
+ outerConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ outerConstraint.gridx = 0;
+ outerConstraint.gridy = 0;
+
+ outerConstraint.fill = GridBagConstraints.BOTH;
+ outerConstraint.weighty = 0.1;
+ outerConstraint.weightx = 0.1;
+ add(tabbedPane, outerConstraint);
+
+ setPreferredSize(new Dimension(700, 500));
+ this.validate();
+ }
+
+ public void whenOpened() {
+ if (scriptTextArea != null) {
+ scriptTextArea.requestFocus();
+ }
+ }
+
+ private boolean isFromRepository() {
+ return (!this.configuration.isEdited() && isOriginallyFromRepository());
+ }
+
+ public boolean isOriginallyFromRepository() {
+ String repositoryUrl = this.configuration.getRepositoryUrl();
+ return ((repositoryUrl != null) && !repositoryUrl
+ .isEmpty());
+
+ }
+
+
+ @Override
+ public ExternalToolActivityConfigurationBean getConfiguration() {
+ return configuration;
+ }
+
+ public void refreshConfiguration(
+ ExternalToolActivityConfigurationBean config) {
+ int visibleTab = -1;
+ int secondaryTab = -1;
+ if (tabbedPane != null) {
+ visibleTab = tabbedPane.getSelectedIndex();
+ if (tabbedPane.getSelectedComponent().equals(advancedTab)) {
+ secondaryTab = advancedTab.getSelectedIndex();
+ }
+ }
+ this.removeAll();
+ initialise(config);
+ if (visibleTab != -1) {
+ tabbedPane.setSelectedIndex(visibleTab);
+ }
+ if (secondaryTab != -1) {
+ advancedTab.setSelectedIndex(secondaryTab);
+ }
+ }
+
+ public void showAnnotationPanel() {
+ tabbedPane.setSelectedComponent(advancedPanel);
+ advancedTab.setSelectedComponent(annotationPanel);
+ }
+
+ @Override
+ public void refreshConfiguration() {
+ refreshConfiguration(activity.getConfiguration());
+ }
+
+ static Pattern tagPattern = Pattern.compile("%%([^%]*)%%");
+
+ @Override
+ /**
+ * Need to check that the script contains the string replacements and only them - done
+ *
+ * Need to check the input port names are valid and unique - done
+ * Need to check the output port names are valid and unique - done
+ *
+ * Need to check the input files and static files are unique - done
+ * Need to check the file names are valid
+ * Need to check the URLs are valid
+ * Need to check the replacement tags are unique - done
+ */
+ public boolean checkValues() {
+ if (isFromRepository()) {
+ return true;
+ }
+ boolean result = true;
+ String text = "";
+ Set<String> stringReplacementPortNames = new HashSet<String>();
+ Set<String> stringReplacementTags = new HashSet<String>();
+ for (ExternalToolStringReplacementViewer v : stringReplacementViewList) {
+ String name = v.getName();
+ if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
+ text += "A string replacement port has a reserved name \"" + name + "\"\n";
+ result = false;
+ }
+ else if (stringReplacementPortNames.contains(name)) {
+ text += "Two string replacement ports have the name \"" + name
+ + "\"\n";
+ result = false;
+ } else if (!name.matches(VALID_NAME_REGEX)) {
+ text += "String replacement port name \"" + name
+ + "\" is invalid\n";
+ result = false;
+ } else {
+ stringReplacementPortNames.add(name);
+ }
+
+ String tag = v.getValue();
+ if (stringReplacementTags.contains(tag)) {
+ text += "Two string replacement ports replace \"%%" + tag
+ + "%%\"\n";
+ result = false;
+ } else if (!tag.matches(VALID_NAME_REGEX)) {
+ text += "String replacement tag \"%%" + tag
+ + "%%\" is invalid\n";
+ result = false;
+ } else {
+ stringReplacementTags.add(tag);
+ }
+ }
+
+ Matcher m = tagPattern.matcher(scriptTextArea.getText());
+ Set<String> tags = new HashSet<String>();
+ while (m.find()) {
+ String tag = m.group(1);
+ if (tag != null) {
+ if (tag.isEmpty()) {
+ text += "The command contains an empty tag i.e. %%%%\n";
+ result = false;
+ } else {
+ if (!tag.matches(VALID_NAME_REGEX)) {
+ text += "The command contains an invalid tag \"%%"
+ + tag + "\"%%\n";
+ result = false;
+ }
+ if (!stringReplacementTags.contains(tag)) {
+ text += "There is no string replacement for %%" + tag
+ + "%%\n";
+ result = false;
+ } else {
+ tags.add(tag);
+ }
+ }
+ }
+ }
+
+ for (String tag : stringReplacementTags) {
+ if (!tags.contains(tag)) {
+ text += "String replacement for %%" + tag
+ + "%% is not used in the command\n";
+ result = false;
+ }
+ }
+
+ Set<String> inputFilePortNames = new HashSet<String>();
+ Set<String> inputFileNames = new HashSet<String>();
+ for (ExternalToolFileViewer v : inputFileViewList) {
+ String name = v.getName();
+ if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
+ text += "An input file port has a reserved name \"" + name + "\"\n";
+ result = false;
+ }
+ else if (stringReplacementPortNames.contains(name)) {
+ text += "A string replacement port and an input file port have the name \""
+ + name + "\"\n";
+ result = false;
+ } else if (inputFilePortNames.contains(name)) {
+ text += "Two file input ports have the name \"" + name + "\"\n";
+ result = false;
+ } else if (!name.matches(VALID_NAME_REGEX)) {
+ text += "File input port name \"" + name + "\" is invalid\n";
+ result = false;
+ } else {
+ inputFilePortNames.add(name);
+ }
+
+ String fileName = v.getValue();
+ if (inputFileNames.contains(fileName)) {
+ text += "Two file inputs ports write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else {
+ inputFileNames.add(fileName);
+ }
+ }
+
+ Set<String> fileListPortNames = new HashSet<String>();
+ Set<String> fileListFileNames = new HashSet<String>();
+ for (ExternalToolFileViewer v : fileListViewList) {
+ String name = v.getName();
+ if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
+ text += "A file list port has a reserved name \"" + name + "\"\n";
+ result = false;
+ } else if (stringReplacementPortNames.contains(name)) {
+ text += "A string replacement port and a file list port have the name \""
+ + name + "\"\n";
+ result = false;
+ } else if (inputFilePortNames.contains(name)) {
+ text += "A file input port and a file list port have the name \""
+ + name + "\"\n";
+ result = false;
+ } else if (fileListPortNames.contains(name)) {
+ text += "Two file list ports have the name \"" + name + "\"\n";
+ result = false;
+ } else if (!name.matches(VALID_NAME_REGEX)) {
+ text += "File list port name \"" + name + "\" is invalid\n";
+ result = false;
+ } else {
+ fileListPortNames.add(name);
+ }
+
+ String fileName = v.getValue();
+ if (fileListFileNames.contains(fileName)) {
+ text += "Two file list ports write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else if (inputFileNames.contains(fileName)) {
+ text += "A file input port and a file list port write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else {
+ fileListFileNames.add(fileName);
+ }
+ }
+
+ Set<String> staticStringFileNames = new HashSet<String>();
+ for (ExternalToolStaticStringViewer v : staticStringViewList) {
+ String fileName = v.getValue();
+ if (staticStringFileNames.contains(fileName)) {
+ text += "Two static strings write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else if (inputFileNames.contains(fileName)) {
+ text += "A file input port and a static string write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else if (fileListFileNames.contains(fileName)) {
+ text += "A file list port and a static string write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else {
+ staticStringFileNames.add(fileName);
+ }
+ }
+
+ Set<String> staticUrlFileNames = new HashSet<String>();
+ for (ExternalToolStaticUrlViewer v : staticUrlViewList) {
+ String fileName = v.getValue();
+ if (staticUrlFileNames.contains(fileName)) {
+ text += "Two static URLss write to the same file \"" + fileName
+ + "\"\n";
+ result = false;
+ } else if (inputFileNames.contains(fileName)) {
+ text += "A file input port and a static URL write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else if (fileListFileNames.contains(fileName)) {
+ text += "A file list port and a static URL write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else if (staticStringFileNames.contains(fileName)) {
+ text += "A static string and a static URL write to the same file \""
+ + fileName + "\"\n";
+ result = false;
+ } else {
+ staticUrlFileNames.add(fileName);
+ }
+ }
+ Set<String> outputPortNames = new HashSet<String>();
+ for (ExternalToolFileViewer v : outputViewList) {
+ String name = v.getName();
+ if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
+ text += "An output port has a reserved name \"" + name + "\"\n";
+ result = false;
+ } else if (outputPortNames.contains(name)) {
+ text += "Two output file ports have the name \"" + name
+ + "\"\n";
+ result = false;
+ } else if (!name.matches(VALID_NAME_REGEX)) {
+ text += "Output file port name \"" + name + "\" is invalid\n";
+ result = false;
+ } else {
+ outputPortNames.add(name);
+ }
+ }
+ if (!result) {
+ JOptionPane.showMessageDialog(this, text, "Problems",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return result;
+ }
+
+ /**
+ * Check the proposed port name against the set of ports
+ *
+ * @return
+ */
+ public boolean portNameExists(String name) {
+ if (name.equalsIgnoreCase("stdin") || name.equalsIgnoreCase("stdout") || name.equalsIgnoreCase("stderr")) {
+ return true;
+ }
+
+ for (ExternalToolFileViewer v : inputFileViewList) {
+ if (name.equals(v.getName())) {
+ return true;
+ }
+ }
+ for (ExternalToolFileViewer v : fileListViewList) {
+ if (name.equals(v.getName())) {
+ return true;
+ }
+ }
+ for (ExternalToolStringReplacementViewer v : stringReplacementViewList) {
+ if (name.equals(v.getName())) {
+ return true;
+ }
+ }
+ for (ExternalToolFileViewer v : outputViewList) {
+ if (name.equals(v.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public void setEditable(boolean editable, ExternalToolActivityConfigurationBean config) {
+ ExternalToolActivityConfigurationBean newConfig = (ExternalToolActivityConfigurationBean) cloneBean(config);
+ ExternalToolActivityHealthChecker.updateLocation(newConfig);
+ newConfig.setEdited(editable);
+ refreshConfiguration(newConfig);
+ }
+
+ public void whenClosed() {
+ if (invocationPanel != null) {
+ invocationPanel.stopObserving();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolFileViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolFileViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolFileViewer.java
new file mode 100644
index 0000000..f23cf2a
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolFileViewer.java
@@ -0,0 +1,103 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolFileViewer {
+
+ private JTextField nameField;
+ private String name;
+ private JTextField valueField;
+ private JCheckBox valueFromField;
+ private JComboBox typeSelector;
+
+ public ExternalToolFileViewer(String name, String value, boolean isBinary) {
+ this(name);
+ nameField.setText(name);
+ if (!value.equals(name)) {
+ valueFromField.setSelected(false);
+ valueField.setText(value);
+ valueField.setEnabled(true);
+ }
+ if (isBinary) {
+ typeSelector.setSelectedItem("Binary");
+ } else {
+ typeSelector.setSelectedItem("Text");
+ }
+ }
+
+ public ExternalToolFileViewer(final String name) {
+ this.name = name;
+ nameField = new JTextField(20);
+ valueField = new JTextField(20);
+ valueFromField = new JCheckBox(new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (valueFromField.isSelected()) {
+ valueField.setText("");
+ valueField.setEnabled(false);
+ } else {
+ valueField.setText(getName());
+ valueField.setEnabled(true);
+ }
+ }});
+ valueFromField.setSelected(true);
+ valueField.setEnabled(false);
+ typeSelector = new JComboBox(new String[] {"Binary", "Text"});
+ nameField.setText(name);
+ typeSelector.setSelectedItem("Text");
+
+ }
+
+ public JTextField getNameField() {
+ return nameField;
+ }
+
+ public JTextField getValueField() {
+ return valueField;
+ }
+
+ public JComboBox getTypeSelector() {
+ return typeSelector;
+ }
+
+ public String getName() {
+ return nameField.getText();
+ }
+
+ public boolean isBinary() {
+ return (typeSelector.getSelectedItem().equals("Binary"));
+ }
+
+ public String getValue() {
+ if (valueFromField.isSelected()) {
+ return getName();
+ }
+ return valueField.getText();
+ }
+
+ /**
+ * @return the valueFromField
+ */
+ public JCheckBox getValueFromField() {
+ return valueFromField;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
new file mode 100644
index 0000000..efc0cf6
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolRuntimeEnvironmentViewer.java
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import de.uni_luebeck.inb.knowarc.usecases.RuntimeEnvironmentConstraint;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolRuntimeEnvironmentViewer {
+
+ private JTextField idField;
+ private JComboBox relationSelector;
+
+ public ExternalToolRuntimeEnvironmentViewer(String id, String relation) {
+ this(id);
+ idField.setText(id);
+ relationSelector.setSelectedItem(relation);
+ }
+
+ public ExternalToolRuntimeEnvironmentViewer(String id) {
+ this();
+ idField.setText(id);
+ }
+
+ public ExternalToolRuntimeEnvironmentViewer() {
+ idField = new JTextField(20);
+ relationSelector = new JComboBox(RuntimeEnvironmentConstraint.getAcceptedRelations());
+ relationSelector.setSelectedItem(RuntimeEnvironmentConstraint.getDefaultRelation());
+ }
+
+ public JTextField getIdField() {
+ return idField;
+ }
+
+ public JComboBox getRelationSelector() {
+ return relationSelector;
+ }
+
+ public String getId() {
+ return idField.getText();
+ }
+
+ public String getRelation() {
+ return (String) relationSelector.getSelectedItem();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticStringViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticStringViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticStringViewer.java
new file mode 100644
index 0000000..8615e85
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticStringViewer.java
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolStaticStringViewer {
+
+ ScriptInputStatic input;
+ private JTextArea contentField = new JTextArea();
+ private JTextField valueField;
+
+
+ public ExternalToolStaticStringViewer(ScriptInputStatic input) {
+ this();
+ this.input = input;
+ contentField.setText((String) input.getContent());
+ valueField.setText(input.getTag());
+ }
+
+ public ExternalToolStaticStringViewer() {
+ contentField = new JTextArea(5, 40);
+ contentField.setText("");
+ valueField = new JTextField(20);
+ valueField.setText("");
+ }
+
+ public String getContent() {
+ return contentField.getText();
+ }
+
+ public JTextArea getContentField() {
+ return contentField;
+ }
+
+
+ public JTextField getValueField() {
+ return valueField;
+ }
+
+ public String getValue() {
+ return valueField.getText();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticUrlViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticUrlViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticUrlViewer.java
new file mode 100644
index 0000000..53948b0
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStaticUrlViewer.java
@@ -0,0 +1,56 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import javax.swing.JComboBox;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolStaticUrlViewer {
+
+ ScriptInputStatic input;
+ private JTextField contentField = new JTextField();
+ private JTextField valueField;
+
+
+ public ExternalToolStaticUrlViewer(ScriptInputStatic input) {
+ this();
+ this.input = input;
+ contentField.setText(input.getUrl());
+ valueField.setText(input.getTag());
+ }
+
+ public ExternalToolStaticUrlViewer() {
+ contentField = new JTextField(40);
+ contentField.setText("");
+ valueField = new JTextField(20);
+ valueField.setText("");
+ }
+
+ public String getContent() {
+ return contentField.getText();
+ }
+
+ public JTextField getContentField() {
+ return contentField;
+ }
+
+
+ public JTextField getValueField() {
+ return valueField;
+ }
+
+ public String getValue() {
+ return valueField.getText();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStringReplacementViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStringReplacementViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStringReplacementViewer.java
new file mode 100644
index 0000000..55d9809
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/ExternalToolStringReplacementViewer.java
@@ -0,0 +1,97 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.event.ActionEvent;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.AbstractAction;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
+import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolStringReplacementViewer {
+
+ private static Pattern p = Pattern.compile("\\w+");
+ private static final String PERCENTS = "%%";
+ ScriptInput input;
+ private JTextField nameField;
+ private String name;
+ private JTextField valueField;
+ private JCheckBox valueFromField;
+
+ public ExternalToolStringReplacementViewer(String name, ScriptInputUser input) {
+ this(name);
+ this.input = input;
+ nameField.setText(name);
+ if (!input.getTag().equals(name)) {
+ valueFromField.setSelected(false);
+ valueField.setText(PERCENTS + input.getTag() + PERCENTS);
+ valueField.setEnabled(true);
+ }
+ }
+
+ public ExternalToolStringReplacementViewer(String name) {
+ this.name = name;
+ nameField = new JTextField(20);
+ nameField.setText(name);
+ valueField = new JTextField(20);
+ valueFromField = new JCheckBox(new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (valueFromField.isSelected()) {
+ valueField.setText("");
+ valueField.setEnabled(false);
+ } else {
+ valueField.setText(PERCENTS + getName() + PERCENTS);
+ valueField.setEnabled(true);
+ }
+ }});
+ valueFromField.setSelected(true);
+ valueField.setEnabled(false);
+ }
+
+ public JTextField getNameField() {
+ return nameField;
+ }
+
+ public JTextField getValueField() {
+ return valueField;
+ }
+
+ public String getName() {
+ return nameField.getText();
+ }
+
+ public String getValue() {
+ if (valueFromField.isSelected()) {
+ return getName();
+ }
+ String enteredValue = valueField.getText();
+
+ Matcher m = p.matcher(enteredValue);
+ String result = "";
+ if (m.find()) {
+ result = m.group();
+ }
+ return result;
+ }
+
+ /**
+ * @return the valueFromField
+ */
+ public JCheckBox getValueFromField() {
+ return valueFromField;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/FilePanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/FilePanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/FilePanel.java
new file mode 100644
index 0000000..d493ae1
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/views/FilePanel.java
@@ -0,0 +1,119 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.views;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.activities.externaltool.utils.Tools;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ReadOnlyTextArea;
+
+/**
+ * @author alanrw
+ *
+ */
+public class FilePanel extends JPanel {
+
+ private int outputGridy = 1;
+ private final ExternalToolConfigView view;
+
+ public FilePanel(final ExternalToolConfigView view,
+ final List<ExternalToolFileViewer> viewList,
+ String fileHeader, String typeHeader, final String portPrefix,
+ final String description, String addText) {
+ super();
+ this.view = view;
+ this.setLayout(new BorderLayout());
+ final JPanel fileEditPanel = new JPanel(new GridBagLayout());
+
+ final GridBagConstraints fileConstraint = new GridBagConstraints();
+ fileConstraint.insets = new Insets(5, 5, 5, 5);
+ fileConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ fileConstraint.gridx = 0;
+ fileConstraint.gridy = 0;
+ fileConstraint.weightx = 0.1;
+ fileConstraint.fill = GridBagConstraints.BOTH;
+
+ final String[] elementLabels = new String[] {"Taverna port name",
+ "Use port name for file",
+ fileHeader,
+ typeHeader
+ };
+
+ fileConstraint.gridx = 0;
+ synchronized (viewList) {
+ for (ExternalToolFileViewer outputView : viewList) {
+ addFileViewer(viewList, this, fileEditPanel,
+ outputView, elementLabels);
+ }
+ }
+ JButton addFilePortButton = new DeselectingButton(addText,
+ new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+
+ int portNumber = 1;
+
+ String name2 = portPrefix + portNumber++;
+ boolean nameExists = true;
+ while (nameExists == true) {
+ nameExists = view.portNameExists(name2);
+ if (nameExists) {
+ name2 = portPrefix + portNumber++;
+ }
+ }
+
+ ExternalToolFileViewer newViewer = new ExternalToolFileViewer(
+ name2);
+ synchronized (viewList) {
+ viewList.add(newViewer);
+ addFileViewer(viewList, FilePanel.this, fileEditPanel,
+ newViewer, elementLabels);
+ fileEditPanel.revalidate();
+ fileEditPanel.repaint();
+ }
+ }
+
+ });
+ JTextArea descriptionText = new ReadOnlyTextArea(description);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
+
+ this.add(descriptionText, BorderLayout.NORTH);
+
+ this.add(new JScrollPane(fileEditPanel), BorderLayout.CENTER);
+
+ JPanel buttonPanel = new JPanel(new BorderLayout());
+
+ buttonPanel.add(addFilePortButton, BorderLayout.EAST);
+
+ this.add(buttonPanel, BorderLayout.SOUTH);
+
+ }
+
+ private void addFileViewer(final List<ExternalToolFileViewer> viewList,
+ final JPanel outerPanel, final JPanel panel,
+ ExternalToolFileViewer viewer, String[] elementLabels) {
+ Tools.addViewer(panel,
+ elementLabels,
+ new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField(), viewer.getTypeSelector()},
+ viewList,
+ viewer,
+ outerPanel);
+ }
+
+}
[19/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
deleted file mode 100644
index 1f85d3a..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.manager.ssh.ExternalToolSshNodeViewer;
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- *
- */
-public class StringReplacementPanel extends JPanel {
-
- private static final String STRING_REPLACEMENT_DESCRIPTION = "You can use a string replacement to " +
- "feed data into the service via an input port and have that data replace part of the " +
- "command.";
- private final List<ExternalToolStringReplacementViewer> stringReplacementViewList;
- private int stringReplacementGridy = 1;
- private final ExternalToolConfigView view;
-
- private static Insets insets = new Insets(1,5,1,5);
-
- private static String[] elementLabels = new String[] {"Taverna port name", "Replace port name", "String to replace"};
-
- private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
-
-
- public StringReplacementPanel(final ExternalToolConfigView view, final List<ExternalToolStringReplacementViewer> stringReplacementViewList) {
- super(new BorderLayout());
- this.view = view;
- this.stringReplacementViewList = stringReplacementViewList;
-
- final JPanel inputEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints inputConstraint = new GridBagConstraints();
-
- inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- inputConstraint.gridx = 0;
- inputConstraint.gridy = 0;
- inputConstraint.weightx = 0.1;
- inputConstraint.fill = GridBagConstraints.BOTH;
-
- inputConstraint.gridx = 0;
- synchronized (stringReplacementViewList) {
- for (ExternalToolStringReplacementViewer inputView : stringReplacementViewList) {
- addStringReplacementViewer(this, inputEditPanel,
- inputView, elementLabels);
-
- }
- }
-
- JTextArea descriptionText = new JTextArea(
- STRING_REPLACEMENT_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
-
- this.add(descriptionText, BorderLayout.NORTH);
- this.add(new JScrollPane(inputEditPanel),
- BorderLayout.CENTER);
- JButton addInputPortButton = new DeselectingButton("Add string replacement",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
-
- int portNumber = 1;
- String name2 = "in" + portNumber++;
- boolean nameExists = true;
- while (nameExists == true) {
- nameExists = view.portNameExists(name2);
- if (nameExists) {
- name2 = "in" + portNumber++;
- }
- }
-
- ExternalToolStringReplacementViewer newViewer = new ExternalToolStringReplacementViewer(
- name2);
- synchronized (stringReplacementViewList) {
- stringReplacementViewList.add(newViewer);
- addStringReplacementViewer(StringReplacementPanel.this, inputEditPanel,
- newViewer, elementLabels);
- inputEditPanel.revalidate();
- inputEditPanel.repaint();
- }
-
- }
-
- });
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new BorderLayout());
-
- buttonPanel.add(addInputPortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
- }
-
- private void addStringReplacementViewer(final JPanel outerPanel,
- final JPanel innerPanel, final ExternalToolStringReplacementViewer viewer, String[] elementLabels) {
- Tools.addViewer(innerPanel,
- elementLabels,
- new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField()},
- stringReplacementViewList,
- viewer,
- outerPanel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
deleted file mode 100644
index b49211f..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import net.sf.taverna.t2.renderers.impl.XMLTree;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-/**
- * @author alanrw
- *
- */
-public class ToolXMLPanel extends JPanel {
-
- public ToolXMLPanel(UseCaseDescription useCaseDescription) {
- super(new BorderLayout());
- XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
- this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
- }
-
- public void regenerateTree(UseCaseDescription useCaseDescription) {
- this.removeAll();
- XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
- this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/actions/ExternalToolActivityConfigureAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
new file mode 100644
index 0000000..2e8d981
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ * modified 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
+ *
+ * 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 org.apache.taverna.activities.externaltool.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean;
+import org.apache.taverna.activities.externaltool.views.ExternalToolConfigView;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+
+/**
+ * This class implements an ActivityConfigurationAction to configure the ExternalToolActivity
+ * plugin. The configuration action is called "Configure UseCase invocation" and is implemented in
+ * the KnowARCConfigurationDialog inside the knowarc-usecases maven artifact.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+@SuppressWarnings("serial")
+public class ExternalToolActivityConfigureAction extends
+ ActivityConfigurationAction {// <ExternalToolActivity, ExternalToolActivityConfigurationBean> {
+
+ private final Frame owner;
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public ExternalToolActivityConfigureAction(ExternalToolActivity activity, Frame owner,
+ EditManager editManager, FileManager fileManager, ActivityIconManager activityIconManager) {
+ super(activity, activityIconManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ putValue(Action.NAME, "Configure tool invocation");
+ this.owner = owner;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ /*
+ * if (getActivity().getConfiguration() instanceof
+ * RegisteredExternalToolActivityConfigurationBean) { new KnowARCConfigurationDialog(owner,
+ * false, KnowARCConfigurationFactory.getConfiguration()).setVisible(true); } else
+ */{
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+ .getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+ final ExternalToolConfigView externalToolConfigView = new ExternalToolConfigView(
+ (ExternalToolActivity) getActivity());
+ final ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean> dialog = new ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean>(
+ getActivity(), externalToolConfigView, editManager, fileManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/configuration/ToolInvocationConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/configuration/ToolInvocationConfiguration.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/configuration/ToolInvocationConfiguration.java
new file mode 100644
index 0000000..67f8f4b
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/configuration/ToolInvocationConfiguration.java
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+
+
+/**
+ * @author alanrw
+ *
+ */
+public class ToolInvocationConfiguration extends AbstractConfigurable {
+
+ private static ToolInvocationConfiguration instance;
+
+ private Map<String, String> defaultPropertyMap;
+
+ public static ToolInvocationConfiguration getInstance() {
+ if (instance == null) {
+ instance = new ToolInvocationConfiguration();
+ }
+ return instance;
+ }
+
+ @Override
+ public String getCategory() {
+ return "general";
+ }
+
+ @Override
+ public Map<String, String> getDefaultPropertyMap() {
+ if (defaultPropertyMap == null) {
+ defaultPropertyMap = new HashMap<String, String>();
+ }
+ return defaultPropertyMap;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "Tool invocation";
+ }
+
+ @Override
+ public String getFilePrefix() {
+ return "ToolInvocation";
+ }
+
+ @Override
+ public String getUUID() {
+ return "B611F5C2-EB49-479E-B01A-7F3F56E6918A";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/GroupPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/GroupPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/GroupPanel.java
new file mode 100644
index 0000000..46710e1
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/GroupPanel.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.externaltool.manager;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroupManager;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
+
+import org.apache.taverna.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+
+/**
+ * UI for creating/editing dataflow input ports.
+ *
+ * @author David Withers
+ */
+public class GroupPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField groupNameField;
+
+ private JComboBox mechanismComboBox;
+
+ private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+
+ public GroupPanel(Object[] mechanisms) {
+ super(new GridBagLayout());
+
+ groupNameField = new JTextField();
+
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 10;
+ add(new JLabel("Name:"), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ add(groupNameField, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ constraints.weightx = 0d;
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.ipadx = 10;
+ constraints.insets = new Insets(10, 0, 0, 0);
+ add(new JLabel("Explicit location:"), constraints);
+
+ mechanismComboBox = new JComboBox(mechanisms);
+ mechanismComboBox.setSelectedItem(manager.getDefaultMechanism());
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ add(mechanismComboBox, constraints);
+ }
+
+ /**
+ * Returns the portNameField.
+ *
+ * @return the portNameField
+ */
+ public JTextField getGroupNameField() {
+ return groupNameField;
+ }
+
+ /**
+ * Returns the group name.
+ *
+ * @return the group name
+ */
+ public String getGroupName() {
+ return groupNameField.getText();
+ }
+
+ public InvocationMechanism getSelectedMechanism() {
+ return (InvocationMechanism) mechanismComboBox.getSelectedItem();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
new file mode 100644
index 0000000..c3fd2e2
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
@@ -0,0 +1,34 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager;
+
+import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.workbench.ShutdownSPI;
+
+/**
+ * @author alanrw
+ *
+ */
+public class InvocationGroupManagerShutdownHook implements ShutdownSPI {
+
+ /* (non-Javadoc)
+ * @see net.sf.taverna.t2.workbench.ShutdownSPI#positionHint()
+ */
+ @Override
+ public int positionHint() {
+ return 710;
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.taverna.t2.workbench.ShutdownSPI#shutdown()
+ */
+ @Override
+ public boolean shutdown() {
+ InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+ manager.saveConfiguration();
+ manager.persistInvocations();
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerStartupHook.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
new file mode 100644
index 0000000..5e03bf7
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 org.apache.taverna.activities.externaltool.manager;
+
+import org.apache.taverna.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.workbench.StartupSPI;
+
+/**
+ * Load previously saved workflow ids that were scheduled to be deleted before
+ * previous Taverna shutdown, and initiate deletion of them now.
+ *
+ * @see StoreRunIdsToDeleteLaterShutdownHook
+ * @see DatabaseCleanup
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class InvocationGroupManagerStartupHook implements StartupSPI {
+
+ public int positionHint() {
+ return 900;
+ }
+
+ public boolean startup() {
+ InvocationGroupManagerImpl.getInstance().loadInvocations();
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationMechanismEditor.java
new file mode 100644
index 0000000..a4affaf
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/InvocationMechanismEditor.java
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager;
+
+import javax.swing.JPanel;
+
+/**
+ * @author alanrw
+ *
+ */
+public abstract class InvocationMechanismEditor<T extends InvocationMechanism> extends JPanel {
+
+ public abstract String getName();
+
+ public abstract boolean canShow(Class<?> c);
+
+ public abstract void show(T invocationMechanism);
+
+ public abstract T updateInvocationMechanism();
+
+ public abstract InvocationMechanism createMechanism(String mechanismName);
+
+ public boolean isSingleton() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/MechanismPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/MechanismPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/MechanismPanel.java
new file mode 100644
index 0000000..7f85c68
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/MechanismPanel.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.externaltool.manager;
+
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.List;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * UI for creating/editing dataflow input ports.
+ *
+ * @author David Withers
+ */
+public class MechanismPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField mechanismNameField;
+
+ private JComboBox mechanismTypeSelector;
+
+ public MechanismPanel(List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
+ super(new GridBagLayout());
+
+ mechanismNameField = new JTextField();
+
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 10;
+ add(new JLabel("Name:"), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ add(mechanismNameField, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ constraints.weightx = 0d;
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.ipadx = 10;
+ constraints.insets = new Insets(10, 0, 0, 0);
+ add(new JLabel("Type:"), constraints);
+
+ mechanismTypeSelector = new JComboBox();
+ for (InvocationMechanismEditor<?> ime : invocationMechanismEditors) {
+ if (!ime.isSingleton()) {
+ mechanismTypeSelector.addItem(ime.getName());
+ }
+ }
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ add(mechanismTypeSelector, constraints);
+
+
+ }
+
+ /**
+ * Returns the portNameField.
+ *
+ * @return the portNameField
+ */
+ public JTextField getMechanismNameField() {
+ return mechanismNameField;
+ }
+
+ /**
+ * Returns the port name.
+ *
+ * @return the port name
+ */
+ public String getMechanismName() {
+ return mechanismNameField.getText();
+ }
+
+ public String getMechanismTypeName() {
+ return (String) mechanismTypeSelector.getSelectedItem();
+ }
+
+ public Component getMechanismTypeSelector() {
+ return mechanismTypeSelector;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
new file mode 100644
index 0000000..cabd832
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java
@@ -0,0 +1,383 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.border.EmptyBorder;
+import org.apache.taverna.activities.externaltool.manager.InvocationGroup;
+import org.apache.taverna.activities.externaltool.manager.InvocationManagerEvent;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
+import org.apache.taverna.activities.externaltool.manager.MechanismCreator;
+
+import org.apache.taverna.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.helper.Helper;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ToolInvocationConfigurationPanel extends JPanel implements
+ Observer<InvocationManagerEvent> {
+
+ public static final String HEADER_TEXT = "A tool can be set to run at an explicit location (e.g. on a specificic machine or one of a set of machines). Alternatively, it can be set to run at a symbolic location, which means the tool will then be run at the explicit location pointed to by the symbolic location.";
+
+ private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance();
+
+ private final List<InvocationMechanismEditor<?>> invocationMechanismEditors;
+
+ private JTextArea headerText;
+
+ private static String EXPLICIT_LOCATIONS = "explicit locations";
+ private static String SYMBOLIC_LOCATIONS = "symbolic locations";
+
+ private List<MechanismCreator> mechanismCreators;
+
+ JList locationList = new JList();
+
+ DefaultListModel groupListModel = new DefaultListModel();
+ DefaultListModel mechanismListModel = new DefaultListModel();
+ JComboBox locationTypeCombo = new JComboBox(new String[] { EXPLICIT_LOCATIONS,
+ SYMBOLIC_LOCATIONS });
+
+ public ToolInvocationConfigurationPanel(List<MechanismCreator> mechanismCreators,
+ List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
+ super();
+ this.mechanismCreators = mechanismCreators;
+ this.invocationMechanismEditors = invocationMechanismEditors;
+ manager.addObserver(this);
+
+ this.setLayout(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ headerText = new JTextArea(HEADER_TEXT);
+ headerText.setLineWrap(true);
+ headerText.setWrapStyleWord(true);
+ headerText.setEditable(false);
+ headerText.setFocusable(false);
+ headerText.setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(0, 0, 10, 0);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ add(headerText, gbc);
+
+ JPanel locationPanel = new JPanel(new BorderLayout());
+ JPanel subPanel = new JPanel(new FlowLayout());
+ JLabel modify = new JLabel("Modify:");
+
+ locationTypeCombo.setSelectedItem(EXPLICIT_LOCATIONS);
+ locationTypeCombo.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switchList();
+ }
+ });
+ subPanel.add(modify);
+ subPanel.add(locationTypeCombo);
+
+ populateLists();
+ switchList();
+ locationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ locationList.setCellRenderer(new DefaultListCellRenderer() {
+ public Component getListCellRendererComponent(JList list, Object value, int index,
+ boolean isSelected, boolean cellHasFocus) {
+ Object toShow = value;
+ if (value instanceof InvocationGroup) {
+ InvocationGroup invocationGroup = (InvocationGroup) value;
+ toShow = invocationGroup.getName() + " --> "
+ + invocationGroup.getMechanismName();
+ }
+ return super.getListCellRendererComponent(list, toShow, index, isSelected,
+ cellHasFocus);
+ }
+ });
+ locationPanel.add(new JScrollPane(locationList), BorderLayout.CENTER);
+ locationPanel.add(subPanel, BorderLayout.NORTH);
+
+ JPanel buttonPanel = new JPanel(new FlowLayout());
+ JButton helpButton = new DeselectingButton("Help", new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+ Helper.showHelp(ToolInvocationConfigurationPanel.this);
+ }
+ });
+
+ buttonPanel.add(helpButton);
+
+ buttonPanel.add(addLocationButton());
+ buttonPanel.add(removeLocationButton());
+ buttonPanel.add(editLocationButton());
+ locationPanel.add(buttonPanel, BorderLayout.SOUTH);
+
+ gbc.gridy++;
+ gbc.weighty = 1;
+
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.anchor = GridBagConstraints.SOUTH;
+ gbc.insets = new Insets(10, 0, 0, 0);
+ this.add(locationPanel, gbc);
+ }
+
+ private void switchList() {
+ if (isShowingGroups()) {
+ locationList.setModel(groupListModel);
+ } else {
+ locationList.setModel(mechanismListModel);
+ }
+ }
+
+ private void populateLists() {
+ poopulateGroupList();
+ populateMechanismList();
+ }
+
+ private void populateMechanismList() {
+ Object currentSelection = locationList.getSelectedValue();
+ ArrayList<InvocationMechanism> mechanisms = new ArrayList<InvocationMechanism>();
+ mechanisms.addAll(manager.getMechanisms());
+ Collections.sort(mechanisms, new Comparator<InvocationMechanism>() {
+
+ @Override
+ public int compare(InvocationMechanism o1, InvocationMechanism o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+ mechanismListModel.clear();
+ for (InvocationMechanism m : mechanisms) {
+ mechanismListModel.addElement(m);
+ }
+ if ((currentSelection != null) && !isShowingGroups()) {
+ locationList.setSelectedValue(currentSelection, true);
+ }
+ }
+
+ private void poopulateGroupList() {
+ Object currentSelection = locationList.getSelectedValue();
+ ArrayList<InvocationGroup> groups = new ArrayList<InvocationGroup>();
+ groups.addAll(manager.getInvocationGroups());
+ Collections.sort(groups, new Comparator<InvocationGroup>() {
+
+ @Override
+ public int compare(InvocationGroup o1, InvocationGroup o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ });
+ groupListModel.clear();
+ for (InvocationGroup g : groups) {
+ groupListModel.addElement(g);
+ }
+ if ((currentSelection != null) && isShowingGroups()) {
+ locationList.setSelectedValue(currentSelection, true);
+ }
+ }
+
+ private boolean isShowingGroups() {
+ return (locationTypeCombo.getSelectedItem().equals(SYMBOLIC_LOCATIONS));
+ }
+
+ private JButton addLocationButton() {
+ final JButton result = new DeselectingButton("Add", new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (isShowingGroups()) {
+ Set<String> usedGroupNames = new HashSet<String>();
+ for (InvocationGroup g : manager.getInvocationGroups()) {
+ usedGroupNames.add(g.getName());
+ }
+
+ GroupPanel inputPanel = new GroupPanel(mechanismListModel.toArray());
+
+ ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+ "Add symbolic location", inputPanel);
+ vuid.addTextComponentValidation(inputPanel.getGroupNameField(),
+ "Set the symbolic location name.", usedGroupNames,
+ "Duplicate symbolic location name.", "[\\p{L}\\p{Digit}_.]+",
+ "Invalid symbolic location name.");
+ vuid.setSize(new Dimension(400, 250));
+
+ if (vuid.show(ToolInvocationConfigurationPanel.this)) {
+ String groupName = inputPanel.getGroupName();
+ InvocationGroup newGroup = new InvocationGroup(mechanismCreators);
+ newGroup.setName(groupName);
+ newGroup.setMechanism(inputPanel.getSelectedMechanism());
+ manager.addInvocationGroup(newGroup);
+ locationList.setSelectedValue(newGroup, true);
+ }
+ } else {
+ Set<String> usedNames = new HashSet<String>();
+ for (InvocationMechanism m : manager.getMechanisms()) {
+ usedNames.add(m.getName());
+ }
+
+ MechanismPanel inputPanel = new MechanismPanel(invocationMechanismEditors);
+
+ ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+ "Add explicit location", inputPanel);
+ vuid.addTextComponentValidation(inputPanel.getMechanismNameField(),
+ "Set the explicit location name.", usedNames,
+ "Duplicate explicit location name.", "[\\p{L}\\p{Digit}_.]+",
+ "Invalid explicit location name.");
+ vuid.addMessageComponent(inputPanel.getMechanismTypeSelector(),
+ "Set the location name and type.");
+ vuid.setSize(new Dimension(400, 250));
+
+ if (vuid.show(ToolInvocationConfigurationPanel.this)) {
+ String mechanismName = inputPanel.getMechanismName();
+ String mechanismTypeName = inputPanel.getMechanismTypeName();
+ InvocationMechanismEditor ime = findEditor(mechanismTypeName);
+ InvocationMechanism newMechanism = ime.createMechanism(mechanismName);
+ manager.addMechanism(newMechanism);
+ ime.show(newMechanism);
+ ime.setPreferredSize(new Dimension(550, 500));
+ int answer = JOptionPane.showConfirmDialog(
+ ToolInvocationConfigurationPanel.this, ime,
+ "New explicit location", JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.PLAIN_MESSAGE, null);
+ if (answer == JOptionPane.OK_OPTION) {
+ ime.updateInvocationMechanism();
+ InvocationGroupManagerImpl.getInstance().mechanismChanged(newMechanism);
+ }
+ locationList.setSelectedValue(newMechanism, true);
+ }
+ }
+ }
+ });
+ return result;
+ }
+
+ private JButton removeLocationButton() {
+ JButton result = new DeselectingButton("Remove", new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (isShowingGroups()) {
+ InvocationGroup toRemove = (InvocationGroup) locationList.getSelectedValue();
+ if ((toRemove != null) && !toRemove.equals(manager.getDefaultGroup())) {
+ manager.removeInvocationGroup(toRemove);
+ }
+ locationList.setSelectedValue(manager.getDefaultGroup(), true);
+ } else {
+ InvocationMechanism toRemove = (InvocationMechanism) locationList
+ .getSelectedValue();
+ if ((toRemove != null) && !toRemove.equals(manager.getDefaultMechanism())) {
+ manager.removeMechanism(toRemove);
+ locationList.setSelectedValue(manager.getDefaultMechanism(), true);
+ }
+ }
+ }
+ });
+ return result;
+ }
+
+ private JButton editLocationButton() {
+ final JButton result = new DeselectingButton("Edit", new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (isShowingGroups()) {
+ InvocationGroup toEdit = (InvocationGroup) locationList.getSelectedValue();
+ if (toEdit != null) {
+ InvocationMechanism chosenMechanism = (InvocationMechanism) JOptionPane
+ .showInputDialog(ToolInvocationConfigurationPanel.this,
+ "Select an explicit location", "Edit symbolic location",
+ JOptionPane.PLAIN_MESSAGE, null,
+ mechanismListModel.toArray(), toEdit.getMechanism());
+ if (chosenMechanism != null) {
+ toEdit.setMechanism(chosenMechanism);
+ manager.groupChanged(toEdit);
+ }
+ }
+ } else {
+ InvocationMechanism toEdit = (InvocationMechanism) locationList
+ .getSelectedValue();
+ if (toEdit != null) {
+ InvocationMechanismEditor ime = findEditor(toEdit.getClass());
+ ime.show(toEdit);
+ ime.setPreferredSize(new Dimension(550, 500));
+ int answer = JOptionPane.showConfirmDialog(
+ ToolInvocationConfigurationPanel.this, ime,
+ "Edit explicit location", JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.PLAIN_MESSAGE, null);
+ if (answer == JOptionPane.OK_OPTION) {
+ ime.updateInvocationMechanism();
+ InvocationGroupManagerImpl.getInstance().mechanismChanged(toEdit);
+ }
+ }
+ }
+ }
+ });
+ return result;
+ }
+
+ protected InvocationMechanismEditor findEditor(String name) {
+ for (InvocationMechanismEditor ime : invocationMechanismEditors) {
+ if (ime.getName().equalsIgnoreCase(name)) {
+ return ime;
+ }
+ }
+ return null;
+ }
+
+ protected InvocationMechanismEditor findEditor(Class c) {
+ for (InvocationMechanismEditor ime : invocationMechanismEditors) {
+ if (ime.canShow(c)) {
+ return ime;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void notify(Observable<InvocationManagerEvent> arg0, InvocationManagerEvent arg1)
+ throws Exception {
+ if (SwingUtilities.isEventDispatchThread()) {
+ populateLists();
+ } else {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ populateLists();
+ }
+ });
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
new file mode 100644
index 0000000..3002a35
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java
@@ -0,0 +1,55 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager;
+
+import java.util.List;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+import org.apache.taverna.activities.externaltool.configuration.ToolInvocationConfiguration;
+import org.apache.taverna.activities.externaltool.manager.MechanismCreator;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ToolInvocationConfigurationUIFactory implements ConfigurationUIFactory {
+
+ private List<MechanismCreator> mechanismCreators;
+ private List<InvocationMechanismEditor<?>> invocationMechanismEditors;
+
+ private ToolInvocationConfigurationPanel configPanel;
+
+ @Override
+ public boolean canHandle(String uuid) {
+ return uuid.equals(getConfigurable().getUUID());
+ }
+
+ @Override
+ public Configurable getConfigurable() {
+ return ToolInvocationConfiguration.getInstance();
+ }
+
+ @Override
+ public JPanel getConfigurationPanel() {
+ if (configPanel == null) {
+ configPanel = new ToolInvocationConfigurationPanel(mechanismCreators,
+ invocationMechanismEditors);
+ }
+ return configPanel;
+ }
+
+ public void setMechanismCreators(List<MechanismCreator> mechanismCreators) {
+ this.mechanismCreators = mechanismCreators;
+ }
+
+ public void setInvocationMechanismEditors(
+ List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
+ this.invocationMechanismEditors = invocationMechanismEditors;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
new file mode 100644
index 0000000..70918f5
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java
@@ -0,0 +1,122 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager.local;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.apache.taverna.activities.externaltool.local.ExternalToolLocalInvocationMechanism;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor;
+
+/**
+ * @author alanrw
+ *
+ */
+public final class LocalInvocationMechanismEditor extends
+ InvocationMechanismEditor<ExternalToolLocalInvocationMechanism> {
+
+ private ExternalToolLocalInvocationMechanism invocationMechanism;
+
+ private JTextField directoryField = new JTextField(30);
+
+ private JTextField shellPrefixField = new JTextField(30);
+
+ private JTextField linkCommandField = new JTextField(30);
+
+ private JCheckBox retrieveDataField = new JCheckBox();
+
+
+ @Override
+ public boolean canShow(Class<?> c) {
+ return ExternalToolLocalInvocationMechanism.class.isAssignableFrom(c);
+ }
+
+ @Override
+ public String getName() {
+ return ("Local");
+ }
+
+ @Override
+ public void show(ExternalToolLocalInvocationMechanism invocationMechanism) {
+ this.invocationMechanism = invocationMechanism;
+ this.removeAll();
+ final JPanel innerPanel = new JPanel(new GridBagLayout());
+ final GridBagConstraints inputConstraint = new GridBagConstraints();
+// inputConstraint.insets = new Insets(5,5,5,5);
+ inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy = 0;
+ inputConstraint.weightx = 0.1;
+ inputConstraint.fill = GridBagConstraints.BOTH;
+ innerPanel.add(new JLabel("Working directory: "), inputConstraint);
+ inputConstraint.gridx++;
+ directoryField.setText(invocationMechanism.getDirectory());
+ innerPanel.add(directoryField, inputConstraint);
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy++;
+ innerPanel.add(new JLabel("Shell: "), inputConstraint);
+ inputConstraint.gridx++;
+ shellPrefixField.setText(invocationMechanism.getShellPrefix());
+ innerPanel.add(shellPrefixField, inputConstraint);
+
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy++;
+ innerPanel.add(new JLabel("Link command: "), inputConstraint);
+ inputConstraint.gridx++;
+ linkCommandField.setText(invocationMechanism.getLinkCommand());
+ innerPanel.add(linkCommandField, inputConstraint);
+
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy++;
+ innerPanel.add(new JLabel("Fetch data: "), inputConstraint);
+ inputConstraint.gridx++;
+ retrieveDataField.setSelected(invocationMechanism.isRetrieveData());
+ innerPanel.add(retrieveDataField, inputConstraint);
+
+ this.add(innerPanel);
+ }
+
+ @Override
+ public ExternalToolLocalInvocationMechanism updateInvocationMechanism() {
+ if ((directoryField.getText() == null) || (directoryField.getText().length() == 0)) {
+ invocationMechanism.setDirectory(null);
+ } else {
+ invocationMechanism.setDirectory(directoryField.getText());
+ }
+ if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) {
+ invocationMechanism.setShellPrefix(null);
+ } else {
+ invocationMechanism.setShellPrefix(shellPrefixField.getText());
+ }
+ if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) {
+ invocationMechanism.setShellPrefix(null);
+ } else {
+ invocationMechanism.setShellPrefix(shellPrefixField.getText());
+ }
+ if ((linkCommandField.getText() == null) || (linkCommandField.getText().length() == 0)) {
+ invocationMechanism.setLinkCommand(null);
+ } else {
+ invocationMechanism.setLinkCommand(linkCommandField.getText());
+ }
+ invocationMechanism.setRetrieveData(retrieveDataField.isSelected());
+ return invocationMechanism;
+ }
+
+ @Override
+ public InvocationMechanism createMechanism(String mechanismName) {
+ ExternalToolLocalInvocationMechanism result = new ExternalToolLocalInvocationMechanism();
+ result.setName(mechanismName);
+ return(result);
+ }
+
+ public boolean isSingleton() {
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
new file mode 100644
index 0000000..676d16d
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java
@@ -0,0 +1,110 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager.ssh;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTextField;
+
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanism;
+
+import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode;
+
+
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExternalToolSshNodeViewer {
+
+ private JTextField hostnameField;
+ private JTextField portField;
+ private JTextField directoryField;
+ private JTextField linkCommandField;
+ private JTextField copyCommandField;
+ private JCheckBox retrieveDataField;
+
+ public ExternalToolSshNodeViewer(SshNode node) {
+ this();
+ hostnameField.setText(node.getHost());
+ portField.setText(Integer.toString(node.getPort()));
+ if (node.getDirectory() != null) {
+ directoryField.setText(node.getDirectory());
+ } else {
+ directoryField.setText("");
+ }
+ if (node.getLinkCommand() != null) {
+ linkCommandField.setText(node.getLinkCommand());
+ } else {
+ linkCommandField.setText("");
+ }
+ if (node.getCopyCommand() != null) {
+ copyCommandField.setText(node.getCopyCommand());
+ } else {
+ copyCommandField.setText("");
+ }
+ retrieveDataField.setSelected(node.isRetrieveData());
+ }
+
+ public ExternalToolSshNodeViewer() {
+ hostnameField = new JTextField(30);
+ hostnameField.setText(SshNode.DEFAULT_HOST);
+ portField = new JTextField(3);
+ portField.setText("" + SshNode.DEFAULT_PORT);
+ directoryField = new JTextField(30);
+ directoryField.setText(SshNode.DEFAULT_DIRECTORY);
+ linkCommandField = new JTextField(30);
+ linkCommandField.setText(InvocationMechanism.UNIX_LINK);
+ copyCommandField = new JTextField(30);
+ copyCommandField.setText(InvocationMechanism.UNIX_COPY);
+ retrieveDataField = new JCheckBox();
+ }
+
+ public JTextField getHostnameField() {
+ return hostnameField;
+ }
+
+ public JTextField getPortField() {
+ return portField;
+ }
+
+ public JTextField getDirectoryField() {
+ return directoryField;
+ }
+
+ public JTextField getLinkCommandField() {
+ return linkCommandField;
+ }
+
+ public JTextField getCopyCommandField() {
+ return copyCommandField;
+ }
+
+ public String getHostname() {
+ return hostnameField.getText();
+ }
+
+ public int getPort() {
+ return Integer.parseInt(portField.getText());
+ }
+
+ public String getDirectory() {
+ return directoryField.getText();
+ }
+
+ public String getLinkCommand() {
+ return linkCommandField.getText();
+ }
+
+ public String getCopyCommand() {
+ return copyCommandField.getText();
+ }
+
+ /**
+ * @return the retrieveDataField
+ */
+ public JCheckBox getRetrieveDataField() {
+ return retrieveDataField;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
new file mode 100644
index 0000000..1fd3c2b
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
@@ -0,0 +1,234 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.externaltool.manager.ssh;
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.border.CompoundBorder;
+
+import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
+import org.apache.taverna.activities.externaltool.manager.InvocationMechanismEditor;
+import net.sf.taverna.t2.activities.externaltool.ssh.ExternalToolSshInvocationMechanism;
+import net.sf.taverna.t2.lang.ui.DeselectingButton;
+import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode;
+import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNodeFactory;
+
+/**
+ * @author alanrw
+ *
+ */
+public final class SshInvocationMechanismEditor extends
+ InvocationMechanismEditor<ExternalToolSshInvocationMechanism> {
+
+ private ArrayList<ExternalToolSshNodeViewer> nodeViewers = new ArrayList<ExternalToolSshNodeViewer>();
+ private int inputGridy = 0;
+
+ private ExternalToolSshInvocationMechanism mechanism = null;
+
+ private static Insets insets = new Insets(1,5,1,5);
+
+ private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
+
+ @Override
+ public boolean canShow(Class<?> c) {
+ return ExternalToolSshInvocationMechanism.class.isAssignableFrom(c);
+ }
+
+ @Override
+ public void show(ExternalToolSshInvocationMechanism invocationMechanism) {
+ mechanism = invocationMechanism;
+ this.removeAll();
+ inputGridy = 1;
+ final JPanel innerPanel = new JPanel(new GridBagLayout());
+
+ final GridBagConstraints inputConstraint = new GridBagConstraints();
+ inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ inputConstraint.gridx = 0;
+ inputConstraint.gridy = 0;
+ inputConstraint.weightx = 0.1;
+ inputConstraint.fill = GridBagConstraints.BOTH;
+
+ inputConstraint.gridx = 0;
+ nodeViewers.clear();
+ for (SshNode node : invocationMechanism.getNodes()) {
+ ExternalToolSshNodeViewer nodeViewer = new ExternalToolSshNodeViewer(node);
+ addNodeViewer(this, innerPanel, nodeViewer);
+ }
+
+ this.setLayout(new GridBagLayout());
+ GridBagConstraints outerPanelConstraint = new GridBagConstraints();
+ outerPanelConstraint.gridx = 0;
+ outerPanelConstraint.gridy = 0;
+ outerPanelConstraint.weightx = 0.1;
+ outerPanelConstraint.weighty = 0.1;
+ outerPanelConstraint.fill = GridBagConstraints.BOTH;
+ this.add(new JScrollPane(innerPanel),
+ outerPanelConstraint);
+ outerPanelConstraint.weighty = 0;
+ final JButton addHostButton = new DeselectingButton("Add host",
+ new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+
+ ExternalToolSshNodeViewer newViewer = new ExternalToolSshNodeViewer();
+
+ addNodeViewer(SshInvocationMechanismEditor.this, innerPanel, newViewer);
+ innerPanel.revalidate();
+ innerPanel.repaint();
+ }
+
+ });
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new GridBagLayout());
+
+ JPanel filler = new JPanel();
+ outerPanelConstraint.weightx = 0.1;
+ outerPanelConstraint.weighty = 0;
+ outerPanelConstraint.gridx = 0;
+ outerPanelConstraint.gridy = 0;
+
+ buttonPanel.add(filler, outerPanelConstraint);
+
+ outerPanelConstraint.weightx = 0;
+ outerPanelConstraint.weighty = 0;
+ outerPanelConstraint.gridx = 1;
+ outerPanelConstraint.gridy = 0;
+
+ buttonPanel.add(addHostButton, outerPanelConstraint);
+
+ outerPanelConstraint.weightx = 0;
+ outerPanelConstraint.weighty = 0;
+ outerPanelConstraint.gridx = 0;
+ outerPanelConstraint.gridy = 1;
+ outerPanelConstraint.fill = GridBagConstraints.BOTH;
+ this.add(buttonPanel, outerPanelConstraint);
+ }
+
+ protected void addNodeViewer(final JPanel result, final JPanel innerPanel,
+ ExternalToolSshNodeViewer viewer) {
+ final JPanel subPanel = new JPanel();
+ subPanel.setLayout(new GridBagLayout());
+ subPanel.setBorder(border);
+ final GridBagConstraints inputConstraint = new GridBagConstraints();
+ inputConstraint.insets = insets;
+ inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
+ inputConstraint.weightx = 0.1;
+ inputConstraint.fill = GridBagConstraints.BOTH;
+
+ inputConstraint.gridy = 0 ;
+ inputConstraint.gridx = 0;
+
+ subPanel.add(new JLabel("Host: "), inputConstraint);
+ final JTextField hostnameField = viewer.getHostnameField();
+ inputConstraint.gridx++;
+ subPanel.add(hostnameField, inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 0;
+ subPanel.add(new JLabel("Port: "), inputConstraint);
+ final JTextField portField = viewer.getPortField();
+ inputConstraint.gridx++;
+ subPanel.add(portField ,inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 0;
+ subPanel.add(new JLabel("Working directory: "), inputConstraint);
+ final JTextField directoryField = viewer.getDirectoryField();
+ inputConstraint.gridx++;
+ subPanel.add(directoryField ,inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 0;
+ subPanel.add(new JLabel("Link command: "), inputConstraint);
+ final JTextField linkCommandField = viewer.getLinkCommandField();
+ inputConstraint.gridx++;
+ subPanel.add(linkCommandField ,inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 0;
+ subPanel.add(new JLabel("Copy command: "), inputConstraint);
+ final JTextField copyCommandField = viewer.getCopyCommandField();
+ inputConstraint.gridx++;
+ subPanel.add(copyCommandField ,inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 0;
+ subPanel.add(new JLabel("Fetch data: "), inputConstraint);
+ inputConstraint.gridx++;
+ final JCheckBox retrieveDataField = viewer.getRetrieveDataField();
+ subPanel.add(retrieveDataField ,inputConstraint);
+
+ inputConstraint.gridy++ ;
+ inputConstraint.gridx = 1;
+ inputConstraint.fill = GridBagConstraints.NONE;
+ inputConstraint.anchor = GridBagConstraints.EAST;
+ final ExternalToolSshNodeViewer v = viewer;
+ final JButton removeButton = new DeselectingButton("Remove",
+ new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+ synchronized(nodeViewers) {
+ nodeViewers.remove(v);
+ }
+ innerPanel.remove(subPanel);
+ innerPanel.revalidate();
+ innerPanel.repaint();
+ result.revalidate();
+ result.repaint();
+ }
+
+ });
+ subPanel.add(removeButton, inputConstraint);
+
+ inputConstraint.gridy = ++inputGridy;
+ innerPanel.add(subPanel, inputConstraint);
+
+ nodeViewers.add(viewer);
+ inputGridy++;
+ }
+
+ private List<SshNode> getNodeList() {
+ List<SshNode> result = new ArrayList<SshNode>();
+ for (ExternalToolSshNodeViewer viewer : nodeViewers) {
+ SshNode node = SshNodeFactory.getInstance().getSshNode(viewer.getHostname(), viewer.getPort(), viewer.getDirectory());
+ node.setLinkCommand(viewer.getLinkCommand());
+ node.setCopyCommand(viewer.getCopyCommand());
+ node.setRetrieveData(viewer.getRetrieveDataField().isSelected());
+ result.add(node);
+ }
+ return result;
+ }
+
+ @Override
+ public ExternalToolSshInvocationMechanism updateInvocationMechanism() {
+ mechanism.setNodes(getNodeList());
+ return mechanism;
+ }
+
+ @Override
+ public InvocationMechanism createMechanism(String mechanismName) {
+ ExternalToolSshInvocationMechanism result = new ExternalToolSshInvocationMechanism();
+ result.setName(mechanismName);
+ return result;
+ }
+
+ @Override
+ public String getName() {
+ return ("SSH");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolContextualMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
new file mode 100644
index 0000000..956fd16
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 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 org.apache.taverna.activities.externaltool.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.workflowmodel.Dataflow;
+
+import org.apache.log4j.Logger;
+
+/**
+ * An action to add an external tool + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author Alan Williamns
+ *
+ */
+@SuppressWarnings("serial")
+public class AddExternalToolContextualMenuAction extends AbstractContextualMenuAction {
+
+ private static final String ADD_EXTERNAL_TOOL = "Tool";
+
+ private static final URI insertSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/insert");
+
+ private static Logger logger = Logger.getLogger(AddExternalToolMenuAction.class);
+
+ private EditManager editManager;
+
+ private MenuManager menuManager;
+
+ private SelectionManager selectionManager;
+
+ private ActivityIconManager activityIconManager;
+
+ public AddExternalToolContextualMenuAction() {
+ super(insertSection, 900);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Dataflow;
+ }
+
+ @Override
+ protected Action createAction() {
+
+ return new AddExternalToolAction();
+ }
+
+ protected class AddExternalToolAction extends AbstractAction {
+ AddExternalToolAction() {
+ super(ADD_EXTERNAL_TOOL, activityIconManager.iconForActivity(
+ new ExternalToolActivity()));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(
+ ExternalToolTemplateServiceDescription.getServiceDescription(), false,
+ editManager, menuManager, selectionManager);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolMenuAction.java
new file mode 100644
index 0000000..2877fcb
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/AddExternalToolMenuAction.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 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 org.apache.taverna.activities.externaltool.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.workbench.views.graph.menu.InsertMenu;
+
+import org.apache.log4j.Logger;
+
+/**
+ * An action to add a externaltool activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ *
+ */
+@SuppressWarnings("serial")
+public class AddExternalToolMenuAction extends AbstractMenuAction {
+
+ private static final String ADD_EXTERNAL_TOOL = "Tool";
+
+ private static final URI ADD_EXTERNAL_TOOL_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddExternalTool");
+
+ private static Logger logger = Logger
+ .getLogger(AddExternalToolMenuAction.class);
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+
+ private ActivityIconManager activityIconManager;
+
+ public AddExternalToolMenuAction() {
+ super(InsertMenu.INSERT, 900, ADD_EXTERNAL_TOOL_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+
+ return new AddExternalToolAction();
+ }
+
+ protected class AddExternalToolAction extends DesignOnlyAction {
+ AddExternalToolAction () {
+ super ();
+ putValue(SMALL_ICON, activityIconManager.iconForActivity(
+ new ExternalToolActivity()));
+ putValue(NAME, ADD_EXTERNAL_TOOL);
+ putValue(SHORT_DESCRIPTION, "Tool");
+ putValue(Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(ExternalToolTemplateServiceDescription.getServiceDescription(),
+ false, editManager, menuManager, selectionManager);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/ConfigureExternalToolMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
new file mode 100644
index 0000000..5f8b1bd
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (C) 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
+ *
+ * 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 org.apache.taverna.activities.externaltool.menu;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.activities.externaltool.actions.ExternalToolActivityConfigureAction;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * This class adds the plugin configuration action to the context menu of every use case activity.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ConfigureExternalToolMenuAction extends
+ AbstractConfigureActivityMenuAction<ExternalToolActivity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+
+ public ConfigureExternalToolMenuAction() {
+ super(ExternalToolActivity.class);
+ }
+
+ @Override
+ protected Action createAction() {
+ ExternalToolActivityConfigureAction configAction = new ExternalToolActivityConfigureAction(
+ findActivity(), getParentFrame(), editManager, fileManager, activityIconManager);
+ addMenuDots(configAction);
+ return configAction;
+ }
+
+ 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-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/FeedbackMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/FeedbackMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/FeedbackMenuAction.java
new file mode 100644
index 0000000..e85c0e4
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/menu/FeedbackMenuAction.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (C) 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
+ *
+ * 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 org.apache.taverna.activities.externaltool.menu;
+
+import java.awt.Desktop;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class adds the feedback item to the context menu of every use case
+ * activity.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class FeedbackMenuAction extends AbstractMenuAction {
+
+ private static Logger logger = Logger.getLogger(FeedbackMenuAction.class);
+
+
+ private static final URI feedbackSection = URI.create("http://taverna.sf.net/2009/contextMenu/configure");
+
+ public FeedbackMenuAction() {
+ super(feedbackSection, 51);
+ }
+
+ protected Action createAction() {
+ // final ImageIcon icon = KnowARCConfigurationFactory.getConfiguration().getIcon();
+ return new SendFeedbackAction("Send Feedback...", null);
+ }
+
+ private final class SendFeedbackAction extends AbstractAction {
+ private static final long serialVersionUID = 1L;
+
+ private static final String errTitle = "Could not open web browser for feedback:";
+ private static final String feedbackUrl = "http://www.taverna.org.uk/about/contact-us/feedback?product=ExternalToolService";
+
+ private SendFeedbackAction(String name, Icon icon) {
+ super(name, icon);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (Desktop.isDesktopSupported()) {
+ try {
+ Desktop.getDesktop().browse(URI.create(feedbackUrl));
+ } catch (IOException e1) {
+ JOptionPane.showMessageDialog(null, feedbackUrl + "\n" + e1.getLocalizedMessage(), errTitle, JOptionPane.ERROR_MESSAGE);
+ }
+ } else {
+ JOptionPane.showMessageDialog(null, "Go to " + feedbackUrl, errTitle, JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
new file mode 100644
index 0000000..88d6afe
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.MainWindow;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Dialog that lets user specify a URL of a Tool service they want
+ * to add to the Service Panel. In the case the Tool URL is behind
+ * HTTPS or service's endpoints require HTTPS it will ask user to confirm
+ * if they want to trust it.
+ *
+ * @author Alex Nenadic
+ *
+ */
+@SuppressWarnings("serial")
+public abstract class AddExternalToolServiceDialog extends HelpEnabledDialog {
+
+ private JTextField toolLocationField;
+ private Logger logger = Logger.getLogger(AddExternalToolServiceDialog.class);
+
+ public AddExternalToolServiceDialog() {
+ super(MainWindow.getMainWindow(), "Add tool service", true, null); // create a non-modal dialog
+ initComponents();
+ setLocationRelativeTo(getParent());
+ }
+
+ private void initComponents() {
+ JPanel mainPanel = new JPanel(new GridBagLayout());
+ mainPanel.setBorder(new EmptyBorder(10,10,10,10));
+
+ JLabel toolLocatitionLabel = new JLabel("Tool registry location",ExternalToolActivityIcon.getExternalToolIcon(), JLabel.LEFT);
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.weighty = 0.0;
+
+ gbc.weightx = 0.0;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 0);
+ mainPanel.add(toolLocatitionLabel, gbc);
+
+ toolLocationField = new JTextField("http://taverna.nordugrid.org/sharedRepository/xml.php");
+ gbc.weightx = 1.0;
+ gbc.gridx = 1;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 5);
+ mainPanel.add(toolLocationField, gbc);
+
+ final JButton addServiceButton = new JButton("Add");
+ addServiceButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent evt)
+ {
+ addPressed();
+ }
+ });
+
+ // When user presses "Return" key fire the action on the "Add" button
+ addServiceButton.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyPressed(java.awt.event.KeyEvent evt) {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
+ addPressed();
+ }
+ }
+ });
+ getRootPane().setDefaultButton(addServiceButton);
+
+ JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ buttonsPanel.add(addServiceButton);
+
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(mainPanel, BorderLayout.CENTER);
+ getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
+
+ setSize(getPreferredSize());
+ pack();
+ }
+
+ /**
+ * 'Add service' button pressed or otherwise activated.
+ */
+ private void addPressed()
+ {
+ final String toolURLString = toolLocationField.getText().trim();
+ new Thread("Adding tool " + toolURLString) {
+ public void run() {
+ // Only add the service provider for this service if service URL
+ // starts with 'http'
+ // or if it starts with 'https' and user explicitly said they
+ // wanted to trust this service.
+ /*
+ * if (shouldTrust(toolURLString)){ addRegistry(toolURLString);
+ * }
+ */
+ try {
+ URL url = new URL(toolURLString);
+ URLConnection connection = url.openConnection();
+ try {
+ // If the url starts with 'https' - security hook for
+ // https connection's trust manager
+ // will be engaged and user will be asked automatically
+ // if they want
+ // to trust the connection (if it is not already
+ // trusted). If the urls starts with 'http' -
+ // this will not have any effect apart from checking if
+ // we can open a connection.
+ connection.connect(); // if this does not fail - add the
+ // tool
+ // service provider for this service to
+ // the registry
+ } finally {
+ try {
+ connection.getInputStream().close();
+ } catch (IOException ex) {
+ }
+ }
+ addRegistry(toolURLString);
+ } catch (Exception ex) { // anything failed
+ JOptionPane.showMessageDialog(null,
+ "Could not read the tool descriptions from "
+ + toolURLString + ":\n" + ex,
+ "Could not add tool service",
+ JOptionPane.ERROR_MESSAGE);
+
+ logger.error(
+ "Failed to add tool description provider for service: "
+ + toolURLString, ex);
+
+ }
+ };
+ }.start();
+ closeDialog();
+ }
+
+ protected abstract void addRegistry(String tool);
+
+ /**
+ * Closes the dialog.
+ */
+ private void closeDialog() {
+ setVisible(false);
+ dispose();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
new file mode 100644
index 0000000..214285d
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ *
+ * 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 org.apache.taverna.activities.externaltool.servicedescriptions;
+
+import java.awt.Color;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.activities.externaltool.ExternalToolActivity;
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+
+/**
+ * This class provides an icon for the use case activity.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+public class ExternalToolActivityIcon implements ActivityIconSPI {
+
+ private static final String PROCESSOR_COLOUR_STRING = "#F28C55";
+
+ private static Icon icon;
+
+ public int canProvideIconScore(Activity<?> activity) {
+ if (activity.getClass().getName().equals(ExternalToolActivity.class.getName()))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(Activity<?> activity) {
+ return getExternalToolIcon();
+ }
+
+ public static Icon getExternalToolIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(ExternalToolActivityIcon.class.getResource("/externaltool.png"));
+ }
+ return icon;
+ }
+
+ public static String getColourString() {
+ return PROCESSOR_COLOUR_STRING;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ // set colour for XPath processors in the workflow diagram
+ colourManager.setPreferredColour(ExternalToolActivity.class.getCanonicalName(),
+ Color.decode(PROCESSOR_COLOUR_STRING));
+ }
+
+}
[02/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanel.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
new file mode 100644
index 0000000..efe7fbc
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
@@ -0,0 +1,1202 @@
+package org.apache.taverna.activities.xpath.ui.config;
+
+import java.awt.AWTEvent;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Toolkit;
+import java.awt.event.AWTEventListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Area;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JToggleButton;
+import javax.swing.ListSelectionModel;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.table.DefaultTableModel;
+
+import org.apache.taverna.activities.xpath.XPathActivityConfigurationBean;
+import org.apache.taverna.activities.xpath.ui.config.xmltree.TableCellListener;
+import org.apache.taverna.activities.xpath.ui.config.xmltree.XPathActivityXMLTree;
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathActivityIcon;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+
+import org.apache.log4j.Logger;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.InvalidXPathException;
+import org.dom4j.Node;
+import org.dom4j.XPath;
+import org.dom4j.XPathException;
+
+/**
+ * @author Sergejs Aleksejevs
+ */
+@SuppressWarnings("serial")
+public class XPathActivityConfigurationPanel extends JPanel {
+
+ private Logger logger = Logger.getLogger(XPathActivityConfigurationPanel.class);
+
+ // --- CONSTANTS ---
+ public static final int MAX_NUMBER_OF_MATCHING_NODES_TO_HIGHLIGHT_IN_THE_TREE = 100;
+
+ private static final Color INACTIVE_PANEL_BACKGROUND_COLOR = new Color(215,
+ 215, 215);
+
+ private static final String EXAMPLE_XML_PROMPT = "Paste example XML here...";
+
+ private static final String XPATH_XML_DOCUMENT_DIR_PROPERTY="XPathXMLDocumentDir";
+
+ private XPathActivityConfigurationPanel thisPanel;
+
+ // --- COMPONENTS FOR ACTIVITY CONFIGURATION PANEL ---
+ private JPanel jpActivityConfiguration;
+
+ private JPanel jpLeft;
+ private JPanel jpRight;
+
+ private JToggleButton bShowXMLTreeSettings;
+ private Popup xmlTreeSettingsMenu;
+ private long xmlTreeSettingsMenuLastShownAt;
+ private JButton bGenerateXPathExpression;
+ private JPanel jpXMLTreeSettingsMenuContents;
+ private JCheckBoxMenuItem miIncludeAttributes;
+ private JCheckBoxMenuItem miIncludeValues;
+ private JCheckBoxMenuItem miIncludeNamespaces;
+
+ private JTextArea taSourceXML;
+ private JButton bLoadXMLDocument;
+ private JButton bParseXML;
+ private XPathActivityXMLTree xmlTree;
+ private JScrollPane spXMLTreePlaceholder;
+
+ // --- COMPONENTS FOR XPATH EDITING PANEL ---
+ private JLabel jlXPathExpressionStatus;
+ private JLabel jlXPathExpression;
+ private JTextField tfXPathExpression;
+ private Map<String, String> xpathNamespaceMap;
+ private JButton bRunXPath;
+
+ private JLabel jlShowHideNamespaceMappings;
+ private JTable jtXPathNamespaceMappings;
+ private JButton bAddMapping;
+ private JButton bRemoveMapping;
+ private JPanel jpNamespaceMappingsWithButton;
+
+ // --- COMPONENTS FOR XPATH TESTING PANEL ---
+ private JPanel jpXPathTesting;
+
+ private JTextField tfExecutedXPathExpression;
+ private JTextField tfMatchingElementCount;
+
+ private JTabbedPane tpExecutedXPathExpressionResults;
+ private JTextArea taExecutedXPathExpressionResultsAsText;
+ private JScrollPane spExecutedXPathExpressionResultsAsText;
+ private JTextArea taExecutedXPathExpressionResultsAsXML;
+ private JScrollPane spExecutedXPathExpressionResultsAsXML;
+
+ public XPathActivityConfigurationPanel() {
+ this.thisPanel = this;
+
+ this.setLayout(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1.0;
+ c.weighty = 0.50;
+ c.insets = new Insets(0, 10, 10, 10);
+ this.jpActivityConfiguration = createActivityConfigurationPanel();
+ this.add(this.jpActivityConfiguration, c);
+
+ c.gridy++;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weighty = 0;
+ c.insets = new Insets(0, 10, 0, 10);
+ this.add(new JSeparator(), c);
+
+ // XPath expression editing panel
+ c.gridy++;
+ c.fill = GridBagConstraints.BOTH;
+ c.weighty = 0.05;
+ c.insets = new Insets(5, 10, 5, 10);
+ this.add(createXPathExpressionEditingPanel(), c);
+
+ c.gridy++;
+ ;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weighty = 0;
+ c.insets = new Insets(0, 10, 0, 10);
+ this.add(new JSeparator(), c);
+
+ // XPath expression testing panel
+ c.gridy++;
+ c.fill = GridBagConstraints.BOTH;
+ c.weighty = 0.35;
+ c.insets = new Insets(5, 10, 0, 10);
+ this.jpXPathTesting = createXPathExpressionTestingPanel();
+ this.add(this.jpXPathTesting, c);
+ }
+
+ private JPanel createActivityConfigurationPanel() {
+ JPanel jpConfig = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ // text area for example XML document
+ c.gridx = 0;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 0.5;
+ c.weighty = 1.0;
+ c.insets = new Insets(5, 0, 0, 5);
+ taSourceXML = new JTextArea(10, 30);
+ taSourceXML
+ .setToolTipText("<html>Use this text area to paste or load an example XML document.<br>"
+ + "This document can then be parsed by clicking the button<br>"
+ + "with a green arrow in order to see its tree structure.</html>");
+ taSourceXML.setText(EXAMPLE_XML_PROMPT);
+ taSourceXML.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ taSourceXML.selectAll();
+ }
+
+ public void focusLost(FocusEvent e) { /* do nothing */
+ }
+ });
+ taSourceXML.addCaretListener(new CaretListener() {
+ public void caretUpdate(CaretEvent e) {
+ // make sure that it is only allowed to "parse example XML"
+ // when something is actually present in the text area
+ bParseXML.setEnabled(taSourceXML.getText().trim().length() > 0
+ && !taSourceXML.getText().trim().equals(
+ EXAMPLE_XML_PROMPT));
+ }
+ });
+ jpLeft = new JPanel(new GridLayout(1, 1));
+ jpLeft.add(new JScrollPane(taSourceXML));
+ jpConfig.add(jpLeft, c);
+
+ // button to parse example XML document
+
+ c.gridx++;
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(0, 0, 0, 0);
+ bParseXML = new JButton(
+ XPathActivityIcon
+ .getIconById(XPathActivityIcon.XPATH_ACTIVITY_CONFIGURATION_PARSE_XML_ICON));
+ bParseXML
+ .setToolTipText("Parse example XML document and generate its tree structure");
+ bParseXML.setEnabled(false);
+ bParseXML.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ parseXML();
+ }
+ });
+ jpConfig.add(bParseXML, c);
+
+ // placeholder for XML tree (will be replaced by a real tree when the
+ // parsing is done)
+
+ c.gridx++;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 0.5;
+ c.weighty = 1.0;
+ c.insets = new Insets(5, 5, 0, 0);
+ JTextArea taXMLTreePlaceholder = new JTextArea(10, 30);
+ taXMLTreePlaceholder
+ .setToolTipText("<html>This area will show tree structure of the example XML after you<br>"
+ + "paste it into the space on the left-hand side and press 'Parse'<br>"
+ + "button with the green arrow.</html>");
+ taXMLTreePlaceholder.setEditable(false);
+ taXMLTreePlaceholder.setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
+ spXMLTreePlaceholder = new JScrollPane(taXMLTreePlaceholder);
+ jpRight = new JPanel(new GridLayout(1, 1));
+ jpRight.add(spXMLTreePlaceholder);
+ jpConfig.add(jpRight, c);
+
+ // Button to load XML document from a file
+
+ bLoadXMLDocument = new JButton("Load XML from file", WorkbenchIcons.openIcon);
+ bLoadXMLDocument.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser fileChooser = new JFileChooser();
+ Preferences prefs = Preferences.userNodeForPackage(getClass());
+ String curDir = prefs.get(XPATH_XML_DOCUMENT_DIR_PROPERTY, System.getProperty("user.home"));
+ fileChooser.setDialogTitle("Select file to load XML from");
+ fileChooser.setFileFilter(new FileFilter() {
+ public boolean accept(File f) {
+ return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");
+ }
+
+ public String getDescription() {
+ return ".xml files";
+ }
+ });
+ fileChooser.setCurrentDirectory(new File(curDir));
+ int returnVal = fileChooser.showOpenDialog(((JButton) e
+ .getSource()).getParent());
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ prefs.put(XPATH_XML_DOCUMENT_DIR_PROPERTY, fileChooser
+ .getCurrentDirectory().toString());
+ File file = fileChooser.getSelectedFile();
+ // Read the contents of a file into a string
+ // and set the value of the XML document text area to it
+ FileInputStream fis = null;
+ try{
+ byte[] fileBytes = new byte[(int)file.length()];
+ fis = new FileInputStream(file);
+ fis.read(fileBytes);
+ String xmlDocument = new String(fileBytes, "UTF-8");
+ setSourceXML(xmlDocument);
+ }
+ catch(Exception ex){
+ logger.error("An error occured while trying to read the XML document from file " + file.getAbsolutePath(), ex);
+ JOptionPane.showMessageDialog(
+ ((JButton) e.getSource()).getParent(),
+ "There was an error while trying to read the file",
+ "XPath Activity",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ finally{
+ try {
+ fis.close();
+ } catch (IOException e1) {
+ // Ignore
+ }
+ }
+
+ }
+ }
+ });
+ c.gridx = 0;
+ c.gridy++;
+ c.gridwidth = 1;
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(5, 0, 0, 5);
+ c.anchor = GridBagConstraints.EAST;
+ jpConfig.add(bLoadXMLDocument, c);
+
+ // settings for the view of XML tree from example XML document
+
+ miIncludeAttributes = new JCheckBoxMenuItem("Show XML node attributes");
+ miIncludeAttributes.setSelected(true);
+ miIncludeAttributes.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ refreshXMLTreeUI();
+ }
+ });
+
+ miIncludeValues = new JCheckBoxMenuItem(
+ "Show values of XML elements and attributes");
+ miIncludeValues.setSelected(true);
+ miIncludeValues.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ refreshXMLTreeUI();
+ }
+ });
+
+ miIncludeNamespaces = new JCheckBoxMenuItem(
+ "Show namespaces of XML elements");
+ miIncludeNamespaces.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ refreshXMLTreeUI();
+ }
+ });
+
+ jpXMLTreeSettingsMenuContents = new JPanel();
+ jpXMLTreeSettingsMenuContents.setBorder(BorderFactory
+ .createRaisedBevelBorder());
+ jpXMLTreeSettingsMenuContents.setLayout(new BoxLayout(
+ jpXMLTreeSettingsMenuContents, BoxLayout.Y_AXIS));
+ jpXMLTreeSettingsMenuContents.add(miIncludeAttributes);
+ jpXMLTreeSettingsMenuContents.add(miIncludeValues);
+ jpXMLTreeSettingsMenuContents.add(miIncludeNamespaces);
+
+ bShowXMLTreeSettings = new JToggleButton("Show XML tree settings...",
+ XPathActivityIcon.getIconById(XPathActivityIcon.UNFOLD_ICON));
+ bShowXMLTreeSettings.setSelectedIcon(XPathActivityIcon
+ .getIconById(XPathActivityIcon.FOLD_ICON));
+ bShowXMLTreeSettings.setEnabled(false);
+ bShowXMLTreeSettings.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (xmlTreeSettingsMenu == null) {
+ xmlTreeSettingsMenuLastShownAt = System.currentTimeMillis();
+
+ Point parentPosition = bShowXMLTreeSettings
+ .getLocationOnScreen();
+ xmlTreeSettingsMenu = PopupFactory.getSharedInstance()
+ .getPopup(
+ bShowXMLTreeSettings,
+ jpXMLTreeSettingsMenuContents,
+ parentPosition.x,
+ parentPosition.y
+ + bShowXMLTreeSettings.getHeight());
+ xmlTreeSettingsMenu.show();
+ } else {
+ bShowXMLTreeSettings.setSelected(false);
+ }
+ }
+ });
+
+ bGenerateXPathExpression = new JButton("Generate XPath expression",
+ XPathActivityIcon
+ .getIconById(XPathActivityIcon.XML_TREE_NODE_ICON));
+ bGenerateXPathExpression.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ updateXPathEditingPanelValues();
+ }
+ });
+
+ JPanel xmlTreeButtonPanel = new JPanel();
+ xmlTreeButtonPanel.add(bGenerateXPathExpression);
+ xmlTreeButtonPanel.add(bShowXMLTreeSettings);
+
+ c.gridx = 2;
+ c.gridwidth = 1;
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(5, 0, 0, 0);
+ c.anchor = GridBagConstraints.EAST;
+ jpConfig.add(xmlTreeButtonPanel, c);
+
+ // register a new listener for all AWT mouse events - this will be used
+ // to identify clicks outside of the XML tree popup menu and the toggle
+ // button used to show/hide it
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent event) {
+ if (event instanceof MouseEvent && xmlTreeSettingsMenu != null) {
+ MouseEvent e = (MouseEvent) event;
+ if (e.getClickCount() > 0
+ && (e.getWhen() - xmlTreeSettingsMenuLastShownAt) > 100) {
+ // convert a point where mouse click was made from
+ // relative coordinates of the source component
+ // to the coordinates of the panel that represents the
+ // contents of the popup menu
+ Point clickRelativeToOverlay = SwingUtilities
+ .convertPoint((Component) e.getSource(), e
+ .getPoint(),
+ jpXMLTreeSettingsMenuContents);
+
+ Area areaOfPopupPanelAndToggleButton = new Area(
+ jpXMLTreeSettingsMenuContents.getBounds());
+
+ // only hide the popup menu if a click was made outside
+ // of the calculated area --
+ // plus not on one of the associated toggle buttons
+ if (!areaOfPopupPanelAndToggleButton
+ .contains(clickRelativeToOverlay)) {
+ xmlTreeSettingsMenu.hide();
+ bShowXMLTreeSettings.setSelected(false);
+
+ // if the popup menu was dismissed by a click on the
+ // toggle button that
+ // has made it visible, this timer makes sure that
+ // this click doesn't
+ // re-show the popup menu
+ new Timer(100, new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ((Timer) e.getSource()).stop();
+ xmlTreeSettingsMenu = null;
+ }
+ }).start();
+
+ }
+ }
+ }
+ }
+ }, AWTEvent.MOUSE_EVENT_MASK);
+
+ return (jpConfig);
+ }
+
+ private JPanel createXPathExpressionEditingPanel() {
+ this.jlXPathExpressionStatus = new JLabel();
+
+ this.jlXPathExpression = new JLabel("XPath expression");
+
+ this.bRunXPath = new JButton("Run XPath");
+ this.bRunXPath.setEnabled(false);
+ this.bRunXPath.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ runXPath(true);
+ }
+ });
+
+ this.tfXPathExpression = new JTextField(30);
+ this.tfXPathExpression.setPreferredSize(new Dimension(0, this.bRunXPath
+ .getPreferredSize().height));
+ this.tfXPathExpression.setMinimumSize(new Dimension(0, this.bRunXPath
+ .getPreferredSize().height));
+ this.tfXPathExpression.addCaretListener(new CaretListener() {
+ public void caretUpdate(CaretEvent e) {
+ validateXPathAndUpdateUI();
+ }
+ });
+ this.tfXPathExpression.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ if (bRunXPath.isEnabled()) {
+ // it is safe to check that ENTER key may execute the
+ // XPath expression if the
+ // "Run XPath" button is enabled, as expression
+ // validation is responsible for
+ // enabling / disabling the button as the expression
+ // changes
+ runXPath(true);
+ }
+ }
+ }
+
+ public void keyReleased(KeyEvent e) { /* not in use */
+ }
+
+ public void keyTyped(KeyEvent e) { /* not in use */
+ }
+ });
+
+ JPanel jpXPath = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weighty = 0;
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.weightx = 0;
+ jpXPath.add(jlXPathExpressionStatus);
+
+ c.gridx++;
+ c.weightx = 0.0;
+ c.insets = new Insets(0, 10, 0, 0);
+ jpXPath.add(jlXPathExpression, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ c.insets = new Insets(0, 10, 0, 10);
+ jpXPath.add(tfXPathExpression, c);
+
+ c.gridx++;
+ c.weightx = 0;
+ c.insets = new Insets(0, 0, 0, 0);
+ jpXPath.add(bRunXPath, c);
+
+ c.gridx = 2;
+ c.gridy++;
+ c.weightx = 1.0;
+ c.weighty = 0;
+ c.gridwidth = 2;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ c.insets = new Insets(0, 10, 0, 10);
+ jlShowHideNamespaceMappings = new JLabel("Show namespace mappings...");
+ jlShowHideNamespaceMappings.setForeground(Color.BLUE);
+ jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ jpNamespaceMappingsWithButton
+ .setVisible(!jpNamespaceMappingsWithButton.isVisible());
+ jlShowHideNamespaceMappings
+ .setText((jpNamespaceMappingsWithButton.isVisible() ? "Hide"
+ : "Show")
+ + " namespace mappings...");
+ thisPanel.validate();
+ }
+ });
+ jpXPath.add(jlShowHideNamespaceMappings, c);
+
+ // namespace mapping table
+ DefaultTableModel tableModel = new DefaultTableModel();
+ tableModel.addColumn("Namespace Prefix");
+ tableModel.addColumn("Namespace URI");
+
+ jtXPathNamespaceMappings = new JTable();
+ jtXPathNamespaceMappings.setModel(tableModel);
+ // ((DefaultCellEditor)jtXPathNamespaceMappings.getDefaultEditor(String.class)).setClickCountToStart(1);
+ // // TODO - enable if one-click-to-start-editing behaviour is required
+ // TODO - next line is to be enabled when Taverna is migrated to Java
+ // 1.6; for now it's fine to run without this
+ // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure
+ // that when the dedicated area is larger than the table, the latter is
+ // stretched vertically to fill the empty space
+ jtXPathNamespaceMappings
+ .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one row can be selected at a time
+ jtXPathNamespaceMappings
+ .setPreferredScrollableViewportSize(new Dimension(200, 50)); // NB! this prevents the table from occupying most of the space in the panel when screen is maximized
+ jtXPathNamespaceMappings.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_DELETE) {
+ removeNamespaceMapping();
+ }
+ }
+ });
+
+ TableCellListener cellListener = new TableCellListener(
+ jtXPathNamespaceMappings, new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ TableCellListener tcl = (TableCellListener) e
+ .getSource();
+
+ if (tcl.getColumn() == 0) {
+ // prefix was modified
+ String newPrefix = (String) tcl.getNewValue();
+ if (xpathNamespaceMap.containsKey(newPrefix)) {
+ // such prefix already exists - change won't be
+ // saved
+ JOptionPane
+ .showMessageDialog(
+ thisPanel,
+ "Cannot update namespace prefix: "
+ + "updated value already exists",
+ "XPath Activity",
+ JOptionPane.WARNING_MESSAGE);
+ } else {
+ // update the map with the new prefix for the
+ // same URI value
+ String oldPrefix = (String) tcl.getOldValue();
+ xpathNamespaceMap.put(newPrefix,
+ xpathNamespaceMap.remove(oldPrefix));
+ }
+ } else {
+ // simple case - just the URI value has changed:
+ // just overwrite the value in the namespace map
+ String prefixOfUpdatedURI = (String) jtXPathNamespaceMappings
+ .getModel().getValueAt(tcl.getRow(), 0);
+ xpathNamespaceMap.put(prefixOfUpdatedURI,
+ (String) tcl.getNewValue());
+ }
+
+ // either way - reload from the local map (map could be
+ // not updated if the validation didn't succeed)
+ reloadNamespaceMappingTableFromLocalMap();
+ }
+ });
+
+ jtXPathNamespaceMappings.getColumnModel().getColumn(0)
+ .setPreferredWidth(20); // set relative sizes of columns
+ jtXPathNamespaceMappings.getColumnModel().getColumn(1)
+ .setPreferredWidth(300);
+
+ JScrollPane spXPathNamespaceMappings = new JScrollPane(
+ jtXPathNamespaceMappings);
+ spXPathNamespaceMappings.setAlignmentY(TOP_ALIGNMENT);
+ spXPathNamespaceMappings.setMinimumSize(new Dimension(200, 50)); // makes the table to have at least two rows visible in all cases - no matter how small the parent panel is
+
+ bAddMapping = new JButton("Add Mapping");
+ bAddMapping.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ addNamespaceMapping();
+ }
+ });
+
+ bRemoveMapping = new JButton("Remove Mapping");
+ bRemoveMapping.setEnabled(false);
+ bRemoveMapping.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ removeNamespaceMapping();
+ }
+ });
+
+ bAddMapping.setMinimumSize(bRemoveMapping.getPreferredSize()); // make sure that the 'Add Mapping' button is of the same size as 'Remove Mapping'
+
+ bAddMapping.setPreferredSize(bRemoveMapping.getPreferredSize()); // -- both are required to achieve desired behaviour when window is resized / namespace mapping table is enabled/disabled
+
+ bRunXPath.setMinimumSize(bRemoveMapping.getPreferredSize()); // do the same for 'Run XPath' button
+
+ bRunXPath.setPreferredSize(bRemoveMapping.getPreferredSize());
+
+ JPanel jpAddRemoveButtons = new JPanel();
+ jpAddRemoveButtons.setLayout(new GridBagLayout());
+ GridBagConstraints cAddRemove = new GridBagConstraints();
+ cAddRemove.gridx = 0;
+ cAddRemove.gridy = 0;
+ cAddRemove.weightx = 1.0;
+ cAddRemove.anchor = GridBagConstraints.NORTH;
+ cAddRemove.fill = GridBagConstraints.HORIZONTAL;
+ jpAddRemoveButtons.add(bAddMapping, cAddRemove);
+ cAddRemove.gridy++;
+ cAddRemove.weighty = 1.0;
+ cAddRemove.insets = new Insets(2, 0, 0, 0);
+ jpAddRemoveButtons.add(bRemoveMapping, cAddRemove);
+
+ jpNamespaceMappingsWithButton = new JPanel();
+ jpNamespaceMappingsWithButton.setVisible(false);
+ jpNamespaceMappingsWithButton.setLayout(new BorderLayout(10, 0));
+ jpNamespaceMappingsWithButton.add(spXPathNamespaceMappings,
+ BorderLayout.CENTER);
+ jpNamespaceMappingsWithButton
+ .add(jpAddRemoveButtons, BorderLayout.EAST);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1.0;
+ c.weighty = 1.0;
+ c.insets = new Insets(5, 0, 0, 0);
+ jpXPath.add(jpNamespaceMappingsWithButton, c);
+
+ // initialise some values / tooltips
+ resetXPathEditingPanel();
+
+ return (jpXPath);
+ }
+
+ protected void addNamespaceMapping() {
+ TwoFieldQueryPanel queryPanel = new TwoFieldQueryPanel(
+ "Namespace prefix:", "Namespace URI:");
+ int result = JOptionPane.showConfirmDialog(this, queryPanel,
+ "XPath Activity - Create new namespace mapping",
+ JOptionPane.OK_CANCEL_OPTION);
+
+ if (result == JOptionPane.OK_OPTION) {
+ boolean bInvalidMapping = true;
+ do {
+ bInvalidMapping = queryPanel.getFirstValue().length() == 0
+ || queryPanel.getSecondValue().length() == 0
+ || xpathNamespaceMap.containsKey(queryPanel
+ .getFirstValue());
+
+ if (bInvalidMapping) {
+ queryPanel = new TwoFieldQueryPanel(
+ "<html><center><font color=\"red\">ERROR: you must "
+ + "enter values for both namespace prefix and URI. Prefix must be<br>"
+ + "unique in the mapping table - duplicates are not allowed!</font></center></html>",
+ "Namespace prefix:", queryPanel.getFirstValue(),
+ "Namespace URI:", queryPanel.getSecondValue());
+ result = JOptionPane.showConfirmDialog(this, queryPanel,
+ "XPath Activity - Create new namespace mapping",
+ JOptionPane.OK_CANCEL_OPTION);
+ }
+ } while (bInvalidMapping && result == JOptionPane.OK_OPTION);
+
+ if (result == JOptionPane.OK_OPTION && !bInvalidMapping) {
+ // the value appears to be valid and OK was pressed - create new
+ // mapping
+ this.xpathNamespaceMap.put(queryPanel.getFirstValue(),
+ queryPanel.getSecondValue());
+ reloadNamespaceMappingTableFromLocalMap();
+ }
+ }
+ }
+
+ protected void removeNamespaceMapping() {
+ int selectedRow = jtXPathNamespaceMappings.getSelectedRow();
+ if (selectedRow != -1) {
+ // some row is selected - need to delete it and refresh table's UI
+ // (but first stop editing to avoid
+ // problems with cell editor trying to store an edited value after
+ // edited row has been deleted)
+ if (jtXPathNamespaceMappings.getCellEditor() != null) {
+ jtXPathNamespaceMappings.getCellEditor().stopCellEditing();
+ }
+ xpathNamespaceMap.remove(jtXPathNamespaceMappings.getValueAt(
+ selectedRow, 0));
+ reloadNamespaceMappingTableFromLocalMap();
+
+ // select another row in the table
+ int rowCount = jtXPathNamespaceMappings.getRowCount();
+ if (rowCount > 0) {
+ if (selectedRow < jtXPathNamespaceMappings.getRowCount()) {
+ // select the row that followed the one that was deleted
+ jtXPathNamespaceMappings.getSelectionModel()
+ .setSelectionInterval(selectedRow, selectedRow);
+ } else {
+ // last row in the table was deleted - select the one that
+ // is the new last row
+ jtXPathNamespaceMappings.getSelectionModel()
+ .setSelectionInterval(rowCount - 1, rowCount - 1);
+ }
+ }
+ } else {
+ JOptionPane.showMessageDialog(thisPanel,
+ "Please select a mapping to delete in the table first!",
+ "XPath Activity", JOptionPane.WARNING_MESSAGE);
+ }
+ }
+
+ private JPanel createXPathExpressionTestingPanel() {
+ JPanel jpTesting = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.gridwidth = 1;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(0, 0, 10, 10);
+ jpTesting.add(new JLabel("Executed XPath expression:"), c);
+
+ c.gridx++;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1.0;
+ c.weighty = 0;
+ c.insets = new Insets(0, 0, 10, 10);
+ tfExecutedXPathExpression = new JTextField();
+ tfExecutedXPathExpression.setEditable(false);
+ tfExecutedXPathExpression.setBorder(null);
+ jpTesting.add(tfExecutedXPathExpression, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.fill = GridBagConstraints.NONE;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(0, 0, 5, 10);
+ jpTesting.add(new JLabel("Number of matching nodes:"), c);
+
+ c.gridx++;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1.0;
+ c.weighty = 0;
+ c.insets = new Insets(0, 0, 5, 10);
+ tfMatchingElementCount = new JTextField();
+ tfMatchingElementCount.setEditable(false);
+ tfMatchingElementCount.setBorder(null);
+ jpTesting.add(tfMatchingElementCount, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.gridwidth = 2;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1.0;
+ c.weighty = 1.0;
+ tpExecutedXPathExpressionResults = new JTabbedPane();
+ jpTesting.add(tpExecutedXPathExpressionResults, c);
+
+ taExecutedXPathExpressionResultsAsText = new JTextArea();
+ taExecutedXPathExpressionResultsAsText.setEditable(false);
+ spExecutedXPathExpressionResultsAsText = new JScrollPane(
+ taExecutedXPathExpressionResultsAsText);
+ spExecutedXPathExpressionResultsAsText.setPreferredSize(new Dimension(
+ 200, 60));
+ spExecutedXPathExpressionResultsAsText.setBorder(BorderFactory
+ .createLineBorder(INACTIVE_PANEL_BACKGROUND_COLOR, 3));
+ tpExecutedXPathExpressionResults.add("Results as text",
+ spExecutedXPathExpressionResultsAsText);
+
+ taExecutedXPathExpressionResultsAsXML = new JTextArea();
+ taExecutedXPathExpressionResultsAsXML.setEditable(false);
+ spExecutedXPathExpressionResultsAsXML = new JScrollPane(
+ taExecutedXPathExpressionResultsAsXML);
+ spExecutedXPathExpressionResultsAsXML.setPreferredSize(new Dimension(
+ 200, 60));
+ spExecutedXPathExpressionResultsAsXML.setBorder(BorderFactory
+ .createLineBorder(INACTIVE_PANEL_BACKGROUND_COLOR, 3));
+ tpExecutedXPathExpressionResults.add("Results as XML",
+ spExecutedXPathExpressionResultsAsXML);
+
+ // initialise some values / tooltips
+ resetXPathTestingPanel();
+
+ return (jpTesting);
+ }
+
+ protected void parseXML() {
+ String xmlData = taSourceXML.getText();
+
+ try {
+ xmlTree = XPathActivityXMLTree.createFromXMLData(xmlData,
+ miIncludeAttributes.isSelected(), miIncludeValues
+ .isSelected(), miIncludeNamespaces.isSelected(),
+ this);
+ xmlTree
+ .setToolTipText("<html>This is a tree structure of the XML document that you have pasted.<br><br>"
+ + "Clicking on the nodes in this tree will automatically generate a<br>"
+ + "corresponding XPath expression. Multiple <b>identical</b> nodes can<br>"
+ + "be selected at once - in this case <b>wildcards</b> will be used in the<br>"
+ + "generated XPath expression to if selected nodes have different<br>"
+ + "ancestors. Other nodes that match the generated XPath expression<br>"
+ + "will also be selected in the tree.<br><br>"
+ + "Contextual menu provides convenience methods for expanding or<br>"
+ + "collapsing the tree." + "</html>");
+ xmlTree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+ JScrollPane spXMLTree = new JScrollPane(xmlTree);
+ spXMLTree.setPreferredSize(spXMLTreePlaceholder.getPreferredSize());
+ jpRight.removeAll();
+ jpRight.add(spXMLTree);
+
+ // all successful - enable options to modify the tree
+ this.bShowXMLTreeSettings.setEnabled(true);
+
+ // data structures inside the XML tree were reset (as the tree was
+ // re-created) -
+ // now reset the UI to the initial state as well
+ resetXPathEditingPanel();
+ resetXPathTestingPanel();
+
+ // XML tree has pre-populated the namespace map with the namespaces
+ // specified in the
+ // root element of the tree - load these values
+ updateXPathEditingPanelValues();
+
+ this.validate();
+ this.repaint();
+ } catch (DocumentException e) {
+ JOptionPane.showMessageDialog(this, e.getMessage(),
+ "XPath Activity", JOptionPane.ERROR_MESSAGE);
+ this.taSourceXML.requestFocusInWindow();
+ return;
+ }
+ }
+
+ /**
+ * Makes the {@link XPathActivityXMLTree} to refresh its UI from the
+ * original XML document that was used to create it in first place.
+ *
+ * The reason for using this method is to apply new options to the way the
+ * tree is rendered - e.g. attributes shown/hidden in the tree, values and
+ * namespaces shown/hidden, etc.
+ */
+ protected void refreshXMLTreeUI() {
+ this.xmlTree.refreshFromExistingDocument(this.miIncludeAttributes
+ .isSelected(), this.miIncludeValues.isSelected(),
+ this.miIncludeNamespaces.isSelected());
+ }
+
+ /**
+ * Initialises XPath Editing panel: -- resets XPath expression that is being
+ * shown; -- resets local copy of namespace map; -- resets UI of namespace
+ * mapping table;
+ */
+ private void resetXPathEditingPanel() {
+ tfXPathExpression.setText("");
+ validateXPathAndUpdateUI();
+
+ // clear the local copy of namespace map
+ xpathNamespaceMap = new HashMap<String, String>();
+
+ // clear the namespace mapping table and reload the data from the map
+ DefaultTableModel tableModel = (DefaultTableModel) jtXPathNamespaceMappings
+ .getModel();
+ tableModel.getDataVector().removeAllElements();
+ }
+
+ /**
+ * Initialises XPath testing panel which shows results of executing current
+ * XPath expression against the example XML - the panel is returned to the
+ * way it looks when it is first loaded.
+ */
+ private void resetXPathTestingPanel() {
+ this.tfExecutedXPathExpression.setText("--");
+ this.tfMatchingElementCount.setText("--");
+
+ this.taExecutedXPathExpressionResultsAsText.setText("");
+ this.taExecutedXPathExpressionResultsAsText
+ .setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
+
+ this.taExecutedXPathExpressionResultsAsXML.setText("");
+ this.taExecutedXPathExpressionResultsAsXML
+ .setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
+ }
+
+ public void updateXPathEditingPanelValues() {
+ if (xmlTree.getCurrentXPathExpression() != null) {
+ tfXPathExpression.setText(xmlTree.getCurrentXPathExpression()
+ .getText());
+ }
+
+ // clear the local copy of namespace map and update it with all values
+ // from
+ // the map in XML tree instance (which was apparently just re-generated
+ // on user request)
+ xpathNamespaceMap.clear();
+ xpathNamespaceMap.putAll(xmlTree.getCurrentXPathNamespaces());
+
+ // clear the namespace mapping table and reload the data from the map
+ reloadNamespaceMappingTableFromLocalMap();
+ }
+
+ protected void reloadNamespaceMappingTableFromLocalMap() {
+ // clear the namespace mapping table and reload the data from the map
+ DefaultTableModel tableModel = (DefaultTableModel) jtXPathNamespaceMappings
+ .getModel();
+ tableModel.getDataVector().removeAllElements();
+ for (Map.Entry<String, String> mapping : this.xpathNamespaceMap
+ .entrySet()) {
+ tableModel.addRow(new Object[] { mapping.getKey(),
+ mapping.getValue() });
+ }
+
+ bRemoveMapping.setEnabled(this.xpathNamespaceMap.entrySet().size() > 0);
+
+ repaint();
+ }
+
+ private String getXPathValidationErrorMessage() {
+ try {
+ // try to parse the XPath expression...
+ DocumentHelper.createXPath(tfXPathExpression.getText().trim());
+ // ...success
+ return ("");
+ } catch (InvalidXPathException e) {
+ // ...failed to parse the XPath expression: notify of the error
+ return (e.getMessage());
+ }
+ }
+
+ /**
+ * Validates the current XPath expression and updates UI accordingly: --
+ * XPath status icon is updated; -- tooltip for the icon explains the
+ * status; -- 'Run XPath' button is enabled/disabled depending on validity
+ * of XPath expression and existence of example data in the XML tree
+ */
+ protected void validateXPathAndUpdateUI() {
+ String candidatePath = tfXPathExpression.getText();
+ int xpathStatus = XPathActivityConfigurationBean
+ .validateXPath(candidatePath);
+
+ switch (xpathStatus) {
+ case XPathActivityConfigurationBean.XPATH_VALID:
+ // success: expression is correct
+ jlXPathExpressionStatus.setIcon(XPathActivityIcon
+ .getIconById(XPathActivityIcon.XPATH_STATUS_OK_ICON));
+ jlXPathExpressionStatus
+ .setToolTipText("Current XPath expression is well-formed and valid");
+
+ // could allow to execute against example XML, with only condition:
+ // XML tree must be populated
+ // (that is, there should be something to run the expression
+ // against)
+ if (xmlTree != null) {
+ this.bRunXPath.setEnabled(true);
+ this.bRunXPath
+ .setToolTipText("<html>Evaluate current XPath expression against the XML document<br>"
+ + "whose structure is shown in the tree view above.</html>");
+ } else {
+ this.bRunXPath.setEnabled(false);
+ this.bRunXPath
+ .setToolTipText("<html>No XML document to evaluate the current XPath expression against.<br><br>"
+ + "Paste some example XML into the area in the top-left section of the<br>"
+ + "window, then parse it by clicking on the button with the green arrow<br>"
+ + "in order to test your XPath expression.</html>");
+ }
+ break;
+
+ case XPathActivityConfigurationBean.XPATH_EMPTY:
+ // no XPath expression - can't tell if it is correct + nothing to
+ // execute
+ jlXPathExpressionStatus.setIcon(XPathActivityIcon
+ .getIconById(XPathActivityIcon.XPATH_STATUS_UNKNOWN_ICON));
+ jlXPathExpressionStatus
+ .setToolTipText("<html>There is no XPath expression to validate.<br><br>"
+ + "<b>Hint:</b> select something in the tree view showing the structure<br>"
+ + "of the XML document that you have pasted (or type the XPath<br>"
+ + "expression manually).</html>");
+ this.bRunXPath.setEnabled(false);
+ this.bRunXPath.setToolTipText("No XPath expression to execute");
+ break;
+
+ case XPathActivityConfigurationBean.XPATH_INVALID:
+ // failed to parse the XPath expression: notify of the error
+ jlXPathExpressionStatus.setIcon(XPathActivityIcon
+ .getIconById(XPathActivityIcon.XPATH_STATUS_ERROR_ICON));
+ jlXPathExpressionStatus
+ .setToolTipText(getXPathValidationErrorMessage());
+
+ this.bRunXPath.setEnabled(false);
+ this.bRunXPath
+ .setToolTipText("Cannot execute invalid XPath expression");
+ break;
+ }
+
+ }
+
+ /**
+ * Executes the current XPath expression against the current XML tree.
+ *
+ * @param displayResults
+ * <code>true</code> to execute and display results in the XPath
+ * activity configuration panel (this happens when the 'Run
+ * XPath' button is clicked);<br/>
+ * <false> to run the expression quietly and simply return the
+ * number of matching nodes.
+ * @return Number of nodes in the XML tree that match the current XPath
+ * expression. (Or <code>-1</code> if an error has occurred during
+ * the execution -- error messages will only be shown if
+ * <code>displayResults == true</code>).
+ */
+ public int runXPath(boolean displayResults) {
+ // ----- RUNNING THE XPath EXPRESSION -----
+ XPath expr = null;
+ try {
+ expr = DocumentHelper.createXPath(this.tfXPathExpression.getText());
+ expr.setNamespaceURIs(this.xpathNamespaceMap);
+ } catch (InvalidXPathException e) {
+ if (displayResults) {
+ JOptionPane
+ .showMessageDialog(
+ thisPanel,
+ "Incorrect XPath Expression\n\n"
+ + "Please check the expression if you have manually modified it;\n"
+ + "Alternatively, try to select another node from the XML tree.\n\n"
+ + "------------------------------------------------------------------------------------\n\n"
+ + "XPath processing library reported the following error:\n"
+ + e.getMessage(), "XPath Activity",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return (-1);
+ }
+
+ Document doc = xmlTree.getDocumentUsedToPopulateTree();
+ List<Node> matchingNodes = null;
+ int matchingNodeCount = -1;
+ try {
+ matchingNodes = expr.selectNodes(doc);
+ matchingNodeCount = matchingNodes.size();
+ } catch (XPathException e) {
+ if (displayResults) {
+ JOptionPane
+ .showMessageDialog(
+ thisPanel,
+ "Unexpected error has occurred while executing the XPath expression.\n\n"
+ + "If you have manually modified the XPath expression and/or namespace mappings,\n"
+ + "please check you changes. Alternatively, make your selection in the XML tree and\n"
+ + "a correct XPath expression with corresponding namespace mapping will be generated.\n\n"
+ + "-------------------------------------------------------------------------------------------------------------\n\n"
+ + "XPath processing library reported the following error:\n"
+ + e.getMessage(), "XPath Activity",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return (-1);
+ }
+
+ // ----- DISPLAYING THE RESULTS -----
+ if (displayResults) {
+ tfExecutedXPathExpression.setText(expr.getText());
+ tfMatchingElementCount.setText("" + matchingNodeCount);
+
+ StringBuffer outNodesText = new StringBuffer();
+ StringBuffer outNodesXML = new StringBuffer();
+ for (Node n : matchingNodes) {
+ if (n.getStringValue() != null
+ && n.getStringValue().length() > 0) {
+ outNodesText.append(n.getStringValue() + "\n");
+ }
+ outNodesXML.append(n.asXML() + "\n");
+ }
+
+ // tpExecutedXPathExpressionResults.setSelectedIndex(0); // open the
+ // first tab (should be the one with textual results) // TODO -
+ // enable if needed
+
+ taExecutedXPathExpressionResultsAsText.setText(outNodesText
+ .toString());
+ taExecutedXPathExpressionResultsAsText.setBackground(Color.WHITE);
+ taExecutedXPathExpressionResultsAsText.setCaretPosition(0);
+ spExecutedXPathExpressionResultsAsText.setBorder(BorderFactory
+ .createLineBorder(Color.WHITE, 3));
+
+ taExecutedXPathExpressionResultsAsXML.setText(outNodesXML
+ .toString());
+ taExecutedXPathExpressionResultsAsXML.setBackground(Color.WHITE);
+ taExecutedXPathExpressionResultsAsXML.setCaretPosition(0);
+ spExecutedXPathExpressionResultsAsXML.setBorder(BorderFactory
+ .createLineBorder(Color.WHITE, 3));
+ }
+
+ return (matchingNodeCount);
+ }
+
+ protected void setSourceXML(String xmlData) {
+ this.taSourceXML.setText(xmlData);
+ }
+
+ protected String getCurrentXPathExpression() {
+ return (this.tfXPathExpression.getText().trim());
+ }
+
+ protected void setCurrentXPathExpression(String xpathExpression) {
+ this.tfXPathExpression.setText(xpathExpression);
+ }
+
+ protected Map<String, String> getCurrentXPathNamespaceMap() {
+ return (this.xpathNamespaceMap);
+ }
+
+ /**
+ * This method doesn't simply set a reference to the passed map, but rather
+ * performs a shallow copy of values.
+ *
+ * This is because the method is used during configuration panel's
+ * initialisation from the values that are held in the configuration bean.
+ * In case of simple reference assignment, any changes made to map in the
+ * configuration panel are also taking effect on the same map - referenced
+ * from the configuration bean, which leads to undesired behaviour.
+ */
+ protected void setCurrentXPathNamespaceMapValues(
+ Map<String, String> xpathNamespaceMap) {
+ this.xpathNamespaceMap.clear();
+ this.xpathNamespaceMap.putAll(xpathNamespaceMap);
+ }
+
+ protected XPathActivityXMLTree getCurrentXMLTree() {
+ return (this.xmlTree);
+ }
+
+ /**
+ * For testing
+ */
+ public static void main(String[] args) {
+ JFrame frame = new JFrame();
+ frame.getContentPane().add(new XPathActivityConfigurationPanel());
+ frame.pack();
+ frame.setSize(new Dimension(900, 600));
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
new file mode 100644
index 0000000..c652d98
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
@@ -0,0 +1,158 @@
+package org.apache.taverna.activities.xpath.ui.config;
+
+import java.awt.BorderLayout;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.BorderFactory;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.activities.xpath.XPathActivityConfigurationBean;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class XPathActivityConfigurationPanelProvider extends ActivityConfigurationPanel {
+
+ private XPathActivityConfigurationPanel configPanel;
+ private final ServiceRegistry serviceRegistry;
+
+ public XPathActivityConfigurationPanelProvider(Activity activity, ServiceRegistry serviceRegistry) {
+ super(activity);
+ this.serviceRegistry = serviceRegistry;
+ initialise();
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+ removeAll();
+ setLayout(new BorderLayout());
+
+ // create actual contents of the config panel
+ this.configPanel = new XPathActivityConfigurationPanel();
+ add(configPanel, BorderLayout.CENTER);
+
+ // place the whole configuration panel into a raised area, so that
+ // automatically added 'Apply' / 'Close' buttons visually apply to
+ // the whole of the panel, not just part of it
+ this.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createEmptyBorder(12, 12, 2, 12),
+ BorderFactory.createRaisedBevelBorder()));
+
+ // Populate fields from activity configuration bean
+ refreshConfiguration();
+ }
+
+ /**
+ * Prepare a new configuration bean from the UI, to be returned with
+ * getConfiguration()
+ */
+ @Override
+ public void noteConfiguration() {
+ if (configPanel.getCurrentXMLTree() != null) {
+ setProperty("exampleXmlDocument", configPanel.getCurrentXMLTree()
+ .getDocumentUsedToPopulateTree().asXML());
+ }
+ setProperty("xpathExpression", configPanel.getCurrentXPathExpression());
+
+ Map<String, String> xPathNamespaceMap = configPanel.getCurrentXPathNamespaceMap();
+ if (xPathNamespaceMap.isEmpty()) {
+ json.remove("xpathNamespaceMap");
+ } else {
+ ArrayNode namespaceMapNode = json.arrayNode();
+ for (Entry<String, String> namespaceMapping : xPathNamespaceMap.entrySet()) {
+ namespaceMapNode.addObject().put("prefix", namespaceMapping.getKey()).put("uri", namespaceMapping.getValue());
+ }
+ json.set("xpathNamespaceMap", namespaceMapNode);
+ }
+
+ configureInputPorts(serviceRegistry);
+ configureOutputPorts(serviceRegistry);
+}
+
+ /**
+ * Check that user values in the UI are valid.
+ */
+ @Override
+ public boolean checkValues() {
+ // the only validity condition is the correctness of the XPath
+ // expression -- so checking that
+ int xpathExpressionStatus = XPathActivityConfigurationBean.validateXPath(this.configPanel
+ .getCurrentXPathExpression());
+
+ // show an explicit warning message to explain the problem
+ if (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_EMPTY) {
+ JOptionPane.showMessageDialog(this, "XPath expression should not be empty",
+ "XPath Activity", JOptionPane.WARNING_MESSAGE);
+ } else if (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_INVALID) {
+ JOptionPane.showMessageDialog(this,
+ "<html><center>XPath expression is invalid - hover the mouse over the XPath status<br>"
+ + "icon to get more information</center></html>", "XPath Activity",
+ JOptionPane.WARNING_MESSAGE);
+ }
+
+ return (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_VALID);
+ }
+
+ /**
+ * Update GUI from a changed configuration bean (perhaps by undo / redo).
+ */
+ @Override
+ public void refreshConfiguration() {
+ if (json.has("exampleXmlDocument")) {
+ configPanel.setSourceXML(getProperty("exampleXmlDocument"));
+ configPanel.parseXML();
+ }
+
+ configPanel.setCurrentXPathExpression(getProperty("xpathExpression"));
+
+ Map<String, String> xpathNamespaceMap = new HashMap<>();
+ if (json.has("xpathNamespaceMap")) {
+ for (JsonNode namespaceMapping : json.get("xpathNamespaceMap")) {
+ xpathNamespaceMap.put(namespaceMapping.get("prefix").asText(), namespaceMapping.get("uri").asText());
+ }
+ }
+ configPanel.setCurrentXPathNamespaceMapValues(xpathNamespaceMap);
+ configPanel.reloadNamespaceMappingTableFromLocalMap();
+
+ // if the XML tree was populated, (re-)run the XPath expression
+ // and restore selection of nodes in the tree, if possible
+ if (configPanel.getCurrentXMLTree() != null) {
+ configPanel.runXPath(true);
+
+ // convert the XPath expression into the required list form;
+ // discard the first 'leg', as it's a side effect of
+ // "String.split()" -
+ // non-existent string to the left of the first "/"
+ String[] xpathLegs = getProperty("xpathExpression").split("/");
+ List<String> xpathLegList = new ArrayList<String>();
+ for (int i = 1; i < xpathLegs.length; i++) {
+ xpathLegList.add("/" + xpathLegs[i]);
+ }
+
+ // if nothing was obtained, we should be looking at the root node -
+ // but add the actual expression as it was, just in case
+ if (xpathLegList.size() == 0) {
+ xpathLegList.add(configPanel.getCurrentXPathExpression());
+ }
+
+ // invoke selection handler of the XML tree to do the job
+ configPanel.getCurrentXMLTree().getXMLTreeSelectionHandler()
+ .selectAllNodesThatMatchTheCurrentXPath(xpathLegList, null);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigureAction.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigureAction.java
new file mode 100644
index 0000000..b57d9f7
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/XPathActivityConfigureAction.java
@@ -0,0 +1,52 @@
+package org.apache.taverna.activities.xpath.ui.config;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * @author Sergejs Aleksejevs
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class XPathActivityConfigureAction extends ActivityConfigurationAction {
+
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ServiceRegistry serviceRegistry;
+
+ public XPathActivityConfigureAction(Activity activity, Frame owner,
+ EditManager editManager, FileManager fileManager,
+ ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
+
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+
+ XPathActivityConfigurationPanelProvider panel = new XPathActivityConfigurationPanelProvider(
+ getActivity(), serviceRegistry);
+ ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(
+ getActivity(), panel, editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/TableCellListener.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/TableCellListener.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/TableCellListener.java
new file mode 100644
index 0000000..08c5f42
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/TableCellListener.java
@@ -0,0 +1,186 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import java.awt.event.*;
+import javax.swing.*;
+import java.beans.*;
+
+/**
+ * This class listens for changes made to the data in the table via the
+ * TableCellEditor. When editing is started, the value of the cell is saved
+ * When editing is stopped the new value is saved. When the oold and new
+ * values are different, then the provided Action is invoked.
+ *
+ * The source of the Action is a TableCellListener instance.
+ *
+ * TODO: update to work with Java 1.6, when Taverna is migrated to that version
+ * (see the next TODO tag - this is where the change needs to be made)
+ *
+ * @author Robert Camick
+ *
+ * @see <a href="http://tips4java.wordpress.com/2009/06/07/table-cell-listener/">http://tips4java.wordpress.com/2009/06/07/table-cell-listener/</a>
+ * @see <a href="http://www.camick.com/java/source/TableCellListener.java">http://www.camick.com/java/source/TableCellListener.java</a>
+ */
+public class TableCellListener implements PropertyChangeListener, Runnable
+{
+ private JTable table;
+ private Action action;
+
+ private int row;
+ private int column;
+ private Object oldValue;
+ private Object newValue;
+
+ /**
+ * Create a TableCellListener.
+ *
+ * @param table the table to be monitored for data changes
+ * @param action the Action to invoke when cell data is changed
+ */
+ public TableCellListener(JTable table, Action action)
+ {
+ this.table = table;
+ this.action = action;
+ this.table.addPropertyChangeListener( this );
+ }
+
+ /**
+ * Create a TableCellListener with a copy of all the data relevant to
+ * the change of data for a given cell.
+ *
+ * @param row the row of the changed cell
+ * @param column the column of the changed cell
+ * @param oldValue the old data of the changed cell
+ * @param newValue the new data of the changed cell
+ */
+ private TableCellListener(JTable table, int row, int column, Object oldValue, Object newValue)
+ {
+ this.table = table;
+ this.row = row;
+ this.column = column;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ /**
+ * Get the column that was last edited - value as in table model, not in the UI
+ *
+ * @return the column that was edited
+ */
+ public int getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * Get the new value in the cell
+ *
+ * @return the new value in the cell
+ */
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
+ /**
+ * Get the old value of the cell
+ *
+ * @return the old value of the cell
+ */
+ public Object getOldValue()
+ {
+ return oldValue;
+ }
+
+ /**
+ * Get the row that was last edited - value as in table model, not in the UI
+ *
+ * @return the row that was edited
+ */
+ public int getRow()
+ {
+ return row;
+ }
+
+ /**
+ * Get the table of the cell that was changed
+ *
+ * @return the table of the cell that was changed
+ */
+ public JTable getTable()
+ {
+ return table;
+ }
+
+ //
+ // Implement the PropertyChangeListener interface
+ //
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ // A cell has started/stopped editing
+
+ if ("tableCellEditor".equals(e.getPropertyName()))
+ {
+ if (table.isEditing())
+ processEditingStarted();
+ else
+ processEditingStopped();
+ }
+ }
+
+ /*
+ * Save information of the cell about to be edited
+ */
+ private void processEditingStarted()
+ {
+ // The invokeLater is necessary because the editing row and editing
+ // column of the table have not been set when the "tableCellEditor"
+ // PropertyChangeEvent is fired.
+ // This results in the "run" method being invoked
+
+ SwingUtilities.invokeLater( this );
+ }
+
+ /*
+ * See above.
+ */
+ public void run()
+ {
+// TODO - the next line is a correct implementation for Java 1.6
+// row = table.convertRowIndexToModel( table.getEditingRow() );
+
+// in Java 1.5 which is currently used, tables are not easily sortable
+// (and that is the case for the XPath Activity, where this class is used) --
+// hence, row numbers in the view and in the model will always be identical
+// --> HACK: just use the row number from the view...
+ row = table.getEditingRow();
+
+ column = table.convertColumnIndexToModel( table.getEditingColumn() );
+ oldValue = table.getModel().getValueAt(row, column);
+ newValue = null;
+ }
+
+ /*
+ * Update the Cell history when necessary
+ */
+ private void processEditingStopped()
+ {
+ newValue = table.getModel().getValueAt(row, column);
+
+ // The data has changed, invoke the supplied Action
+
+ if (! newValue.equals(oldValue))
+ {
+ // Make a copy of the data in case another cell starts editing
+ // while processing this change
+
+ TableCellListener tcl = new TableCellListener(
+ getTable(), getRow(), getColumn(), getOldValue(), getNewValue());
+
+ ActionEvent event = new ActionEvent(
+ tcl,
+ ActionEvent.ACTION_PERFORMED,
+ "");
+ action.actionPerformed(event);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
new file mode 100644
index 0000000..e6b2e9f
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
@@ -0,0 +1,572 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.text.Position;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.activities.xpath.ui.config.XPathActivityConfigurationPanel;
+import org.apache.taverna.activities.xpath.ui.servicedescription.XPathActivityIcon;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+import org.dom4j.XPath;
+
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityXMLTree extends JTree
+{
+ private XPathActivityXMLTree instanceOfSelf;
+ private XPathActivityXMLTreeRenderer treeRenderer;
+
+ private JPopupMenu contextualMenu;
+
+ private TreeSelectionListener[] allSelectionListeners;
+ private XPathActivityXMLTreeSelectionHandler xmlTreeSelectionHandler;
+
+ /**
+ *
+ */
+ private XPathActivityConfigurationPanel parentConfigPanel;
+
+ private Document documentUsedToPopulateTree;
+
+ /**
+ * holds value of the current XPath expression obtained from
+ * the combination of nodes selected in the XML tree
+ */
+ private XPath currentXPathExpression;
+
+ private Map<String,String> currentXPathNamespaces;
+
+
+
+ private XPathActivityXMLTree(XPathActivityXMLTreeNode root, Document documentUsedToPopulateTree,
+ boolean bIncludeElementValues, boolean bIncludeElementNamespaces, XPathActivityConfigurationPanel parentConfigPanel)
+ {
+ super(root);
+
+ this.instanceOfSelf = this;
+ this.allSelectionListeners = new TreeSelectionListener[0];
+
+ this.parentConfigPanel = parentConfigPanel;
+
+ this.documentUsedToPopulateTree = documentUsedToPopulateTree;
+ this.currentXPathExpression = null;
+ this.currentXPathNamespaces = new HashMap<String,String>();
+ this.prepopulateNamespaceMap();
+
+
+ // custom renderer of the nodes in the XML tree
+ this.treeRenderer = new XPathActivityXMLTreeRenderer(bIncludeElementValues, bIncludeElementNamespaces);
+ this.setCellRenderer(treeRenderer);
+
+
+ // add listener to handle various selections of nodes in the tree
+ this.xmlTreeSelectionHandler = new XPathActivityXMLTreeSelectionHandler(parentConfigPanel, this);
+ this.addTreeSelectionListener(xmlTreeSelectionHandler);
+
+
+ // --- CONTEXTUAL MENU FOR EXPANDING / COLLAPSING THE TREE ---
+
+ // create popup menu for expanding / collapsing all nodes in the tree
+ JMenuItem miExpandAll = new JMenuItem("Expand all", XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_EXPAND_ALL_ICON));
+ miExpandAll.setToolTipText("Expand all nodes in the filtering tree");
+ miExpandAll.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ for (int i = 0; i < getRowCount(); i++) {
+ instanceOfSelf.expandRow(i);
+ }
+ }
+ });
+ JMenuItem miCollapseAll = new JMenuItem("Collapse all", XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_COLLAPSE_ALL_ICON));
+ miCollapseAll.setToolTipText("Collapse all expanded nodes in the filtering tree");
+ miCollapseAll.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ for (int i = getRowCount() - 1; i >= 0; i--) {
+ instanceOfSelf.collapseRow(i);
+ }
+ }
+ });
+
+ // populate the popup menu with created menu items
+ contextualMenu = new JPopupMenu();
+ contextualMenu.add(miExpandAll);
+ contextualMenu.add(miCollapseAll);
+
+ // mouse events may cause the contextual menu to be shown - adding a listener
+ this.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ contextualMenu.show(instanceOfSelf, e.getX(), e.getY());
+ }
+ }
+ public void mouseReleased(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ // another way a popup menu may be called on different systems
+ contextualMenu.show(instanceOfSelf, e.getX(), e.getY());
+ }
+ }
+ });
+
+ }
+
+
+ /**
+ * Pre-populates namespace map with the namespaced declared in the root
+ * node of the XML document, which was used to populate the tree.
+ */
+ private void prepopulateNamespaceMap()
+ {
+ Document doc = this.getDocumentUsedToPopulateTree();
+ Element root = doc.getRootElement();
+
+ // get opening tag of the root node
+ String rootAsXML = root.asXML().substring(0, root.asXML().indexOf(">"));
+
+ // split the opening tag into tokens (all attributes are separated by a space)
+ String[] rootTokens = rootAsXML.split(" ");
+
+ // for each attribute check if that's a namespace declaration
+ for (String token : rootTokens) {
+ if (token.startsWith("xmlns"))
+ {
+ String[] namespacePrefixAndURI = token.split("=");
+
+ // a prefix is either given explicitly, or an empty one will be used
+ String prefix = namespacePrefixAndURI[0].indexOf(":") == -1 ?
+ "" :
+ namespacePrefixAndURI[0].split(":")[1];
+
+ // URI is the value of the XML attribute, so need to strip out surrounding quotes
+ String URI = namespacePrefixAndURI[1].replaceAll("\"", "");
+
+ // now add the details of the current namespace to the map
+ this.addNamespaceToXPathMap(new Namespace(prefix, URI));
+ }
+ }
+ }
+
+
+ protected XPathActivityConfigurationPanel getParentConfigPanel() {
+ return parentConfigPanel;
+ }
+
+ public XPathActivityXMLTreeSelectionHandler getXMLTreeSelectionHandler() {
+ return xmlTreeSelectionHandler;
+ }
+
+ public Document getDocumentUsedToPopulateTree() {
+ return documentUsedToPopulateTree;
+ }
+
+ public XPath getCurrentXPathExpression() {
+ return currentXPathExpression;
+ }
+ protected void setCurrentXPathExpression(XPath xpathExpression) {
+ this.currentXPathExpression = xpathExpression;
+ }
+
+
+ public Map<String,String> getCurrentXPathNamespaces() {
+ return currentXPathNamespaces;
+ }
+
+
+
+ protected void removeAllSelectionListeners()
+ {
+ this.allSelectionListeners = this.getTreeSelectionListeners();
+ for (TreeSelectionListener listener : this.allSelectionListeners) {
+ this.removeTreeSelectionListener(listener);
+ }
+ }
+
+ protected void restoreAllSelectionListeners()
+ {
+ for (TreeSelectionListener listener : this.allSelectionListeners) {
+ this.addTreeSelectionListener(listener);
+ }
+ }
+
+
+
+ /**
+ * Creates an instance of the XML tree from provided XML data.
+ *
+ * @param xmlData XML document in the form of a <code>String</code> to
+ * derive the tree from.
+ * @param bIncludeAttributesIntoTree
+ * @param bIncludeValuesIntoTree
+ * @param bIncludeElementNamespacesIntoTree
+ * @param parentConfigPanel
+ * @return
+ * @throws DocumentException if <code>xmlData</code> does not
+ * contain a valid XML document.
+ *
+ */
+ public static XPathActivityXMLTree createFromXMLData(String xmlData, boolean bIncludeAttributesIntoTree,
+ boolean bIncludeValuesIntoTree, boolean bIncludeElementNamespacesIntoTree,
+ XPathActivityConfigurationPanel parentConfigPanel) throws DocumentException
+ {
+ // ----- XML DOCUMENT PARSING -----
+ // try to parse the XML document - the next line will throw an exception if
+ // the document is not well-formed; proceed otherwise
+ Document doc = DocumentHelper.parseText(xmlData);
+ Element rootElement = doc.getRootElement();
+
+
+ // ----- POPULATE XML TREE -----
+ XPathActivityXMLTreeElementNode rootNode = new XPathActivityXMLTreeElementNode(rootElement);
+ populate(rootNode, rootElement, bIncludeAttributesIntoTree);
+
+ return (new XPathActivityXMLTree(rootNode, doc, bIncludeValuesIntoTree, bIncludeElementNamespacesIntoTree, parentConfigPanel));
+ }
+
+
+ /**
+ * Worker method for populating the tree recursively from a list of Elements.
+ *
+ * @param node
+ * @param element
+ */
+ private static void populate(DefaultMutableTreeNode node, Element element,
+ boolean bIncludeAttributesIntoTree)
+ {
+ Iterator<Element> elementIterator = element.elements().iterator();
+ while (elementIterator.hasNext()) {
+ Element childElement = elementIterator.next();
+ XPathActivityXMLTreeElementNode childNode = new XPathActivityXMLTreeElementNode(childElement);
+ node.add(childNode);
+
+ // recursively repeat for all children of the current child element
+ populate(childNode, childElement, bIncludeAttributesIntoTree);
+ }
+
+
+ // add attributes of the element as its children, if necessary
+ if (bIncludeAttributesIntoTree) {
+ List<Attribute> attributes = element.attributes();
+ for (Attribute attribute : attributes) {
+ node.add(new XPathActivityXMLTreeAttributeNode(attribute));
+ }
+ }
+ }
+
+
+ // ---------------- RESPONDING TO REQUESTS TO CHANGE APPEARANCE OF EXISTING TREE -----------------
+
+ /**
+ * NB! May be inefficient, as this solution re-generates the whole tree from
+ * stored XML document and replaces the root node of itself with a newly
+ * generated root node (that will be populated with updated children,
+ * according to the new values of options).
+ *
+ * However, this is a simple solution that will work for now.
+ *
+ * @param bIncludeAttributes
+ * @param bIncludeValues
+ * @param bIncludeNamespaces
+ */
+ public void refreshFromExistingDocument(boolean bIncludeAttributes, boolean bIncludeValues, boolean bIncludeNamespaces)
+ {
+ this.setEnabled(false);
+ removeAllSelectionListeners();
+
+ // store expansion and selection state of the XML tree
+ // see documentation for restoreExpandedPaths() for more details
+ //
+ // stored paths to expanded nodes are quite reliable, as paths are recorded;
+ // stored selected rows are less reliable, as only indices are kept -- however,
+ // the tree is re-created from the same document, so ordering/number of nodes
+ // cannot change (apart from attributes that may be added / removed - the attributes
+ // appear after other child nodes of some node in the tree, therefore only their
+ // selection could be affected)
+ HashMap<String,ArrayList<String>> toExpand = new HashMap<String,ArrayList<String>>();
+ ArrayList<Integer> toSelect = new ArrayList<Integer>();
+ for( int i = 1; i < this.getRowCount(); i++) {
+ if( this.isExpanded(i) ) {
+ TreePath path = this.getPathForRow(i);
+ String parentPath = path.getParentPath().toString();
+ ArrayList<String> values = toExpand.get(parentPath);
+ if(values == null) {
+ values = new ArrayList<String>();
+ }
+ values.add(path.getLastPathComponent().toString());
+ toExpand.put(parentPath, values);
+ }
+ if (this.isRowSelected(i)) {
+ toSelect.add(i);
+ }
+ }
+
+
+ // update presentation options
+ this.treeRenderer.setIncludeElementValues(bIncludeValues);
+ this.treeRenderer.setIncludeElementNamespaces(bIncludeNamespaces);
+
+ // re-create the root node of the tree and replace the old one with it
+ Element rootElement = this.documentUsedToPopulateTree.getRootElement();
+ XPathActivityXMLTreeNode newRootNode = new XPathActivityXMLTreeElementNode(rootElement);
+ populate(newRootNode, rootElement, bIncludeAttributes);
+ ((DefaultTreeModel)this.getModel()).setRoot(newRootNode);
+
+
+ // restore previous state of the tree from saved values
+ restoreExpandedPaths(toExpand, this.getPathForRow(0));
+ restoreSelectedPaths(toSelect);
+
+ this.restoreAllSelectionListeners();
+ this.setEnabled(true);
+ }
+
+
+ /**
+ * This method can only reliably work when the tree is re-generated from the same
+ * XML document, so that number / order of nodes would not change.
+ *
+ * @param toSelect List of indices of rows to re-select after tree was re-generated.
+ */
+ private void restoreSelectedPaths(ArrayList<Integer> toSelect)
+ {
+ if (toSelect == null || toSelect.isEmpty()) return;
+
+ // something definitely needs to be selected, so include root element into selection
+ this.addSelectionRow(0);
+
+ // select all stored rows
+ for (Integer value : toSelect) {
+ this.addSelectionRow(value);
+ }
+ }
+
+
+
+ /**
+ * Taken from: <a href="http://java.itags.org/java-core-gui-apis/58504/">http://java.itags.org/java-core-gui-apis/58504/</a>
+ *
+ * This method recursively expands all previously stored paths.
+ * Works under assumption that the name of the root node did not change.
+ * Otherwise, it can handle changed structure of the tree.
+ *
+ * To achieve its goal, it cannot simply use stored TreePath from your the original tree,
+ * since the paths are invalid after the tree is refreshed. Instead, a HashMap which links
+ * a String representation of the parent tree path to all expanded child node names is used.
+ *
+ * @param toExpand Map which links a String representation of the parent tree path to all
+ * expanded child node names is used.
+ * @param rootPath Path to root node.
+ */
+ void restoreExpandedPaths(HashMap<String,ArrayList<String>> toExpand, TreePath rootPath)
+ {
+ ArrayList<String> values = toExpand.remove(rootPath.toString());
+ if (values == null) return;
+
+ int row = this.getRowForPath(rootPath);
+ for (String value : values)
+ {
+ TreePath nextMatch = this.getNextMatch(value, row, Position.Bias.Forward);
+ this.expandPath(nextMatch);
+ if (toExpand.containsKey(nextMatch.toString())) {
+ restoreExpandedPaths(toExpand, nextMatch);
+ }
+ }
+ }
+
+
+
+ // ---------------- TREE SELECTION MODEL + XPath GENERATION -----------------
+
+
+ protected String generateXPathFromTreePath(TreePath path)
+ {
+ StringBuilder xpath = new StringBuilder();
+
+ for (String leg : generateXPathFromTreePathAsLegList(path)) {
+ xpath.append(leg);
+ }
+
+ return (xpath.toString());
+ }
+
+
+ protected List<String> generateXPathFromTreePathAsLegList(TreePath path)
+ {
+ List<String> pathLegs = new LinkedList<String>();
+
+ TreePath parentPath = path;
+ for (int i = 0; i < path.getPathCount(); i++)
+ {
+ XPathActivityXMLTreeNode lastXMLTreeNodeInThisPath = (XPathActivityXMLTreeNode)parentPath.getLastPathComponent();
+ pathLegs.add(0, this.getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(lastXMLTreeNodeInThisPath));
+
+ parentPath = parentPath.getParentPath();
+ }
+
+ return (pathLegs);
+ }
+
+
+ protected String getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(XPathActivityXMLTreeNode node)
+ {
+ QName qname = node.getNodeQName();
+ String effectiveNamespacePrefix = addNamespaceToXPathMap(qname.getNamespace());
+
+ return("/" +
+ (node.isAttribute() ? "@" : "") +
+ (effectiveNamespacePrefix.length() > 0 ? (effectiveNamespacePrefix + ":") : "") +
+ qname.getName());
+ }
+
+
+
+ private String addNamespaceToXPathMap(Namespace namespace)
+ {
+ // EMTPY PREFIX
+ if (namespace.getPrefix().length() == 0) {
+ if (namespace.getURI().length() == 0) {
+ // DEFAULT NAMESPACE with no URI - nothing to worry about
+ return "";
+ }
+ else {
+ // DEFAULT NAMESPACE WITH NO PREFIX, BUT URI IS KNOWN
+ return (addNamespaceToXPathMap(new Namespace("default", namespace.getURI())));
+ }
+ }
+
+ // NEW NON-EMPTY PREFIX
+ if (!this.currentXPathNamespaces.containsKey(namespace.getPrefix())) {
+ this.currentXPathNamespaces.put(namespace.getPrefix(), namespace.getURI());
+ return (namespace.getPrefix());
+ }
+
+ // EXISTING NON-EMPTY PREFIX AND THE SAME URI - NO NEED TO ADD AGAIN
+ else if (this.currentXPathNamespaces.get(namespace.getPrefix()).equals(namespace.getURI())) {
+ return (namespace.getPrefix());
+ }
+
+ // EXISTING NON-EMPTY PREFIX, BUT DIFFERENT URI
+ else {
+ String repeatedPrefix = namespace.getPrefix();
+
+ int i = 0;
+ while (this.currentXPathNamespaces.containsKey(repeatedPrefix + i)) {
+ // check if current alternative prefix wasn't yet applied to current URI
+ if (this.currentXPathNamespaces.get(repeatedPrefix + i).equals(namespace.getURI())) {
+ return (repeatedPrefix + i);
+ }
+ else {
+ // still another URI for the same prefix, keep trying to increase the ID in the prefix
+ i++;
+ }
+ }
+
+ String modifiedPrefix = repeatedPrefix + i;
+ this.currentXPathNamespaces.put(modifiedPrefix, namespace.getURI());
+ return (modifiedPrefix);
+ }
+ }
+
+
+ // ----------------------- Tree Cell Renderer --------------------------
+
+ /**
+ *
+ * @author Sergejs Aleksejevs
+ */
+ private class XPathActivityXMLTreeRenderer extends DefaultTreeCellRenderer
+ {
+ private boolean bIncludeElementValues;
+ private boolean bIncludeElementNamespaces;
+
+ public XPathActivityXMLTreeRenderer(boolean bIncludeElementValues, boolean bIncludeElementNamespaces) {
+ super();
+ this.bIncludeElementValues = bIncludeElementValues;
+ this.bIncludeElementNamespaces = bIncludeElementNamespaces;
+ }
+
+
+ public boolean getIncludeElementValues() {
+ return bIncludeElementValues;
+ }
+ public void setIncludeElementValues(boolean bIncludeElementValues) {
+ this.bIncludeElementValues = bIncludeElementValues;
+ }
+
+ public boolean getIncludeElementNamespaces() {
+ return bIncludeElementNamespaces;
+ }
+ public void setIncludeElementNamespaces(boolean bIncludeElementNamespaces) {
+ this.bIncludeElementNamespaces = bIncludeElementNamespaces;
+ }
+
+
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded, boolean leaf, int row,
+ boolean hasFocus)
+ {
+ // obtain the default rendering, we'll then customize it
+ Component defaultRendering = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
+
+ // it is most likely that the default rendering will be a JLabel, check just to be safe
+ if (defaultRendering instanceof JLabel)
+ {
+ JLabel defaultRenderedLabel = ((JLabel)defaultRendering);
+
+ // ---------- CHOOSE APPROPRIATE ICON FOR THE NODE ------------
+ if (row == 0) {
+ // set the icon for the XML tree root node
+ defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_ROOT_ICON));
+ }
+ else {
+ // set the icon for the XML tree node
+ if (value instanceof XPathActivityXMLTreeNode &&
+ ((XPathActivityXMLTreeNode)value).isAttribute())
+ {
+ defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_ATTRIBUTE_ICON));
+ }
+ else {
+ defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_NODE_ICON));
+ }
+ }
+
+
+ // ----------- CHOOSE THE DISPLAY TITLE FOR THE NODE ------------
+ if (value instanceof XPathActivityXMLTreeNode) {
+ defaultRenderedLabel.setText(((XPathActivityXMLTreeNode)value).getTreeNodeDisplayLabel(
+ this.bIncludeElementValues, this.bIncludeElementNamespaces, true));
+ }
+ }
+
+ return (defaultRendering);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
new file mode 100644
index 0000000..4a37839
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
@@ -0,0 +1,50 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import org.dom4j.Attribute;
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityXMLTreeAttributeNode extends XPathActivityXMLTreeNode
+{
+ private Attribute associatedAttribute;
+
+ public XPathActivityXMLTreeAttributeNode(Attribute associatedAttribute) {
+ super(associatedAttribute, true);
+ this.associatedAttribute = associatedAttribute;
+ }
+
+ public Attribute getAssociatedAttribute() {
+ return associatedAttribute;
+ }
+
+ public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bUseStyling)
+ {
+ StringBuilder label = new StringBuilder();
+
+ // add qualified attribute name (possibly) with styling
+ label.append((bUseStyling ? "<font color=\"purple\">" : "") +
+ this.associatedAttribute.getQualifiedName() +
+ (bUseStyling ? "</font>" : ""));
+
+ // add attribute value
+ if (bIncludeValue)
+ {
+ String attributeTextValue = this.associatedAttribute.getText();
+
+ if (attributeTextValue != null && attributeTextValue.length() > 0) {
+ label.append((bUseStyling ? "<font color=\"gray\"> - </font><font color=\"green\">" : "") +
+ truncateElementTextValue(stripAllHTML(attributeTextValue)) +
+ (bUseStyling ? "</font>" : ""));
+ }
+ }
+
+ if (bUseStyling) {
+ label.insert(0, "<html>");
+ label.append("</html>");
+ }
+
+ return (label.toString());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
new file mode 100644
index 0000000..cedcc95
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
@@ -0,0 +1,62 @@
+package org.apache.taverna.activities.xpath.ui.config.xmltree;
+
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+
+
+/**
+ *
+ * @author Sergejs Aleksejevs
+ */
+public class XPathActivityXMLTreeElementNode extends XPathActivityXMLTreeNode
+{
+ private Element associatedElement;
+
+ public XPathActivityXMLTreeElementNode(Element associatedElement) {
+ super(associatedElement, false);
+ this.associatedElement = associatedElement;
+ }
+
+ public Element getAssociatedElement() {
+ return associatedElement;
+ }
+
+ public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bIncludeNamespace, boolean bUseStyling)
+ {
+ StringBuilder label = new StringBuilder();
+
+ // add qualified element name
+ label.append(this.associatedElement.getQualifiedName());
+
+ // add element namespace
+ if (bIncludeNamespace)
+ {
+ Namespace ns = this.associatedElement.getNamespace();
+
+ label.append((bUseStyling ? "<font color=\"gray\">" : "") +
+ " - xmlns" + (ns.getPrefix().length() > 0 ? (":" + ns.getPrefix()) : "") + "=\"" +
+ this.associatedElement.getNamespaceURI() +
+ (bUseStyling ? "\"</font>" : ""));
+ }
+
+ // add element value
+ if (bIncludeValue)
+ {
+ String elementTextValue = this.associatedElement.getTextTrim();
+
+ if (elementTextValue != null && elementTextValue.length() > 0) {
+ label.append((bUseStyling ? "<font color=\"gray\"> - </font><font color=\"blue\">" : "") +
+ truncateElementTextValue(stripAllHTML(elementTextValue)) +
+ (bUseStyling ? "</font>" : ""));
+ }
+ }
+
+ if (bUseStyling) {
+ label.insert(0, "<html>");
+ label.append("</html>");
+ }
+
+ return (label.toString());
+ }
+
+}
\ No newline at end of file
[10/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigView.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigView.java
deleted file mode 100644
index 9a1e9d7..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigView.java
+++ /dev/null
@@ -1,1082 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.views;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Stack;
-
-import javax.swing.ButtonGroup;
-import javax.swing.DefaultCellEditor;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.border.Border;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableColumn;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.PlainDocument;
-
-import org.apache.taverna.activities.spreadsheet.Range;
-import org.apache.taverna.activities.spreadsheet.SpreadsheetUtils;
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import net.sf.taverna.t2.lang.ui.icons.Icons;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Configuration panel for the spreadsheet import activity.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class SpreadsheetImportConfigView extends ActivityConfigurationPanel {
-
- private static final String INCONSISTENT_ROW_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.INCONSISTENT_ROW_MESSAGE");
-
- private static final String INCONSISTENT_COLUMN_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.INCONSISTENT_COLUMN_MESSAGE");
-
- private static final String FROM_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.FROM_COLUMN_ERROR_MESSAGE");
-
- private static final String TO_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.TO_COLUMN_ERROR_MESSAGE");
-
- private static final String FROM_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.FROM_ROW_ERROR_MESSAGE");
-
- private static final String TO_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.TO_ROW_ERROR_MESSAGE");
-
- private static final String DEFAULT_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.DEFAULT_MESSAGE");
-
- private static final String EMPTY_FROM_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.EMPTY_FROM_ROW_ERROR_MESSAGE");
-
- private static final String EMPTY_FROM_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.EMPTY_FROM_COLUMN_ERROR_MESSAGE");
-
- private static final String EMPTY_TO_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.EMPTY_TO_COLUMN_ERROR_MESSAGE");
-
- private static final String DUPLICATE_PORT_NAME_ERROR_MESSAGE = SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.DUPLICATE_PORT_NAME_ERROR_MESSAGE");
-
- private static Logger logger = Logger.getLogger(SpreadsheetImportConfigView.class);
-
- private JPanel titlePanel, contentPanel, buttonPanel, page1, page2;
-
- private JLabel titleLabel, titleIcon, rowLabel, columnLabel;
-
- private JLabel emptyCellLabel, outputFormatLabel, outputFormatDelimiterLabel, columnMappingLabel;
-
- private DialogTextArea titleMessage;
-
- private JTextField columnFromValue, columnToValue, rowFromValue, rowToValue;
-
- private JTextField emptyCellUserDefinedValue, outputFormatDelimiter;
-
- private JCheckBox rowSelectAllOption, rowExcludeFirstOption, rowIgnoreBlankRows;
-
- private ButtonGroup emptyCellButtonGroup, outputFormatButtonGroup;
-
- private JRadioButton emptyCellEmptyStringOption, emptyCellUserDefinedOption,
- emptyCellErrorValueOption;
-
- private JRadioButton outputFormatMultiplePort, outputFormatSinglePort;
-
- private JTable columnMappingTable;
-
- private SpreadsheetImportConfigTableModel columnMappingTableModel;
-
- private JButton nextButton, backButton;
-
- private CardLayout cardLayout = new CardLayout();
-
- private Stack<String> warningMessages = new Stack<String>();
-
- private Stack<String> errorMessages = new Stack<String>();
-
- private ObjectNode newConfiguration;
-
- private final ServiceRegistry serviceRegistry;
-
- /**
- * Constructs a configuration view for an SpreadsheetImport Activity.
- *
- * @param activity
- */
- public SpreadsheetImportConfigView(Activity activity, ServiceRegistry serviceRegistry) {
- super(activity);
- this.serviceRegistry = serviceRegistry;
- initialise();
- }
-
- @Override
- protected void initialise() {
- super.initialise();
- newConfiguration = getJson().deepCopy();
-
- // title
- titlePanel = new JPanel(new BorderLayout());
- titlePanel.setBackground(Color.WHITE);
- addDivider(titlePanel, SwingConstants.BOTTOM, true);
-
- titleLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.panelTitle"));
- titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
- titleIcon = new JLabel("");
- titleMessage = new DialogTextArea(DEFAULT_MESSAGE);
- titleMessage.setMargin(new Insets(5, 10, 10, 10));
- // titleMessage.setMinimumSize(new Dimension(0, 30));
- titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
- titleMessage.setEditable(false);
- titleMessage.setFocusable(false);
- // titleMessage.setFont(titleLabel.getFont().deriveFont(Font.PLAIN,
- // 12f));
-
- // column range
- columnLabel = new JLabel(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.columnSectionLabel"));
-
- JsonNode columnRange = newConfiguration.get("columnRange");
- columnFromValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("start").intValue()), 4);
- columnFromValue.setMinimumSize(columnFromValue.getPreferredSize());
- columnToValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("end").intValue()), 4);
- columnToValue.setMinimumSize(columnToValue.getPreferredSize());
-
- columnFromValue.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- }
-
- public void insertUpdate(DocumentEvent e) {
- checkValue(columnFromValue.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- checkValue(columnFromValue.getText());
- }
-
- private void checkValue(String text) {
- if (text.trim().equals("")) {
- addErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
- } else if (text.trim().matches("[A-Za-z]+")) {
- String fromColumn = columnFromValue.getText().toUpperCase();
- String toColumn = columnToValue.getText().toUpperCase();
- int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn);
- int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn);
- if (checkColumnRange(fromColumnIndex, toColumnIndex)) {
- columnMappingTableModel.setFromColumn(fromColumnIndex);
- columnMappingTableModel.setToColumn(toColumnIndex);
- newConfiguration.set("columnRange", newConfiguration.objectNode().put("start", fromColumnIndex).put("end", toColumnIndex));
- validatePortNames();
- }
- removeErrorMessage(FROM_COLUMN_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
- } else {
- addErrorMessage(FROM_COLUMN_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
- }
- }
-
- });
-
- columnToValue.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- }
-
- public void insertUpdate(DocumentEvent e) {
- checkValue(columnToValue.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- checkValue(columnToValue.getText());
- }
-
- private void checkValue(String text) {
- if (text.trim().equals("")) {
- addErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
- } else if (text.trim().matches("[A-Za-z]+")) {
- String fromColumn = columnFromValue.getText().toUpperCase();
- String toColumn = columnToValue.getText().toUpperCase();
- int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn);
- int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn);
- if (checkColumnRange(fromColumnIndex, toColumnIndex)) {
- columnMappingTableModel.setFromColumn(fromColumnIndex);
- columnMappingTableModel.setToColumn(toColumnIndex);
- newConfiguration.set("columnRange", newConfiguration.objectNode().put("start", fromColumnIndex).put("end", toColumnIndex));
- validatePortNames();
- }
- removeErrorMessage(TO_COLUMN_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
-
- } else {
- addErrorMessage(TO_COLUMN_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
- }
- }
- });
-
- // row range
- rowLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.rowSectionLabel"));
- addDivider(rowLabel, SwingConstants.TOP, false);
-
- rowSelectAllOption = new JCheckBox(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.selectAllRowsOption"));
- rowExcludeFirstOption = new JCheckBox(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.excludeHeaderRowOption"));
- rowIgnoreBlankRows = new JCheckBox(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.ignoreBlankRowsOption"));
- rowSelectAllOption.setFocusable(false);
- rowExcludeFirstOption.setFocusable(false);
-
- JsonNode rowRange = newConfiguration.get("rowRange");
- rowFromValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("start").intValue() + 1), 4);
- if (rowRange.get("end").intValue() == -1) {
- rowToValue = new JTextField(new NumericDocument(), "", 4);
- } else {
- rowToValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("end").intValue() + 1), 4);
- }
- rowFromValue.setMinimumSize(rowFromValue.getPreferredSize());
- rowToValue.setMinimumSize(rowToValue.getPreferredSize());
-
- if (newConfiguration.get("allRows").booleanValue()) {
- rowSelectAllOption.setSelected(true);
- rowFromValue.setEditable(false);
- rowFromValue.setEnabled(false);
- rowToValue.setEditable(false);
- rowToValue.setEnabled(false);
- } else {
- rowExcludeFirstOption.setEnabled(false);
- }
- rowExcludeFirstOption.setSelected(newConfiguration.get("excludeFirstRow").booleanValue());
- rowIgnoreBlankRows.setSelected(newConfiguration.get("ignoreBlankRows").booleanValue());
-
- rowFromValue.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- }
-
- public void insertUpdate(DocumentEvent e) {
- checkValue(rowFromValue.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- checkValue(rowFromValue.getText());
- }
-
- private void checkValue(String text) {
- if (text.trim().equals("")) {
- addErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
- } else if (text.trim().matches("[1-9][0-9]*")) {
- checkRowRange(rowFromValue.getText(), rowToValue.getText());
- int fromRow = Integer.parseInt(rowFromValue.getText());
- ((ObjectNode) newConfiguration.get("rowRange")).put("start", fromRow - 1);
- removeErrorMessage(FROM_ROW_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
- } else {
- addErrorMessage(FROM_ROW_ERROR_MESSAGE);
- removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
- }
- }
- });
-
- rowToValue.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- }
-
- public void insertUpdate(DocumentEvent e) {
- checkValue(rowToValue.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- checkValue(rowToValue.getText());
- }
-
- private void checkValue(String text) {
- if (text.trim().equals("")) {
- ((ObjectNode) newConfiguration.get("rowRange")).put("end", -1);
- removeErrorMessage(TO_ROW_ERROR_MESSAGE);
- removeErrorMessage(INCONSISTENT_ROW_MESSAGE);
- } else if (text.trim().matches("[0-9]+")) {
- checkRowRange(rowFromValue.getText(), rowToValue.getText());
- int toRow = Integer.parseInt(rowToValue.getText());
- ((ObjectNode) newConfiguration.get("rowRange")).put("end", toRow - 1);
- removeErrorMessage(TO_ROW_ERROR_MESSAGE);
- } else {
- addErrorMessage(TO_ROW_ERROR_MESSAGE);
- }
- }
- });
-
- rowSelectAllOption.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newConfiguration.put("allRows", true);
- rowExcludeFirstOption.setEnabled(true);
- if (rowExcludeFirstOption.isSelected()) {
- rowFromValue.setText("2");
- } else {
- rowFromValue.setText("1");
- }
- rowToValue.setText("");
- rowFromValue.setEditable(false);
- rowFromValue.setEnabled(false);
- rowToValue.setEditable(false);
- rowToValue.setEnabled(false);
- } else {
- newConfiguration.put("allRows", false);
- rowExcludeFirstOption.setEnabled(false);
- rowFromValue.setEditable(true);
- rowFromValue.setEnabled(true);
- rowToValue.setEditable(true);
- rowToValue.setEnabled(true);
- }
- }
- });
-
- rowExcludeFirstOption.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.SELECTED) {
- newConfiguration.put("excludeFirstRow", true);
- rowFromValue.setText("2");
- ((ObjectNode) newConfiguration.get("rowRange")).put("start", 1);
- } else {
- newConfiguration.put("excludeFirstRow", false);
- rowFromValue.setText("1");
- ((ObjectNode) newConfiguration.get("rowRange")).put("start", 0);
- }
- }
- });
-
- rowIgnoreBlankRows.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent e) {
- newConfiguration.put("ignoreBlankRows", e.getStateChange() == ItemEvent.SELECTED);
- }
- });
-
- // empty cells
- emptyCellLabel = new JLabel(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.emptyCellSectionLabel"));
- addDivider(emptyCellLabel, SwingConstants.TOP, false);
-
- emptyCellButtonGroup = new ButtonGroup();
- emptyCellEmptyStringOption = new JRadioButton(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.emptyStringOption"));
- emptyCellUserDefinedOption = new JRadioButton(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.userDefinedOption"));
- emptyCellErrorValueOption = new JRadioButton(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.generateErrorOption"));
- emptyCellEmptyStringOption.setFocusable(false);
- emptyCellUserDefinedOption.setFocusable(false);
- emptyCellErrorValueOption.setFocusable(false);
-
- emptyCellUserDefinedValue = new JTextField(newConfiguration.get("emptyCellValue").textValue());
-
- emptyCellButtonGroup.add(emptyCellEmptyStringOption);
- emptyCellButtonGroup.add(emptyCellUserDefinedOption);
- emptyCellButtonGroup.add(emptyCellErrorValueOption);
-
- if (newConfiguration.get("emptyCellPolicy").textValue().equals("GENERATE_ERROR")) {
- emptyCellErrorValueOption.setSelected(true);
- emptyCellUserDefinedValue.setEnabled(false);
- emptyCellUserDefinedValue.setEditable(false);
- } else if (newConfiguration.get("emptyCellPolicy").textValue().equals("EMPTY_STRING")) {
- emptyCellEmptyStringOption.setSelected(true);
- emptyCellUserDefinedValue.setEnabled(false);
- emptyCellUserDefinedValue.setEditable(false);
- } else {
- emptyCellUserDefinedOption.setSelected(true);
- emptyCellUserDefinedValue.setText(newConfiguration.get("emptyCellValue").textValue());
- emptyCellUserDefinedValue.setEnabled(true);
- emptyCellUserDefinedValue.setEditable(true);
- }
-
- emptyCellEmptyStringOption.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- newConfiguration.put("emptyCellPolicy", "EMPTY_STRING");
- emptyCellUserDefinedValue.setEnabled(false);
- emptyCellUserDefinedValue.setEditable(false);
- }
- });
- emptyCellUserDefinedOption.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- newConfiguration.put("emptyCellPolicy", "USER_DEFINED");
- emptyCellUserDefinedValue.setEnabled(true);
- emptyCellUserDefinedValue.setEditable(true);
- emptyCellUserDefinedValue.requestFocusInWindow();
- }
- });
- emptyCellErrorValueOption.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- newConfiguration.put("emptyCellPolicy", "GENERATE_ERROR");
- emptyCellUserDefinedValue.setEnabled(false);
- emptyCellUserDefinedValue.setEditable(false);
- }
- });
-
- emptyCellUserDefinedValue.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
- }
-
- public void insertUpdate(DocumentEvent e) {
- newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
- }
- });
-
- // column mappings
- columnMappingLabel = new JLabel(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.columnMappingSectionLabel"));
- addDivider(columnMappingLabel, SwingConstants.TOP, false);
-
- Map<String, String> columnToPortMapping = new HashMap<>();
- if (newConfiguration.has("columnNames")) {
- for (JsonNode columnName : newConfiguration.get("columnNames")) {
- columnToPortMapping.put(columnName.get("column").textValue(), columnName.get("port").textValue());
- }
- }
- columnMappingTableModel = new SpreadsheetImportConfigTableModel(columnFromValue.getText(),
- columnToValue.getText(), columnToPortMapping);
-
- columnMappingTable = new JTable();
- columnMappingTable.setRowSelectionAllowed(false);
- columnMappingTable.getTableHeader().setReorderingAllowed(false);
- columnMappingTable.setGridColor(Color.LIGHT_GRAY);
- // columnMappingTable.setFocusable(false);
-
- columnMappingTable.setColumnModel(new DefaultTableColumnModel() {
- public TableColumn getColumn(int columnIndex) {
- TableColumn column = super.getColumn(columnIndex);
- if (columnIndex == 0) {
- column.setMaxWidth(100);
- }
- return column;
- }
- });
-
- TableCellEditor defaultEditor = columnMappingTable.getDefaultEditor(String.class);
- if (defaultEditor instanceof DefaultCellEditor) {
- DefaultCellEditor defaultCellEditor = (DefaultCellEditor) defaultEditor;
- defaultCellEditor.setClickCountToStart(1);
- Component editorComponent = defaultCellEditor.getComponent();
- if (editorComponent instanceof JTextComponent) {
- final JTextComponent textField = (JTextComponent) editorComponent;
- textField.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- updateModel(textField.getText());
- }
-
- public void insertUpdate(DocumentEvent e) {
- updateModel(textField.getText());
- }
-
- public void removeUpdate(DocumentEvent e) {
- updateModel(textField.getText());
- }
-
- private void updateModel(String text) {
- int row = columnMappingTable.getEditingRow();
- int column = columnMappingTable.getEditingColumn();
- columnMappingTableModel.setValueAt(text, row, column);
-
- ArrayNode columnNames = newConfiguration.arrayNode();
- Map<String, String> columnToPortMapping = columnMappingTableModel.getColumnToPortMapping();
- for (Entry<String,String> entry : columnToPortMapping.entrySet()) {
- columnNames.add(newConfiguration.objectNode().put("column", entry.getKey()).put("port", entry.getValue()));
- }
- newConfiguration.put("columnNames", columnNames);
- validatePortNames();
- }
-
- });
- }
- }
-
- columnMappingTable.setModel(columnMappingTableModel);
-
- // output format
- outputFormatLabel = new JLabel(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.outputFormatSectionLabel"));
-
- outputFormatMultiplePort = new JRadioButton(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.multiplePortOption"));
- outputFormatSinglePort = new JRadioButton(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.singlePortOption"));
- outputFormatMultiplePort.setFocusable(false);
- outputFormatSinglePort.setFocusable(false);
-
- outputFormatDelimiterLabel = new JLabel(SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigView.userDefinedCsvDelimiter"));
- outputFormatDelimiter = new JTextField(newConfiguration.get("csvDelimiter").textValue(), 5);
-
- outputFormatButtonGroup = new ButtonGroup();
- outputFormatButtonGroup.add(outputFormatMultiplePort);
- outputFormatButtonGroup.add(outputFormatSinglePort);
-
- if (newConfiguration.get("outputFormat").textValue().equals("PORT_PER_COLUMN")) {
- outputFormatMultiplePort.setSelected(true);
- outputFormatDelimiterLabel.setEnabled(false);
- outputFormatDelimiter.setEnabled(false);
- } else {
- outputFormatSinglePort.setSelected(true);
- columnMappingLabel.setEnabled(false);
- enableTable(columnMappingTable, false);
- }
-
- outputFormatMultiplePort.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- outputFormatDelimiterLabel.setEnabled(false);
- outputFormatDelimiter.setEnabled(false);
- columnMappingLabel.setEnabled(true);
- enableTable(columnMappingTable, true);
- newConfiguration.put("outputFormat", "PORT_PER_COLUMN");
- }
- });
- outputFormatSinglePort.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- outputFormatDelimiterLabel.setEnabled(true);
- outputFormatDelimiter.setEnabled(true);
- columnMappingLabel.setEnabled(false);
- enableTable(columnMappingTable, false);
- newConfiguration.put("outputFormat", "SINGLE_PORT");
- }
-
- });
- outputFormatDelimiter.getDocument().addDocumentListener(new DocumentListener() {
- public void changedUpdate(DocumentEvent e) {
- handleUpdate();
- }
-
- public void insertUpdate(DocumentEvent e) {
- handleUpdate();
- }
-
- public void removeUpdate(DocumentEvent e) {
- handleUpdate();
- }
-
- private void handleUpdate() {
- String text = null;
- try {
- text = StringEscapeUtils.unescapeJava(outputFormatDelimiter.getText());
- } catch (RuntimeException re) {}
- if (text == null || text.length() == 0) {
- newConfiguration.put("csvDelimiter", ",");
- } else {
- newConfiguration.put("csvDelimiter", text.substring(0, 1));
- }
- }
-
- });
-
- // buttons
- nextButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.nextButton"));
- nextButton.setFocusable(false);
- nextButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- backButton.setVisible(true);
- nextButton.setVisible(false);
- cardLayout.last(contentPanel);
- }
- });
-
- backButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.backButton"));
- backButton.setFocusable(false);
- backButton.setVisible(false);
- backButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- nextButton.setVisible(true);
- backButton.setVisible(false);
- cardLayout.first(contentPanel);
- }
- });
-
- buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- addDivider(buttonPanel, SwingConstants.TOP, true);
-
- removeAll();
- layoutPanel();
- }
-
- @Override
- public void noteConfiguration() {
- setJson(newConfiguration);
- configureInputPorts(serviceRegistry);
- configureOutputPorts(serviceRegistry);
- }
-
- @Override
- public boolean checkValues() {
- return errorMessages.isEmpty();
- }
-
- private void layoutPanel() {
- setPreferredSize(new Dimension(450, 400));
- setLayout(new BorderLayout());
-
- page1 = new JPanel(new GridBagLayout());
- page2 = new JPanel(new GridBagLayout());
-
- contentPanel = new JPanel(cardLayout);
- contentPanel.add(page1, "page1");
- contentPanel.add(page2, "page2");
- add(contentPanel, BorderLayout.CENTER);
-
- // title
- titlePanel.setBorder(new CompoundBorder(titlePanel.getBorder(), new EmptyBorder(10, 10, 0, 10)));
- add(titlePanel, BorderLayout.NORTH);
- titlePanel.add(titleLabel, BorderLayout.NORTH);
- titlePanel.add(titleIcon, BorderLayout.WEST);
- titlePanel.add(titleMessage, BorderLayout.CENTER);
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1;
- c.gridx = 0;
- c.gridwidth = GridBagConstraints.REMAINDER;
-
- // column range
- c.insets = new Insets(10, 10, 0, 10);
- page1.add(columnLabel, c);
-
- c.insets = new Insets(10, 25, 0, 0);
- c.gridwidth = 1;
- c.weightx = 0;
- page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
- c.insets = new Insets(10, 0, 0, 0);
- c.gridx = 1;
- page1.add(columnFromValue, c);
- c.gridx = 2;
- page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
- c.gridx = 3;
- page1.add(columnToValue, c);
-
- c.gridx = 0;
- c.weightx = 1;
- c.insets = new Insets(10, 10, 0, 10);
- c.gridwidth = GridBagConstraints.REMAINDER;
-
- // row range
- page1.add(rowLabel, c);
-
- c.insets = new Insets(10, 25, 0, 0);
- c.gridwidth = 1;
- c.gridx = 0;
- c.weightx = 0;
- page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
- c.insets = new Insets(10, 0, 0, 0);
- c.gridx = 1;
- page1.add(rowFromValue, c);
- c.gridx = 2;
- page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
- c.gridx = 3;
- page1.add(rowToValue, c);
- c.gridx = 4;
- page1.add(rowSelectAllOption, c);
- c.gridx = 5;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.insets = new Insets(10, 0, 0, 10);
- page1.add(rowExcludeFirstOption, c);
- c.insets = new Insets(10, 25, 0, 0);
- c.gridx = 0;
- page1.add(rowIgnoreBlankRows, c);
-
- c.gridx = 0;
-
- // empty cells
- c.insets = new Insets(10, 10, 10, 10);
- page1.add(emptyCellLabel, c);
-
- c.insets = new Insets(0, 25, 0, 10);
- page1.add(emptyCellEmptyStringOption, c);
- JPanel userDefinedPanel = new JPanel(new BorderLayout());
- userDefinedPanel.add(emptyCellUserDefinedOption, BorderLayout.WEST);
- userDefinedPanel.add(emptyCellUserDefinedValue, BorderLayout.CENTER);
- page1.add(userDefinedPanel, c);
- c.weighty = 1;
- c.anchor = GridBagConstraints.NORTHWEST;
- page1.add(emptyCellErrorValueOption, c);
-
- // output format
- c.insets = new Insets(10, 10, 10, 10);
- c.weighty = 0;
- c.weightx = 1;
- page2.add(outputFormatLabel, c);
-
- c.insets = new Insets(0, 25, 0, 10);
- page2.add(outputFormatMultiplePort, c);
- page2.add(outputFormatSinglePort, c);
-
- c.insets = new Insets(0, 50, 0, 10);
- JPanel outputFormatDelimiterPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- outputFormatDelimiterPanel.add(outputFormatDelimiterLabel);
- outputFormatDelimiterPanel.add(outputFormatDelimiter);
- page2.add(outputFormatDelimiterPanel, c);
-
- // column mapping
- c.insets = new Insets(10, 10, 0, 10);
- page2.add(columnMappingLabel, c);
-
- c.insets = new Insets(10, 10, 10, 10);
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 1;
- page2.add(new JScrollPane(columnMappingTable), c);
-
- buttonPanel.add(backButton);
- buttonPanel.add(nextButton);
- add(buttonPanel, BorderLayout.SOUTH);
- }
-
- /**
- * Displays the message with no icon.
- *
- * @param message
- * the message to display
- */
- public void setMessage(String message) {
- titleIcon.setIcon(null);
- titleMessage.setText(message);
- }
-
- /**
- * Adds the message to the top of the warning message stack. If the message is already in the
- * stack it is moved to the top. If there are no error messages the message is displayed.
- *
- * @param message
- * the warning message to add
- */
- public void addWarningMessage(String message) {
- if (warningMessages.contains(message)) {
- warningMessages.remove(message);
- }
- warningMessages.push(message);
- if (errorMessages.isEmpty()) {
- setWarningMessage(message);
- }
- }
-
- /**
- * Removes the message from the warning message stack. If there are no error messages the next
- * warning message is displayed. If there are no warning messages the default message is
- * displayed.
- *
- * @param message
- * the warning message to remove
- */
- public void removeWarningMessage(String message) {
- warningMessages.remove(message);
- if (errorMessages.isEmpty()) {
- if (warningMessages.isEmpty()) {
- setMessage(DEFAULT_MESSAGE);
- } else {
- setWarningMessage(warningMessages.peek());
- }
- }
- }
-
- /**
- * Displays the message and a warning icon.
- *
- * @param message
- * the warning message to display
- */
- public void setWarningMessage(String message) {
- titleIcon.setIcon(Icons.warningIcon);
- titleMessage.setText(message);
- }
-
- /**
- * Adds the message to the top of the error message stack. If the message is already in the
- * stack it is moved to the top. The message is then displayed.
- *
- * @param message
- * the error message to add
- */
- public void addErrorMessage(String message) {
- if (errorMessages.contains(message)) {
- errorMessages.remove(message);
- }
- errorMessages.push(message);
- setErrorMessage(message);
- }
-
- /**
- * Removes the message from the error message stack and displays the next error message. If
- * there are no error messages the next warning message is displayed. If there are no warning
- * messages the default message is displayed.
- *
- * @param message
- * the error message to remove
- */
- public void removeErrorMessage(String message) {
- errorMessages.remove(message);
- if (errorMessages.isEmpty()) {
- if (warningMessages.isEmpty()) {
- setMessage(DEFAULT_MESSAGE);
- } else {
- setWarningMessage(warningMessages.peek());
- }
- } else {
- setErrorMessage(errorMessages.peek());
- }
- }
-
- /**
- * Displays the message and an error icon.
- *
- * @param message
- * the error message to display
- */
- public void setErrorMessage(String message) {
- titleIcon.setIcon(Icons.severeIcon);
- titleMessage.setText(message);
- }
-
- protected boolean validatePortNames() {
- boolean isValid = true;
- Range columnRange = SpreadsheetUtils.getRange(newConfiguration.get("columnRange"));
- Map<String, String> mapping = new HashMap<>();
- if (newConfiguration.has("columnNames")) {
- for (JsonNode columnName : newConfiguration.get("columnNames")) {
- mapping.put(columnName.get("column").textValue(), columnName.get("port").textValue());
- }
- }
- Set<String> usedNames = new HashSet<String>();
- for (Entry<String, String> entry : mapping.entrySet()) {
- if (columnRange.contains(SpreadsheetUtils.getColumnIndex(entry.getKey()))) {
- String portName = entry.getValue();
- if (!usedNames.add(portName)) {
- isValid = false;
- break;
- }
- if (portName.matches("[A-Z]+")) {
- if (!mapping.containsKey(portName)) {
- int columnIndex = SpreadsheetUtils.getColumnIndex(portName);
- if (columnRange.contains(columnIndex)) {
- isValid = false;
- break;
- }
- }
- }
- }
- }
- if (isValid) {
- removeErrorMessage(DUPLICATE_PORT_NAME_ERROR_MESSAGE);
- } else {
- addErrorMessage(DUPLICATE_PORT_NAME_ERROR_MESSAGE);
- }
- return isValid;
- }
-
- protected boolean checkRowRange(String from, String to) {
- boolean result = false;
- try {
- int fromRow = Integer.parseInt(from);
- int toRow = Integer.parseInt(to);
- if (toRow < fromRow) {
- addErrorMessage(INCONSISTENT_ROW_MESSAGE);
- } else {
- removeErrorMessage(INCONSISTENT_ROW_MESSAGE);
- result = true;
- }
- } catch (NumberFormatException e) {
- logger.warn("Problem checking row range", e);
- }
- return result;
- }
-
- protected boolean checkColumnRange(int fromColumn, int toColumn) {
- boolean result = false;
- if (toColumn < fromColumn) {
- addErrorMessage(INCONSISTENT_COLUMN_MESSAGE);
- } else {
- removeErrorMessage(INCONSISTENT_COLUMN_MESSAGE);
- result = true;
- }
- return result;
- }
-
- /**
- * Adds a light gray or etched border to the top or bottom of a JComponent.
- *
- * @param component
- */
- protected void addDivider(JComponent component, final int position, final boolean etched) {
- component.setBorder(new Border() {
- private final Color borderColor = new Color(.6f, .6f, .6f);
-
- public Insets getBorderInsets(Component c) {
- if (position == SwingConstants.TOP) {
- return new Insets(5, 0, 0, 0);
- } else {
- return new Insets(0, 0, 5, 0);
- }
- }
-
- public boolean isBorderOpaque() {
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- if (position == SwingConstants.TOP) {
- if (etched) {
- g.setColor(borderColor);
- g.drawLine(x, y, x + width, y);
- g.setColor(Color.WHITE);
- g.drawLine(x, y + 1, x + width, y + 1);
- } else {
- g.setColor(Color.LIGHT_GRAY);
- g.drawLine(x, y, x + width, y);
- }
- } else {
- if (etched) {
- g.setColor(borderColor);
- g.drawLine(x, y + height - 2, x + width, y + height - 2);
- g.setColor(Color.WHITE);
- g.drawLine(x, y + height - 1, x + width, y + height - 1);
- } else {
- g.setColor(Color.LIGHT_GRAY);
- g.drawLine(x, y + height - 1, x + width, y + height - 1);
- }
- }
- }
-
- });
- }
-
- private void enableTable(JTable table, boolean enabled) {
- table.setEnabled(enabled);
- Component editor = table.getEditorComponent();
- if (editor != null) {
- editor.setEnabled(enabled);
- }
- if (enabled) {
- table.setForeground(Color.BLACK);
- table.getTableHeader().setForeground(Color.BLACK);
- } else {
- table.setForeground(Color.LIGHT_GRAY);
- table.getTableHeader().setForeground(Color.LIGHT_GRAY);
- }
- }
-
- static class UpperCaseDocument extends PlainDocument {
- @Override
- public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
- if (text.matches("[A-Za-z]+")) {
- text = text.toUpperCase();
- super.replace(offset, length, text, attrs);
- }
- }
- }
-
- static class NumericDocument extends PlainDocument {
- @Override
- public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
- if (text.length() == 0 || text.matches("[0-9]+")) {
- text = text.toUpperCase();
- super.replace(offset, length, text, attrs);
- }
- }
- }
-
- /**
- * Main method for testing the panel.
- *
- * @param args
- * @throws ActivityConfigurationException
- */
-// public static void main(String[] args) throws ActivityConfigurationException {
-// final JFrame frame = new JFrame();
-// SpreadsheetImportActivity activity = new SpreadsheetImportActivity();
-// activity.configure(new SpreadsheetImportConfiguration());
-// final SpreadsheetImportConfigView config = new SpreadsheetImportConfigView(activity);
-// config.setOkAction(new AbstractAction("Finish") {
-// public void actionPerformed(ActionEvent arg0) {
-// Range columnRange = config.getConfiguration().getColumnRange();
-// String fromColumn = SpreadsheetUtils.getColumnLabel(columnRange.getStart());
-// String toColumn = SpreadsheetUtils.getColumnLabel(columnRange.getEnd());
-// System.out.printf("%s (%s) - %s (%s)", fromColumn, columnRange.getStart(),
-// toColumn, columnRange.getEnd());
-// frame.setVisible(false);
-// frame.dispose();
-// }
-// });
-// config.setCancelAction(new AbstractAction("Cancel") {
-// public void actionPerformed(ActionEvent arg0) {
-// frame.setVisible(false);
-// frame.dispose();
-// }
-// });
-// frame.add(config);
-// frame.pack();
-// frame.setVisible(true);
-// }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualView.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualView.java
deleted file mode 100644
index 52bbc0f..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualView.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.views;
-
-import java.awt.Frame;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.spreadsheet.actions.SpreadsheetImportActivityConfigurationAction;
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-/**
- * A simple non editable HTML table view over a {@link SpreadsheetImportActivity}. Clicking on the
- * configure button shows the editable {@link SpreadsheetImportConfigView}
- *
- * @author David Withers
- */
-public class SpreadsheetImportContextualView extends HTMLBasedActivityContextualView {
-
- private static final long serialVersionUID = 1L;
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ActivityIconManager activityIconManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
- private final ServiceRegistry serviceRegistry;
-
- public SpreadsheetImportContextualView(Activity activity, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
- super(activity, colourManager);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- this.serviceRegistry = serviceRegistry;
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- StringBuilder html = new StringBuilder();
- html.append("<tr><th>");
- html.append(SpreadsheetImportUIText
- .getString("SpreadsheetImportContextualView.inputPortName"));
- html.append("</th><th>");
- html.append(SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.depth"));
- html.append("</th></tr>");
- for (InputActivityPort port : getActivity().getInputPorts()) {
- html.append("<tr><td>");
- html.append(port.getName());
- html.append("</td><td>");
- html.append(port.getDepth());
- html.append("</td></tr>");
- }
- html.append("<tr><th>");
- html.append(SpreadsheetImportUIText
- .getString("SpreadsheetImportContextualView.outputPortName"));
- html.append("</th><th>");
- html.append(SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.depth"));
- html.append("</th></tr>");
- for (OutputActivityPort port : getActivity().getOutputPorts()) {
- html.append("<tr><td>");
- html.append(port.getName());
- html.append("</td><td>");
- html.append(port.getDepth());
- html.append("</td></tr>");
- }
- return html.toString();
- }
-
- @Override
- public String getViewTitle() {
- return SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.activityName");
- }
-
- @Override
- public Action getConfigureAction(Frame owner) {
- return new SpreadsheetImportActivityConfigurationAction(
- getActivity(), owner, editManager, fileManager,
- activityIconManager, serviceDescriptionRegistry, serviceRegistry);
- }
-
- @Override
- public String getBackgroundColour() {
- return SpreadsheetImportActivityIcon.SPREADSHEET_COLOUR_HTML;
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
deleted file mode 100644
index 3105223..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * Factory for creating contextual a view of the SpreadsheetImport Activity
- *
- * @author David Withers
- */
-public class SpreadsheetImportContextualViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public boolean canHandle(Object object) {
- return object instanceof Activity
- && ((Activity) object).getType().equals(
- SpreadsheetImportTemplateService.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays.asList(new ContextualView[] { new SpreadsheetImportContextualView(activity,
- editManager, fileManager, activityIconManager, colourManager,
- serviceDescriptionRegistry, serviceRegistry) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
new file mode 100644
index 0000000..dee7d59
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.activities.spreadsheet.views.SpreadsheetImportConfigView;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * The configuration action for a SpreadsheetImport activity.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class SpreadsheetImportActivityConfigurationAction extends ActivityConfigurationAction {
+
+ private static final String CONFIGURE = "Configure";
+
+ private final EditManager editManager;
+
+ private final FileManager fileManager;
+
+ private final ServiceRegistry serviceRegistry;
+
+ public SpreadsheetImportActivityConfigurationAction(Activity activity,
+ Frame owner, EditManager editManager, FileManager fileManager,
+ ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.serviceRegistry = serviceRegistry;
+ putValue(NAME, CONFIGURE);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ final SpreadsheetImportConfigView spreadsheetConfigView = new SpreadsheetImportConfigView(
+ getActivity(), serviceRegistry);
+ final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
+ spreadsheetConfigView, editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/il8n/SpreadsheetImportUIText.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
new file mode 100644
index 0000000..d0014f7
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.il8n;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Access to a resource bundle containing UI text.
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportUIText {
+ private static final String BUNDLE_NAME = "net.sf.taverna.t2.activities.spreadsheet.iln8.ui-text";
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private SpreadsheetImportUIText() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
new file mode 100644
index 0000000..a2c0438
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
@@ -0,0 +1,109 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action to add a spreadsheet import activity + a wrapping processor to the workflow.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class SpreadsheetImportAddTemplateAction extends AbstractContextualMenuAction {
+
+ private static final URI insertSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/insert");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public SpreadsheetImportAddTemplateAction() {
+ super(insertSection, 700);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+
+ AbstractAction action = new AbstractAction(
+ SpreadsheetImportUIText.getString("SpreadsheetImportAddTemplateAction.addMenu"),
+ activityIconManager.iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE)) {
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(serviceDescriptionRegistry
+ .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false,
+ editManager, menuManager, selectionManager, serviceRegistry);
+ }
+
+ };
+
+ return action;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
new file mode 100644
index 0000000..7a8adb7
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
@@ -0,0 +1,123 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * An action to add a spreadsheet import activity + a wrapping processor to the workflow.
+ *
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class SpreadsheetImportAddTemplateMenuAction extends AbstractMenuAction {
+
+ private static final URI ADD_SPREADSHEET_IMPORT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddSpreadsheetImport");
+
+ private static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ private static String ADD_SPREADSHEET_IMPORT = SpreadsheetImportUIText
+ .getString("SpreadsheetImportAddTemplateAction.addMenu");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public SpreadsheetImportAddTemplateMenuAction() {
+ super(INSERT, 700, ADD_SPREADSHEET_IMPORT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddSpreadsheetImportMenuAction();
+ }
+
+ protected class AddSpreadsheetImportMenuAction extends AbstractAction implements
+ DesignOnlyAction {
+ AddSpreadsheetImportMenuAction() {
+ super();
+ putValue(SMALL_ICON,
+ activityIconManager
+ .iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE));
+ putValue(NAME, ADD_SPREADSHEET_IMPORT);
+ putValue(SHORT_DESCRIPTION, ADD_SPREADSHEET_IMPORT);
+ putValue(
+ Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.SHIFT_DOWN_MASK
+ | InputEvent.ALT_DOWN_MASK));
+
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(serviceDescriptionRegistry
+ .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false,
+ editManager, menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
new file mode 100644
index 0000000..ecac937
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
@@ -0,0 +1,83 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.menu;
+
+import javax.swing.Action;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+import org.apache.taverna.activities.spreadsheet.actions.SpreadsheetImportActivityConfigurationAction;
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * Menu action for SpreadsheetImport activity configuration.
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportConfigureMenuAction extends AbstractConfigureActivityMenuAction {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public SpreadsheetImportConfigureMenuAction() {
+ super(SpreadsheetImportTemplateService.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ Action result = new SpreadsheetImportActivityConfigurationAction(findActivity(),
+ getParentFrame(), editManager, fileManager, activityIconManager,
+ serviceDescriptionRegistry, serviceRegistry);
+ result.putValue(Action.NAME, SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigureMenuAction.configureMenu"));
+ addMenuDots(result);
+ return result;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
new file mode 100644
index 0000000..7429af7
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.servicedescriptions;
+
+import java.awt.Color;
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+/**
+ * UI icon for the SpreadsheetImport Activity.
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportActivityIcon implements ActivityIconSPI {
+
+ public static final String SPREADSHEET_COLOUR_HTML = "#40e0d0";
+ public static final Color SPREADSHEET_COLOUR = Color.decode(SPREADSHEET_COLOUR_HTML);
+
+ private static Icon icon = null;
+
+ @Override
+ public int canProvideIconScore(URI activityType) {
+ if (SpreadsheetImportTemplateService.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ @Override
+ public Icon getIcon(URI activityType) {
+ return getSpreadsheetImportIcon();
+ }
+
+ public static Icon getSpreadsheetImportIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(
+ SpreadsheetImportActivityIcon.class.getResource("/spreadsheet-import.png"));
+ }
+ return icon;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ colourManager.setPreferredColour(
+ "http://ns.taverna.org.uk/2010/activity/spreadsheet-import",
+ SPREADSHEET_COLOUR);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
new file mode 100644
index 0000000..70f4f54
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
@@ -0,0 +1,100 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * Definition of the SpreadsheetImport spreadsheet import template service.
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportTemplateService extends AbstractTemplateService {
+
+ public static final URI ACTIVITY_TYPE = URI
+ .create("http://ns.taverna.org.uk/2010/activity/spreadsheet-import");
+
+ private static final String SERVICE_NAME = SpreadsheetImportUIText
+ .getString("SpreadsheetImportTemplateService.serviceName");
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/spreadsheet");
+
+ public String getName() {
+ return SERVICE_NAME;
+ }
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ ObjectNode json = (ObjectNode) configuration.getJson();
+ json.put("columnRange", json.objectNode().put("start", 0).put("end", 1));
+ json.put("rowRange", json.objectNode().put("start", 0).put("end", -1));
+ json.put("emptyCellValue", "");
+ json.put("allRows", true);
+ json.put("excludeFirstRow", false);
+ json.put("ignoreBlankRows", false);
+ json.put("emptyCellPolicy", "EMPTY_STRING");
+ json.put("outputFormat", "PORT_PER_COLUMN");
+ json.put("csvDelimiter", ",");
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return SpreadsheetImportActivityIcon.getSpreadsheetImportIcon();
+ }
+
+ @Override
+ public String getDescription() {
+ return SpreadsheetImportUIText
+ .getString("SpreadsheetImportTemplateService.serviceDescription");
+ }
+
+ public static ServiceDescription getServiceDescription() {
+ SpreadsheetImportTemplateService bts = new SpreadsheetImportTemplateService();
+ return bts.templateService;
+ }
+
+ public String getId() {
+ return providerId.toString();
+ }
+
+ @Override
+ public ServiceDescriptionProvider newInstance() {
+ return new SpreadsheetImportTemplateService();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
new file mode 100644
index 0000000..4dbd1fa
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
@@ -0,0 +1,188 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.views;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.taverna.activities.spreadsheet.SpreadsheetUtils;
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+
+/**
+ * TableModel for mapping column labels to port names.
+ * <p>
+ * The default mapping is for the port name to be the same as the column label. The
+ * columnToPortMapping only contains entries for port names that are not the same as the column
+ * label.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class SpreadsheetImportConfigTableModel extends AbstractTableModel {
+
+ private Map<String, String> columnToPortMapping;
+
+ private int fromColumn, toColumn;
+
+ /**
+ * Constructs a TableModel that maps column labels to port names for the specified range of
+ * columns.
+ *
+ * @param fromColumn
+ * the start of the column range
+ * @param toColumn
+ * the end of the column range
+ * @param columnToPortMapping
+ * existing column to port mappings (can be null)
+ */
+ public SpreadsheetImportConfigTableModel(String fromColumn, String toColumn,
+ Map<String, String> columnToPortMapping) {
+ if (columnToPortMapping == null) {
+ this.columnToPortMapping = new HashMap<String, String>();
+ } else {
+ this.columnToPortMapping = new HashMap<String, String>(columnToPortMapping);
+ }
+ this.fromColumn = SpreadsheetUtils.getColumnIndex(fromColumn);
+ this.toColumn = SpreadsheetUtils.getColumnIndex(toColumn);
+ }
+
+ /**
+ * Sets the start of the column range.
+ *
+ * @param fromColumn
+ * the start of the column range
+ */
+ public void setFromColumn(int fromColumn) {
+ if (this.fromColumn != fromColumn) {
+ this.fromColumn = fromColumn;
+ fireTableStructureChanged();
+ }
+ }
+
+ /**
+ * Sets the end of the column range.
+ *
+ * @param toColumn
+ * the end of the column range
+ */
+ public void setToColumn(int toColumn) {
+ if (this.toColumn != toColumn) {
+ this.toColumn = toColumn;
+ fireTableStructureChanged();
+ }
+ }
+
+ /**
+ * Returns the port name for the given column label.
+ * <p>
+ * If the columnLabel is the columnToPortMapping the value is returned; otherwise the
+ * columnLabel is returned.
+ *
+ * @param columnLabel
+ * the column to find the port name for
+ * @return the port name for the given column label
+ */
+ public String getPortName(String columnLabel) {
+ String portName;
+ if (columnToPortMapping.containsKey(columnLabel)) {
+ portName = columnToPortMapping.get(columnLabel);
+ } else {
+ portName = columnLabel;
+ }
+ return portName;
+ }
+
+ /**
+ * Sets the port name for the column label.
+ * <p>
+ * If the port name is not the same as the column label the port name is added the
+ * columnToPortMapping.
+ *
+ * @param columnLabel
+ * @param portName
+ */
+ public void setPortName(String columnLabel, String portName) {
+ if (columnLabel.equals(portName)) {
+ columnToPortMapping.remove(columnLabel);
+ } else {
+ columnToPortMapping.put(columnLabel, portName);
+ }
+ }
+
+ /**
+ * Returns the map of column labels to port names.
+ * <p>
+ * The map only contains entries for port names that are not the same as their corresponding
+ * column label.
+ *
+ * @return the map of column labels to port names
+ */
+ public Map<String, String> getColumnToPortMapping() {
+ return columnToPortMapping;
+ }
+
+ // TableModel methods
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+ return String.class;
+ }
+
+ public int getColumnCount() {
+ return 2;
+ }
+
+ @Override
+ public String getColumnName(int columnIndex) {
+ if (columnIndex == 0) {
+ return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.column");
+ } else {
+ return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.portName");
+ }
+ }
+
+ public int getRowCount() {
+ return toColumn - fromColumn + 1;
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ String columnLabel = SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn);
+ if (columnIndex == 0) {
+ return columnLabel;
+ } else {
+ return getPortName(columnLabel);
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return columnIndex == 1;
+ }
+
+ @Override
+ public void setValueAt(Object value, int rowIndex, int columnIndex) {
+ if (columnIndex == 1) {
+ setPortName(SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn), value.toString());
+ }
+ }
+
+}
[05/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProvider.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
new file mode 100644
index 0000000..c9d7c59
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
@@ -0,0 +1,227 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+import javax.wsdl.Operation;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.taverna.activities.wsdl.WSDLActivityHealthChecker;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.AbstractConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.events.RemovedProviderEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider.CustomizedConfigureCallBack;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider.FindServiceDescriptionsCallBack;
+import org.xml.sax.SAXException;
+
+public class WSDLServiceProvider extends
+ AbstractConfigurableServiceProvider<WSDLServiceProviderConfig> implements
+ CustomizedConfigurePanelProvider<WSDLServiceProviderConfig> {
+
+ private static Logger logger = Logger.getLogger(WSDLServiceProvider.class);
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/wsdl");
+
+ private CredentialManager credentialManager;
+
+ public static class FlushWSDLCacheOnRemovalObserver implements
+ Observer<ServiceDescriptionRegistryEvent> {
+ public void notify(
+ Observable<ServiceDescriptionRegistryEvent> registry,
+ ServiceDescriptionRegistryEvent event) throws Exception {
+ if (!(event instanceof RemovedProviderEvent)) {
+ return;
+ }
+ RemovedProviderEvent removedProviderEvent = (RemovedProviderEvent) event;
+ if (!(removedProviderEvent.getProvider() instanceof WSDLServiceProvider)) {
+ return;
+ }
+ WSDLServiceProvider serviceProvider = (WSDLServiceProvider) removedProviderEvent
+ .getProvider();
+ URI wsdlLocation = serviceProvider.getConfiguration().getURI();
+ WSDLParser.flushCache(wsdlLocation.toASCIIString());
+ logger.info("Flushed cache for WSDL " + wsdlLocation);
+ }
+ }
+
+ private static final String WSDL_SERVICE = "WSDL service";
+
+ private static FlushWSDLCacheOnRemovalObserver flushObserver = new FlushWSDLCacheOnRemovalObserver();
+
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ public WSDLServiceProvider() {
+ super(new WSDLServiceProviderConfig("http://somehost/service?wsdl"));
+ }
+
+ public String getName() {
+ return WSDL_SERVICE;
+ }
+
+ public List<WSDLServiceProviderConfig> getDefaultConfigurations() {
+
+ List<WSDLServiceProviderConfig> defaults = new ArrayList<WSDLServiceProviderConfig>();
+
+ // If defaults have failed to load from a configuration file then load them here.
+ if (!serviceDescriptionRegistry.isDefaultSystemConfigurableProvidersLoaded()){
+ // 2009-12-16: 503 server error
+ defaults.add(new WSDLServiceProviderConfig(
+ "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl"));
+ defaults.add(new WSDLServiceProviderConfig(
+ "http://soap.bind.ca/wsdl/bind.wsdl"));
+ defaults.add(new WSDLServiceProviderConfig(
+ "http://www.ebi.ac.uk/ws/services/urn:Dbfetch?wsdl"));
+ } // else return an empty list
+
+ return defaults;
+ }
+
+ public void findServiceDescriptionsAsync(
+ FindServiceDescriptionsCallBack callBack) {
+
+ URI wsdl = serviceProviderConfig.getURI();
+
+ callBack.status("Parsing wsdl:" + wsdl);
+ WSDLParser parser = null;
+ try {
+ parser = new WSDLParser(wsdl.toASCIIString());
+ List<Operation> operations = parser.getOperations();
+ callBack.status("Found " + operations.size() + " WSDL operations:"
+ + wsdl);
+ List<WSDLServiceDescription> items = new ArrayList<WSDLServiceDescription>();
+ for (Operation op : operations) {
+ WSDLServiceDescription item = new WSDLServiceDescription(credentialManager);
+ try {
+ String name = op.getName();
+ item.setOperation(name);
+ String use = parser.getUse(name);
+ String style = parser.getStyle();
+ if (!WSDLActivityHealthChecker.checkStyleAndUse(style, use)) {
+ logger.warn("Unsupported style and use combination " + style + "/" + use + " for operation " + name + " from " + wsdl);
+ continue;
+ }
+ item.setUse(use);
+ item.setStyle(style);
+ item.setURI(wsdl);
+ item.setDescription(parser.getOperationDocumentation(name));
+ items.add(item);
+ } catch (UnknownOperationException e) {
+ String message = "Encountered an unexpected operation name:"
+ + item.getOperation();
+ callBack.fail(message, e);
+ }
+ }
+ callBack.partialResults(items);
+ callBack.finished();
+ } catch (ParserConfigurationException e) {
+ String message = "Error configuring the WSDL parser";
+ callBack.fail(message, e);
+ } catch (WSDLException e) {
+ String message = "There was an error with the wsdl: " + wsdl;
+ callBack.fail(message, e);
+ } catch (IOException e) {
+ String message = "There was an IO error parsing the wsdl: " + wsdl
+ + " Possible reason: the wsdl location was incorrect.";
+ callBack.fail(message, e);
+ } catch (SAXException e) {
+ String message = "There was an error with the XML in the wsdl: "
+ + wsdl;
+ callBack.fail(message, e);
+ } catch (IllegalArgumentException e) { // a problem with the wsdl url
+ String message = "There was an error with the wsdl: " + wsdl + " "
+ + "Possible reason: the wsdl location was incorrect.";
+ callBack.fail(message, e);
+ } catch (Exception e) { // anything else we did not expect
+ String message = "There was an error with the wsdl: " + wsdl;
+ callBack.fail(message, e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName() + " " + getConfiguration().getURI();
+ }
+
+ public Icon getIcon() {
+ return WSDLActivityIcon.getWSDLIcon();
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ List<String> result;
+ result = Arrays.asList(getConfiguration().getURI().toString());
+ return result;
+ }
+
+ /**
+ * Will be set by ServiceDescriptionRegistryImpl
+ *
+ * @param registry Registry this provider has been added to
+ */
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ synchronized (flushObserver) {
+ // Add the (static common) observer if the registry does not have it
+ if (!serviceDescriptionRegistry.getObservers().contains(flushObserver)) {
+ serviceDescriptionRegistry.addObserver(flushObserver);
+ }
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public void createCustomizedConfigurePanel(final CustomizedConfigureCallBack<WSDLServiceProviderConfig> callBack) {
+
+ AddWSDLServiceDialog addWSDLServiceDialog = new AddWSDLServiceDialog() {
+ @Override
+ protected void addRegistry(String wsdlURL) {
+
+ WSDLServiceProviderConfig providerConfig = new WSDLServiceProviderConfig(wsdlURL);
+ callBack.newProviderConfiguration(providerConfig);
+ }
+ };
+ addWSDLServiceDialog.setVisible(true);
+ }
+
+ public String getId() {
+ return providerId.toString();
+ }
+
+ public void setCredentialManager(CredentialManager credentialManager) {
+ this.credentialManager = credentialManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
new file mode 100644
index 0000000..465de26
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.net.URI;
+
+import org.apache.taverna.lang.beans.PropertyAnnotated;
+import org.apache.taverna.lang.beans.PropertyAnnotation;
+
+public class WSDLServiceProviderConfig extends PropertyAnnotated {
+ private URI uri;
+
+ public WSDLServiceProviderConfig() {
+ }
+
+ public WSDLServiceProviderConfig(String uri) {
+ this.uri = URI.create(uri);
+ }
+
+ @PropertyAnnotation(displayName = "WSDL location", preferred = true)
+ public URI getURI() {
+ return uri;
+ }
+
+ public void setURI(URI uri) {
+ this.uri = uri;
+ }
+
+ @Override
+ public String toString() {
+ return getURI().toASCIIString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
new file mode 100644
index 0000000..bfd2ba0
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class XMLInputSplitterActivityIcon implements ActivityIconSPI{
+
+ private static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
+
+ private static Icon icon = null;
+
+ public int canProvideIconScore(URI activityType) {
+ if (activityType.equals(ACTIVITY_TYPE))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getXMLOutputSplitterIcon();
+ }
+
+ public static Icon getXMLOutputSplitterIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(XMLOutputSplitterActivityIcon.class.getResource("/xml-splitter.png"));
+ }
+ return icon;
+ }
+
+}
+
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
new file mode 100644
index 0000000..edc5fe6
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class XMLOutputSplitterActivityIcon implements ActivityIconSPI{
+
+ private static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
+
+ private static Icon icon = null;
+
+ public int canProvideIconScore(URI activityType) {
+ if (activityType.equals(ACTIVITY_TYPE))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getXMLOutputSplitterIcon();
+ }
+
+ public static Icon getXMLOutputSplitterIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(XMLOutputSplitterActivityIcon.class.getResource("/xml-splitter.png"));
+ }
+ return icon;
+ }
+
+}
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/AbstractXMLSplitterActionView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/AbstractXMLSplitterActionView.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/AbstractXMLSplitterActionView.java
new file mode 100644
index 0000000..58436d5
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/AbstractXMLSplitterActionView.java
@@ -0,0 +1,178 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.taverna.activities.wsdl.actions.AbstractAddXMLSplitterAction;
+import org.apache.taverna.activities.wsdl.actions.AddXMLInputSplitterAction;
+import org.apache.taverna.activities.wsdl.actions.AddXMLOutputSplitterAction;
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+
+import org.apache.log4j.Logger;
+import org.jdom.JDOMException;
+import org.xml.sax.SAXException;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.DepthPort;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+@SuppressWarnings("serial")
+public abstract class AbstractXMLSplitterActionView extends HTMLBasedActivityContextualView {
+
+ private static Logger logger = Logger.getLogger(AbstractXMLSplitterActionView.class);
+ protected final EditManager editManager;
+ protected final SelectionManager selectionManager;
+ protected AbstractAddXMLSplitterAction splitterAction;
+
+ public AbstractXMLSplitterActionView(Activity activity, EditManager editManager,
+ SelectionManager selectionManager, ColourManager colourManager) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
+ splitterAction = new AddXMLOutputSplitterAction(getActivity(),
+ null, editManager, selectionManager);
+ } else if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
+ splitterAction = new AddXMLInputSplitterAction(getActivity(),
+ null, editManager, selectionManager);
+ }
+ super.initView();
+ }
+
+ @Override
+ public void initView() {
+ }
+
+ protected void addOutputSplitter(final JComponent mainFrame, JPanel flowPanel) {
+ if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
+ try {
+ Map<String, TypeDescriptor> descriptors = splitterAction.getTypeDescriptors();
+ if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
+ flowPanel.add(new JButton(splitterAction));
+ }
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ logger.warn("Could not find type descriptors for " + getActivity(), e);
+ }
+ }
+ }
+
+ protected void addInputSplitter(final JComponent mainFrame, JPanel flowPanel) {
+ if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
+ try {
+ Map<String, TypeDescriptor> descriptors = splitterAction.getTypeDescriptors();
+ if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
+ splitterAction.setOwner(mainFrame);
+ flowPanel.add(new JButton(splitterAction));
+ }
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ logger.warn("Could not find type descriptors for " + getActivity(), e);
+ }
+ }
+ }
+
+ protected String describePorts() {
+ StringBuilder html = new StringBuilder();
+
+ if (!getActivity().getInputPorts().isEmpty()) {
+ html.append("<tr><th colspan='2' align='left'>Inputs</th></tr>");
+ for (InputActivityPort port : getActivity().getInputPorts()) {
+ TypeDescriptor descriptor = null;
+ if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
+ try {
+ descriptor = splitterAction.getTypeDescriptors().get(port.getName());
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ logger.warn("Could not find type descriptors for " + getActivity(), e);
+ }
+ }
+ if (descriptor == null) {
+ html.append(describePort(port));
+ } else {
+ html.append(describePort(port, descriptor));
+ }
+
+ }
+ }
+
+ if (!getActivity().getOutputPorts().isEmpty()) {
+ html.append("<tr><th colspan='2' align='left'>Outputs</th></tr>");
+ for (OutputActivityPort port : getActivity().getOutputPorts()) {
+ TypeDescriptor descriptor = null;
+ if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
+ try {
+ descriptor = splitterAction.getTypeDescriptors().get(port.getName());
+ } catch (UnknownOperationException | IOException | ParserConfigurationException
+ | WSDLException | SAXException | JDOMException e) {
+ logger.warn("Could not find type descriptors for " + getActivity(), e);
+ }
+ }
+ if (descriptor == null) {
+ html.append(describePort(port));
+ } else {
+ html.append(describePort(port, descriptor));
+ }
+ }
+ }
+
+ return html.toString();
+ }
+
+ private String describePort(DepthPort port, TypeDescriptor descriptor) {
+ String html = "<tr><td>" + port.getName() + "</td><td>";
+ if (descriptor != null && descriptor.isOptional()) {
+ html += "<em>optional</em><br>";
+ }
+ html+="Depth:"+port.getDepth()+"<br>";
+ if (descriptor != null ) {
+ html+="<code>"+descriptor.getQname().toString()+"</code><br>";
+// if (descriptor.getDocumentation() != null && !descriptor.getDocumentation().isEmpty()){
+// html += "<p>"+descriptor.getDocumentation()+"</p>";
+// }
+ }
+
+ html+="</td></tr>";
+ return html;
+ }
+
+ private String describePort(DepthPort port) {
+ String html = "<tr><td>" + port.getName() + "</td><td>";
+ html += "Depth:" + port.getDepth() + "<br>";
+ html += "</td></tr>";
+ return html;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityConfigurationView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityConfigurationView.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityConfigurationView.java
new file mode 100644
index 0000000..59470f7
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityConfigurationView.java
@@ -0,0 +1,445 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.net.URI;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
+
+import org.apache.taverna.activities.wsdl.security.SecurityProfiles;
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Configuration dialog for WSDL activity.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class WSDLActivityConfigurationView extends ActivityConfigurationPanel implements ItemListener {
+
+ private CredentialManager credentialManager;
+ private CredentialManagerUI credManagerUI;
+
+ private ButtonGroup buttonGroup;
+ private JRadioButton noSecurityRadioButton;
+ private JLabel noSecurityLabel;
+ private JRadioButton httpSecurityAuthNRadioButton;
+ private JLabel httpSecurityAuthNLabel;
+ private JRadioButton wsSecurityAuthNRadioButton;
+ private JLabel wsSecurityAuthNLabel;
+
+ // Password types
+ private final String PLAINTEXT_PASSWORD = "Plaintext password";
+ private final String DIGEST_PASSWORD = "Digest password";
+ private String[] passwordTypes = new String[] { PLAINTEXT_PASSWORD, DIGEST_PASSWORD };
+ private String[] tooltips = new String[] {
+ "Password will be sent in plaintext (which is OK if service is using HTTPS)",
+ "Password will be digested (cryptographically hashed) before sending" };
+ private JComboBox<String> passwordTypeComboBox;
+ private JCheckBox addTimestampCheckBox;
+ private JButton setHttpUsernamePasswordButton;
+ private JButton setWsdlUsernamePasswordButton;
+
+ // private Logger logger = Logger.getLogger(WSDLActivityConfigurationView.class);
+
+ public WSDLActivityConfigurationView(Activity activity, CredentialManager credentialManager) {
+ super(activity);
+ this.credentialManager = credentialManager;
+ initialise();
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+
+ int gridy = 0;
+
+ // title panel
+ JPanel titlePanel = new JPanel(new BorderLayout());
+ titlePanel.setBackground(Color.WHITE);
+ JLabel titleLabel = new JLabel("Security configuration");
+ titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
+ titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
+ DialogTextArea titleMessage = new DialogTextArea(
+ "Select a security profile for the service");
+ titleMessage.setMargin(new Insets(5, 20, 10, 10));
+ titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
+ titleMessage.setEditable(false);
+ titleMessage.setFocusable(false);
+ titlePanel.setBorder(new EmptyBorder(10, 10, 0, 10));
+ titlePanel.add(titleLabel, BorderLayout.NORTH);
+ titlePanel.add(titleMessage, BorderLayout.CENTER);
+ addDivider(titlePanel, SwingConstants.BOTTOM, true);
+
+ // Main panel
+ JPanel mainPanel = new JPanel();
+ mainPanel.setLayout(new GridBagLayout());
+ mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ // Create the radio buttons
+ noSecurityRadioButton = new JRadioButton("None");
+ noSecurityRadioButton.addItemListener(this);
+
+ wsSecurityAuthNRadioButton = new JRadioButton(
+ "WS-Security username and password authentication");
+ wsSecurityAuthNRadioButton.addItemListener(this);
+
+ httpSecurityAuthNRadioButton = new JRadioButton("HTTP username and password authentication");
+ httpSecurityAuthNRadioButton.addItemListener(this);
+
+ // Group the radio buttons
+ buttonGroup = new ButtonGroup();
+ buttonGroup.add(noSecurityRadioButton);
+ buttonGroup.add(wsSecurityAuthNRadioButton);
+ buttonGroup.add(httpSecurityAuthNRadioButton);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 0);
+ mainPanel.add(noSecurityRadioButton, gbc);
+
+ noSecurityLabel = new JLabel("Service requires no security");
+ noSecurityLabel.setFont(noSecurityLabel.getFont().deriveFont(11f));
+ // addDivider(noSecurityLabel, SwingConstants.BOTTOM, false);
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(0, 40, 10, 10);
+ mainPanel.add(noSecurityLabel, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 0);
+ mainPanel.add(httpSecurityAuthNRadioButton, gbc);
+
+ ActionListener usernamePasswordListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ // Get Credential Manager UI to get the username and password for the service
+ if (credManagerUI == null) {
+ credManagerUI = new CredentialManagerUI(credentialManager);
+ }
+ credManagerUI.newPasswordForService(URI.create(getJson().get("operation")
+ .get("wsdl").textValue()));
+ }
+ };
+
+ httpSecurityAuthNLabel = new JLabel(
+ "Service requires HTTP username and password in order to authenticate the user");
+ httpSecurityAuthNLabel.setFont(httpSecurityAuthNLabel.getFont().deriveFont(11f));
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(0, 40, 10, 10);
+ mainPanel.add(httpSecurityAuthNLabel, gbc);
+
+ // Set username and password button;
+ setHttpUsernamePasswordButton = new JButton("Set username and password");
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.EAST;
+ gbc.insets = new Insets(0, 40, 10, 10);
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0; // add any vertical space to this component
+ mainPanel.add(setHttpUsernamePasswordButton, gbc);
+ setHttpUsernamePasswordButton.addActionListener(usernamePasswordListener);
+
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 10, 0, 0);
+ mainPanel.add(wsSecurityAuthNRadioButton, gbc);
+
+ wsSecurityAuthNLabel = new JLabel(
+ "Service requires WS-Security username and password in order to authenticate the user");
+ wsSecurityAuthNLabel.setFont(wsSecurityAuthNLabel.getFont().deriveFont(11f));
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(0, 40, 0, 0);
+ mainPanel.add(wsSecurityAuthNLabel, gbc);
+
+ // Password type list
+ passwordTypeComboBox = new JComboBox<>(passwordTypes);
+ passwordTypeComboBox.setRenderer(new ComboBoxTooltipRenderer());
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(10, 40, 0, 0);
+ mainPanel.add(passwordTypeComboBox, gbc);
+
+ // 'Add timestamp' checkbox
+ addTimestampCheckBox = new JCheckBox("Add a timestamp to SOAP message");
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.insets = new Insets(5, 40, 10, 10);
+ mainPanel.add(addTimestampCheckBox, gbc);
+
+ // Set username and password button;
+ setWsdlUsernamePasswordButton = new JButton("Set username and password");
+ gbc.gridx = 0;
+ gbc.gridy = gridy++;
+ gbc.fill = GridBagConstraints.NONE;
+ gbc.anchor = GridBagConstraints.EAST;
+ gbc.insets = new Insets(0, 40, 10, 10);
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0; // add any vertical space to this component
+ mainPanel.add(setWsdlUsernamePasswordButton, gbc);
+ setWsdlUsernamePasswordButton.addActionListener(usernamePasswordListener);
+
+ addDivider(mainPanel, SwingConstants.BOTTOM, true);
+
+ // Enable/disable controls based on what is the current security profiles
+ if (!getJson().has("securityProfile")) {
+ noSecurityRadioButton.setSelected(true);
+ } else {
+ URI securityProfile = URI.create(getJson().get("securityProfile").textValue());
+ if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
+ wsSecurityAuthNRadioButton.setSelected(true);
+ }
+ if (securityProfile.equals(SecurityProfiles.HTTP_BASIC_AUTHN)
+ || securityProfile.equals(SecurityProfiles.HTTP_DIGEST_AUTHN)) {
+ httpSecurityAuthNRadioButton.setSelected(true);
+ }
+ if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
+ passwordTypeComboBox.setSelectedItem(PLAINTEXT_PASSWORD);
+ } else if (securityProfile
+ .equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
+ passwordTypeComboBox.setSelectedItem(DIGEST_PASSWORD);
+ }
+ if (securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)
+ || securityProfile
+ .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
+ addTimestampCheckBox.setSelected(true);
+ } else {
+ addTimestampCheckBox.setSelected(false);
+ }
+ }
+
+ // Put everything together
+ JPanel layoutPanel = new JPanel(new BorderLayout());
+ layoutPanel.add(titlePanel, BorderLayout.NORTH);
+ layoutPanel.add(mainPanel, BorderLayout.CENTER);
+ layoutPanel.setPreferredSize(new Dimension(550, 400));
+
+ add(layoutPanel);
+ }
+
+ @Override
+ public boolean checkValues() {
+ return true;
+ }
+
+ @Override
+ public void noteConfiguration() {
+
+ if (noSecurityRadioButton.isSelected()) {
+ getJson().remove("securityProfile"); // no security required
+ } else if (httpSecurityAuthNRadioButton.isSelected()) {
+ getJson().put("securityProfile", SecurityProfiles.HTTP_BASIC_AUTHN.toString());
+ } else if (wsSecurityAuthNRadioButton.isSelected()) { // plaintext password
+ if (passwordTypeComboBox.getSelectedItem().equals(PLAINTEXT_PASSWORD)) {
+ if (addTimestampCheckBox.isSelected()) {
+ getJson().put(
+ "securityProfile",
+ SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD
+ .toString());
+ } else {
+ getJson().put("securityProfile",
+ SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD.toString());
+ }
+ } else { // digest password
+ if (addTimestampCheckBox.isSelected()) {
+ getJson().put(
+ "securityProfile",
+ SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD
+ .toString());
+ } else {
+ getJson().put("securityProfile",
+ SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD.toString());
+ }
+ }
+ }
+ }
+
+ /**
+ * Disable/enable items on the panel based on this radio button
+ * has been selected.
+ */
+ public void itemStateChanged(ItemEvent e) {
+
+ Object source = e.getItemSelectable();
+ if (source == noSecurityRadioButton) {
+ httpSecurityAuthNLabel.setEnabled(false);
+ wsSecurityAuthNLabel.setEnabled(false);
+ passwordTypeComboBox.setEnabled(false);
+ setHttpUsernamePasswordButton.setEnabled(false);
+ setWsdlUsernamePasswordButton.setEnabled(false);
+ addTimestampCheckBox.setEnabled(false);
+
+ noSecurityLabel.setEnabled(true);
+ } else if (source == httpSecurityAuthNRadioButton) {
+ noSecurityLabel.setEnabled(false);
+ httpSecurityAuthNLabel.setEnabled(true);
+ wsSecurityAuthNLabel.setEnabled(false);
+ passwordTypeComboBox.setEnabled(false);
+ setHttpUsernamePasswordButton.setEnabled(true);
+ setWsdlUsernamePasswordButton.setEnabled(false);
+ addTimestampCheckBox.setEnabled(false);
+ } else if (source == wsSecurityAuthNRadioButton) {
+ noSecurityLabel.setEnabled(false);
+ httpSecurityAuthNLabel.setEnabled(false);
+ wsSecurityAuthNLabel.setEnabled(true);
+ passwordTypeComboBox.setEnabled(true);
+ setHttpUsernamePasswordButton.setEnabled(false);
+ setWsdlUsernamePasswordButton.setEnabled(true);
+ addTimestampCheckBox.setEnabled(true);
+ }
+ }
+
+ /**
+ * A renderer for JComboBox that will display a tooltip for
+ * the selected item.
+ */
+ class ComboBoxTooltipRenderer extends BasicComboBoxRenderer {
+ public Component getListCellRendererComponent(JList list, Object value, int index,
+ boolean isSelected, boolean cellHasFocus) {
+ if (isSelected) {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ if (-1 < index) {
+ list.setToolTipText(tooltips[index]);
+ }
+ } else {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+ setFont(list.getFont());
+ setText((value == null) ? "" : value.toString());
+ return this;
+ }
+ }
+
+ /**
+ * Adds a light gray or etched border to the top or bottom of a JComponent.
+ *
+ * @author David Withers
+ * @param component
+ */
+ protected void addDivider(JComponent component, final int position, final boolean etched) {
+ component.setBorder(new Border() {
+ private final Color borderColor = new Color(.6f, .6f, .6f);
+
+ public Insets getBorderInsets(Component c) {
+ if (position == SwingConstants.TOP) {
+ return new Insets(5, 0, 0, 0);
+ } else {
+ return new Insets(0, 0, 5, 0);
+ }
+ }
+
+ public boolean isBorderOpaque() {
+ return false;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ if (position == SwingConstants.TOP) {
+ if (etched) {
+ g.setColor(borderColor);
+ g.drawLine(x, y, x + width, y);
+ g.setColor(Color.WHITE);
+ g.drawLine(x, y + 1, x + width, y + 1);
+ } else {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(x, y, x + width, y);
+ }
+ } else {
+ if (etched) {
+ g.setColor(borderColor);
+ g.drawLine(x, y + height - 2, x + width, y + height - 2);
+ g.setColor(Color.WHITE);
+ g.drawLine(x, y + height - 1, x + width, y + height - 1);
+ } else {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(x, y + height - 1, x + width, y + height - 1);
+ }
+ }
+ }
+
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityContextualView.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityContextualView.java
new file mode 100644
index 0000000..3e26d4c
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityContextualView.java
@@ -0,0 +1,107 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import org.apache.taverna.activities.wsdl.actions.WSDLActivityConfigureAction;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+@SuppressWarnings("serial")
+public class WSDLActivityContextualView extends AbstractXMLSplitterActionView {
+
+ private final ActivityIconManager activityIconManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private final CredentialManager credentialManager;
+ private final FileManager fileManager;
+
+ public WSDLActivityContextualView(Activity activity, EditManager editManager, FileManager fileManager,
+ SelectionManager selectionManager, ActivityIconManager activityIconManager,
+ ColourManager colourManager, CredentialManager credentialManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ super(activity, editManager, selectionManager, colourManager);
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.credentialManager = credentialManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ /**
+ * Gets the component from the {@link HTMLBasedActivityContextualView} and adds buttons to it
+ * allowing XML splitters to be added
+ */
+ @Override
+ public JComponent getMainFrame() {
+ final JComponent mainFrame = super.getMainFrame();
+ JPanel flowPanel = new JPanel(new FlowLayout());
+
+ addInputSplitter(mainFrame, flowPanel);
+ addOutputSplitter(mainFrame, flowPanel);
+
+ mainFrame.add(flowPanel, BorderLayout.SOUTH);
+ return mainFrame;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "WSDL-based service";
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ JsonNode operation = getConfigBean().getJson().get("operation");
+ String summary = "<tr><td>WSDL</td><td>" + operation.get("wsdl").textValue();
+ summary += "</td></tr><tr><td>Operation</td><td>" + operation.get("name").textValue()
+ + "</td></tr>";
+ boolean securityConfigured = getConfigBean().getJson().has("securityProfile");
+ summary += "<tr><td>Secure</td><td>" + securityConfigured + "</td></tr>";
+ summary += "</tr>";
+ summary += describePorts();
+ return summary;
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new WSDLActivityConfigureAction(getActivity(), owner, editManager, fileManager,
+ activityIconManager, serviceDescriptionRegistry, credentialManager);
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityViewFactory.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityViewFactory.java
new file mode 100644
index 0000000..9ec1966
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/WSDLActivityViewFactory.java
@@ -0,0 +1,87 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class WSDLActivityViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private SelectionManager selectionManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private CredentialManager credentialManager;
+ private FileManager fileManager;
+
+ public boolean canHandle(Object object) {
+ return object instanceof Activity
+ && ((Activity) object).getType().equals(WSDLServiceDescription.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays
+ .asList(new ContextualView[] { new WSDLActivityContextualView(activity,
+ editManager, fileManager, selectionManager, activityIconManager, colourManager,
+ credentialManager, serviceDescriptionRegistry) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setCredentialManager(CredentialManager credentialManager) {
+ this.credentialManager = credentialManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterContextualView.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterContextualView.java
new file mode 100644
index 0000000..a6a9877
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterContextualView.java
@@ -0,0 +1,77 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class XMLSplitterContextualView extends AbstractXMLSplitterActionView {
+
+ public XMLSplitterContextualView(Activity activity,
+ EditManager editManager, SelectionManager selectionManager, ColourManager colourManager) {
+ super(activity, editManager, selectionManager, colourManager);
+ }
+
+ static Logger logger = Logger.getLogger(XMLSplitterContextualView.class);
+
+ /**
+ * Gets the component from the {@link HTMLBasedActivityContextualView} and adds buttons to it
+ * allowing XML splitters to be added
+ */
+ @Override
+ public JComponent getMainFrame() {
+ final JComponent mainFrame = super.getMainFrame();
+ JPanel flowPanel = new JPanel(new FlowLayout());
+
+ addInputSplitter(mainFrame, flowPanel);
+ addOutputSplitter(mainFrame, flowPanel);
+ mainFrame.add(flowPanel, BorderLayout.SOUTH);
+ return mainFrame;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "XML splitter";
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ return describePorts();
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterViewFactory.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterViewFactory.java
new file mode 100644
index 0000000..9453254
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/views/XMLSplitterViewFactory.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class XMLSplitterViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+ private ColourManager colourManager;
+
+ public boolean canHandle(Object object) {
+
+ return object instanceof Activity
+ && (((Activity) object).getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)
+ || ((Activity) object).getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE));
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays.asList(new ContextualView[] { new XMLSplitterContextualView(activity,
+ editManager, selectionManager, colourManager) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index 3bf8341..0000000
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 7b0e040..0000000
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,5 +0,0 @@
-net.sf.taverna.t2.activities.wsdl.menu.AddXMLInputSplitterForWSDLActivityMenuAction
-net.sf.taverna.t2.activities.wsdl.menu.AddXMLInputSplitterForXMLInputSplitterMenuAction
-net.sf.taverna.t2.activities.wsdl.menu.AddXMLOutputSplitterForWSDLActivityMenuAction
-net.sf.taverna.t2.activities.wsdl.menu.AddXMLOutputSplitterForXMLOutputSplitterMenuAction
-net.sf.taverna.t2.activities.wsdl.menu.ConfigureWSDLMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 17d19e3..0000000
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLActivityIcon
-net.sf.taverna.t2.activities.wsdl.servicedescriptions.XMLInputSplitterActivityIcon
-net.sf.taverna.t2.activities.wsdl.servicedescriptions.XMLOutputSplitterActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 04d48eb..0000000
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.activities.wsdl.views.WSDLActivityViewFactory
-net.sf.taverna.t2.activities.wsdl.views.XMLSplitterViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..c25d541
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..15f6441
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,5 @@
+org.apache.taverna.activities.wsdl.menu.AddXMLInputSplitterForWSDLActivityMenuAction
+org.apache.taverna.activities.wsdl.menu.AddXMLInputSplitterForXMLInputSplitterMenuAction
+org.apache.taverna.activities.wsdl.menu.AddXMLOutputSplitterForWSDLActivityMenuAction
+org.apache.taverna.activities.wsdl.menu.AddXMLOutputSplitterForXMLOutputSplitterMenuAction
+org.apache.taverna.activities.wsdl.menu.ConfigureWSDLMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..0f3274f
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1,3 @@
+org.apache.taverna.activities.wsdl.servicedescriptions.WSDLActivityIcon
+org.apache.taverna.activities.wsdl.servicedescriptions.XMLInputSplitterActivityIcon
+org.apache.taverna.activities.wsdl.servicedescriptions.XMLOutputSplitterActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..bcc7d37
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1,2 @@
+org.apache.taverna.activities.wsdl.views.WSDLActivityViewFactory
+org.apache.taverna.activities.wsdl.views.XMLSplitterViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context-osgi.xml b/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context-osgi.xml
index ac79064..beb6b73 100644
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context-osgi.xml
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context-osgi.xml
@@ -6,14 +6,14 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="WSDLActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
- <service ref="XMLInputSplitterActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
- <service ref="XMLOutputSplitterActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="WSDLActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
+ <service ref="XMLInputSplitterActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
+ <service ref="XMLOutputSplitterActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
<service ref="WSDLServiceProvider">
<interfaces>
- <beans:value>net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider</beans:value>
- <beans:value>net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider</beans:value>
+ <beans:value>org.apache.taverna.servicedescriptions.ServiceDescriptionProvider</beans:value>
+ <beans:value>org.apache.taverna.servicedescriptions.ConfigurableServiceProvider</beans:value>
</interfaces>
</service>
@@ -23,15 +23,15 @@
<service ref="AddXMLOutputSplitterForXMLOutputSplitterMenuAction" auto-export="interfaces" />
<service ref="ConfigureWSDLMenuAction" auto-export="interfaces" />
- <service ref="WSDLActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <service ref="XMLSplitterViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="WSDLActivityViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="XMLSplitterViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
- <reference id="credentialManager" interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="credentialManager" interface="org.apache.taverna.security.credentialmanager.CredentialManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context.xml b/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context.xml
index fede275..013fdf1 100644
--- a/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context.xml
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/spring/wsdl-activity-ui-context.xml
@@ -3,32 +3,32 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="WSDLActivityIcon" class="net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLActivityIcon" />
- <bean id="XMLInputSplitterActivityIcon" class="net.sf.taverna.t2.activities.wsdl.servicedescriptions.XMLInputSplitterActivityIcon" />
- <bean id="XMLOutputSplitterActivityIcon" class="net.sf.taverna.t2.activities.wsdl.servicedescriptions.XMLOutputSplitterActivityIcon" />
+ <bean id="WSDLActivityIcon" class="org.apache.taverna.activities.wsdl.servicedescriptions.WSDLActivityIcon" />
+ <bean id="XMLInputSplitterActivityIcon" class="org.apache.taverna.activities.wsdl.servicedescriptions.XMLInputSplitterActivityIcon" />
+ <bean id="XMLOutputSplitterActivityIcon" class="org.apache.taverna.activities.wsdl.servicedescriptions.XMLOutputSplitterActivityIcon" />
- <bean id="WSDLServiceProvider" class="net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceProvider">
+ <bean id="WSDLServiceProvider" class="org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceProvider">
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="credentialManager" ref="credentialManager" />
</bean>
- <bean id="AddXMLInputSplitterForWSDLActivityMenuAction" class="net.sf.taverna.t2.activities.wsdl.menu.AddXMLInputSplitterForWSDLActivityMenuAction">
+ <bean id="AddXMLInputSplitterForWSDLActivityMenuAction" class="org.apache.taverna.activities.wsdl.menu.AddXMLInputSplitterForWSDLActivityMenuAction">
<property name="editManager" ref="editManager" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="AddXMLInputSplitterForXMLInputSplitterMenuAction" class="net.sf.taverna.t2.activities.wsdl.menu.AddXMLInputSplitterForXMLInputSplitterMenuAction">
+ <bean id="AddXMLInputSplitterForXMLInputSplitterMenuAction" class="org.apache.taverna.activities.wsdl.menu.AddXMLInputSplitterForXMLInputSplitterMenuAction">
<property name="editManager" ref="editManager" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="AddXMLOutputSplitterForWSDLActivityMenuAction" class="net.sf.taverna.t2.activities.wsdl.menu.AddXMLOutputSplitterForWSDLActivityMenuAction">
+ <bean id="AddXMLOutputSplitterForWSDLActivityMenuAction" class="org.apache.taverna.activities.wsdl.menu.AddXMLOutputSplitterForWSDLActivityMenuAction">
<property name="editManager" ref="editManager" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="AddXMLOutputSplitterForXMLOutputSplitterMenuAction" class="net.sf.taverna.t2.activities.wsdl.menu.AddXMLOutputSplitterForXMLOutputSplitterMenuAction">
+ <bean id="AddXMLOutputSplitterForXMLOutputSplitterMenuAction" class="org.apache.taverna.activities.wsdl.menu.AddXMLOutputSplitterForXMLOutputSplitterMenuAction">
<property name="editManager" ref="editManager" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="ConfigureWSDLMenuAction" class="net.sf.taverna.t2.activities.wsdl.menu.ConfigureWSDLMenuAction">
+ <bean id="ConfigureWSDLMenuAction" class="org.apache.taverna.activities.wsdl.menu.ConfigureWSDLMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -36,7 +36,7 @@
<property name="credentialManager" ref="credentialManager" />
</bean>
- <bean id="WSDLActivityViewFactory" class="net.sf.taverna.t2.activities.wsdl.views.WSDLActivityViewFactory">
+ <bean id="WSDLActivityViewFactory" class="org.apache.taverna.activities.wsdl.views.WSDLActivityViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -44,7 +44,7 @@
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="credentialManager" ref="credentialManager" />
</bean>
- <bean id="XMLSplitterViewFactory" class="net.sf.taverna.t2.activities.wsdl.views.XMLSplitterViewFactory">
+ <bean id="XMLSplitterViewFactory" class="org.apache.taverna.activities.wsdl.views.XMLSplitterViewFactory">
<property name="editManager" ref="editManager" />
<property name="selectionManager" ref="selectionManager" />
<property name="colourManager" ref="colourManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/test/java/net/sf/taverna/t2/activities/wsdl/views/TestWSDLActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/test/java/net/sf/taverna/t2/activities/wsdl/views/TestWSDLActivityContextualView.java b/taverna-wsdl-activity-ui/src/test/java/net/sf/taverna/t2/activities/wsdl/views/TestWSDLActivityContextualView.java
deleted file mode 100644
index 0fa054b..0000000
--- a/taverna-wsdl-activity-ui/src/test/java/net/sf/taverna/t2/activities/wsdl/views/TestWSDLActivityContextualView.java
+++ /dev/null
@@ -1,53 +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.wsdl.views;
-
-import static org.junit.Assert.assertNull;
-
-import org.junit.Before;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class TestWSDLActivityContextualView {
-
- Activity a;
-
- @Before
- public void setUp() throws Exception {
- a=new Activity();
- Configuration configuration = new Configuration();
- ObjectNode json = (ObjectNode) configuration.getJson();
- ObjectNode operation = json.objectNode();
- operation.put("name", "getReport");
- json.set("operation", operation);
- String wsdlUrl=TestWSDLActivityContextualView.class.getResource("/GMService.wsdl").toExternalForm();
- operation.put("wsdl", wsdlUrl);
- configuration.setConfigures(a);
- }
-
- public void testConfigurationAction() {
- WSDLActivityContextualView view = new WSDLActivityContextualView(a, null, null, null, null, null, null, null);
- assertNull("WSDL has no configure action, so should be null",view.getConfigureAction(null));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/test/java/org/apache/taverna/activities/wsdl/views/TestWSDLActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/test/java/org/apache/taverna/activities/wsdl/views/TestWSDLActivityContextualView.java b/taverna-wsdl-activity-ui/src/test/java/org/apache/taverna/activities/wsdl/views/TestWSDLActivityContextualView.java
new file mode 100644
index 0000000..4ca3d72
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/test/java/org/apache/taverna/activities/wsdl/views/TestWSDLActivityContextualView.java
@@ -0,0 +1,52 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.views;
+
+import static org.junit.Assert.assertNull;
+
+import org.junit.Before;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class TestWSDLActivityContextualView {
+
+ Activity a;
+
+ @Before
+ public void setUp() throws Exception {
+ a=new Activity();
+ Configuration configuration = new Configuration();
+ ObjectNode json = (ObjectNode) configuration.getJson();
+ ObjectNode operation = json.objectNode();
+ operation.put("name", "getReport");
+ json.set("operation", operation);
+ String wsdlUrl=TestWSDLActivityContextualView.class.getResource("/GMService.wsdl").toExternalForm();
+ operation.put("wsdl", wsdlUrl);
+ configuration.setConfigures(a);
+ }
+
+ public void testConfigurationAction() {
+ WSDLActivityContextualView view = new WSDLActivityContextualView(a, null, null, null, null, null, null, null);
+ assertNull("WSDL has no configure action, so should be null",view.getConfigureAction(null));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/TwoFieldQueryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/TwoFieldQueryPanel.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/TwoFieldQueryPanel.java
deleted file mode 100644
index d0f131a..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/TwoFieldQueryPanel.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-
-import javax.swing.BorderFactory;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-/**
- * Auxiliary class that creates a JPanel with two labels and two text fields.
- *
- * It can be used to be placed into a dialog made by JOptionPane to get two
- * input values, not just one.
- *
- * @author Sergejs Aleksejevs
- */
-public class TwoFieldQueryPanel extends JPanel {
- private JTextField tfFirstValue;
- private JTextField tfSecondValue;
-
- public TwoFieldQueryPanel(String firstFieldName, String secondFieldName) {
- this(null, firstFieldName, null, secondFieldName, null);
- }
-
- public TwoFieldQueryPanel(String message, String firstFieldName,
- String secondFieldName) {
- this(message, firstFieldName, null, secondFieldName, null);
- }
-
- public TwoFieldQueryPanel(String firstFieldName,
- String firstFieldDefaultValue, String secondFieldName,
- String secondFieldDefaultValue) {
- this(null, firstFieldName, firstFieldDefaultValue, secondFieldName,
- secondFieldDefaultValue);
- }
-
- public TwoFieldQueryPanel(String message, String firstFieldName,
- String firstFieldDefaultValue, String secondFieldName,
- String secondFieldDefaultValue) {
- super();
- this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 0;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(3, 5, 3, 5);
-
- if (message != null && message.length() > 0) {
- c.gridwidth = 2;
- c.insets = new Insets(5, 5, 15, 5);
- this.add(new JLabel(message), c);
-
- c.gridwidth = 1;
- c.gridx = 0;
- c.gridy++;
- c.insets = new Insets(3, 5, 3, 5);
- }
-
- this.add(new JLabel(firstFieldName), c);
-
- c.gridx++;
- c.weightx = 1.0;
- tfFirstValue = new JTextField(20);
- if (firstFieldDefaultValue != null) {
- tfFirstValue.setText(firstFieldDefaultValue);
- }
- tfFirstValue.selectAll();
- tfFirstValue.requestFocusInWindow();
- this.add(tfFirstValue, c);
-
- c.gridx = 0;
- c.gridy++;
- c.weightx = 0;
- this.add(new JLabel(secondFieldName), c);
-
- c.gridx++;
- c.weightx = 1.0;
- tfSecondValue = new JTextField(20);
- if (secondFieldDefaultValue != null) {
- tfSecondValue.setText(secondFieldDefaultValue);
- }
- tfSecondValue.selectAll();
- this.add(tfSecondValue, c);
- }
-
- /**
- * @return Trimmed value from the first text field. Guaranteed to be
- * non-null.
- */
- public String getFirstValue() {
- return (tfFirstValue.getText().trim());
- }
-
- /**
- * @return Trimmed value from the second text field. Guaranteed to be
- * non-null.
- */
- public String getSecondValue() {
- return (tfSecondValue.getText().trim());
- }
-
-}
[23/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/commit/163747de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/tree/163747de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/diff/163747de
Branch: refs/heads/master
Commit: 163747de9d4a22b06511164afa748a0ebaf4c3b2
Parents: 9e37ea3
Author: Dmitry Repchevsky <re...@list.ru>
Authored: Fri Mar 27 17:21:40 2015 +0100
Committer: Dmitry Repchevsky <re...@list.ru>
Committed: Fri Mar 27 17:21:40 2015 +0100
----------------------------------------------------------------------
.gitignore | 4 +-
.../BeanshellActivityConfigurationAction.java | 71 --
.../menu/AddBeanshellTemplateAction.java | 113 --
.../menu/AddBeanshellTemplateMenuAction.java | 121 --
.../menu/ConfigureBeanshellMenuAction.java | 67 -
.../BeanshellActivityIcon.java | 58 -
.../BeanshellTemplateService.java | 63 -
.../views/BeanshellActivityViewFactory.java | 84 --
.../views/BeanshellConfigurationPanel.java | 231 ----
.../views/BeanshellContextualView.java | 104 --
.../BeanshellActivityConfigurationAction.java | 70 +
.../menu/AddBeanshellTemplateAction.java | 112 ++
.../menu/AddBeanshellTemplateMenuAction.java | 120 ++
.../menu/ConfigureBeanshellMenuAction.java | 86 ++
.../BeanshellActivityIcon.java | 57 +
.../BeanshellTemplateService.java | 82 ++
.../views/BeanshellActivityViewFactory.java | 83 ++
.../views/BeanshellConfigurationPanel.java | 230 ++++
.../views/BeanshellContextualView.java | 103 ++
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 3 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 3 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
.../beanshell-activity-ui-context-osgi.xml | 20 +-
.../spring/beanshell-activity-ui-context.xml | 12 +-
.../t2/activities/beanshell/views/keys.txt | 90 --
.../taverna/activities/beanshell/views/keys.txt | 90 ++
taverna-external-tool-activity-ui/pom.xml | 18 +
.../ExternalToolActivityConfigureAction.java | 83 --
.../ToolInvocationConfiguration.java | 57 -
.../externaltool/manager/GroupPanel.java | 113 --
.../InvocationGroupManagerShutdownHook.java | 34 -
.../InvocationGroupManagerStartupHook.java | 47 -
.../manager/InvocationMechanismEditor.java | 28 -
.../externaltool/manager/MechanismPanel.java | 121 --
.../ToolInvocationConfigurationPanel.java | 379 ------
.../ToolInvocationConfigurationUIFactory.java | 54 -
.../local/LocalInvocationMechanismEditor.java | 122 --
.../manager/ssh/ExternalToolSshNodeViewer.java | 110 --
.../ssh/SshInvocationMechanismEditor.java | 234 ----
.../AddExternalToolContextualMenuAction.java | 110 --
.../menu/AddExternalToolMenuAction.java | 111 --
.../menu/ConfigureExternalToolMenuAction.java | 69 -
.../externaltool/menu/FeedbackMenuAction.java | 82 --
.../AddExternalToolServiceDialog.java | 189 ---
.../ExternalToolActivityIcon.java | 73 --
.../ExternalToolServiceDescription.java | 147 ---
.../ExternalToolServiceProvider.java | 132 --
.../ExternalToolServiceProviderConfig.java | 56 -
.../ExternalToolTemplateServiceDescription.java | 77 --
.../t2/activities/externaltool/utils/Tools.java | 129 --
.../externaltool/views/AnnotationPanel.java | 41 -
.../externaltool/views/EditablePanel.java | 76 --
.../ExternalToolActivityContextualView.java | 181 ---
.../views/ExternalToolActivityViewFactory.java | 76 --
.../views/ExternalToolConfigView.java | 868 -------------
.../views/ExternalToolFileViewer.java | 103 --
.../ExternalToolRuntimeEnvironmentViewer.java | 56 -
.../views/ExternalToolStaticStringViewer.java | 53 -
.../views/ExternalToolStaticUrlViewer.java | 56 -
.../ExternalToolStringReplacementViewer.java | 97 --
.../externaltool/views/FilePanel.java | 119 --
.../externaltool/views/InvocationPanel.java | 396 ------
.../views/LoadDescriptionAction.java | 89 --
.../views/SaveDescriptionAction.java | 124 --
.../externaltool/views/ScriptPanel.java | 148 ---
.../externaltool/views/StaticStringPanel.java | 106 --
.../externaltool/views/StaticUrlPanel.java | 108 --
.../views/StringReplacementPanel.java | 134 --
.../externaltool/views/ToolXMLPanel.java | 33 -
.../ExternalToolActivityConfigureAction.java | 83 ++
.../ToolInvocationConfiguration.java | 57 +
.../externaltool/manager/GroupPanel.java | 115 ++
.../InvocationGroupManagerShutdownHook.java | 34 +
.../InvocationGroupManagerStartupHook.java | 47 +
.../manager/InvocationMechanismEditor.java | 28 +
.../externaltool/manager/MechanismPanel.java | 121 ++
.../ToolInvocationConfigurationPanel.java | 383 ++++++
.../ToolInvocationConfigurationUIFactory.java | 55 +
.../local/LocalInvocationMechanismEditor.java | 122 ++
.../manager/ssh/ExternalToolSshNodeViewer.java | 110 ++
.../ssh/SshInvocationMechanismEditor.java | 234 ++++
.../AddExternalToolContextualMenuAction.java | 110 ++
.../menu/AddExternalToolMenuAction.java | 111 ++
.../menu/ConfigureExternalToolMenuAction.java | 69 +
.../externaltool/menu/FeedbackMenuAction.java | 82 ++
.../AddExternalToolServiceDialog.java | 189 +++
.../ExternalToolActivityIcon.java | 73 ++
.../ExternalToolServiceDescription.java | 147 +++
.../ExternalToolServiceProvider.java | 132 ++
.../ExternalToolServiceProviderConfig.java | 56 +
.../ExternalToolTemplateServiceDescription.java | 77 ++
.../activities/externaltool/utils/Tools.java | 129 ++
.../externaltool/views/AnnotationPanel.java | 41 +
.../externaltool/views/EditablePanel.java | 72 ++
.../ExternalToolActivityContextualView.java | 181 +++
.../views/ExternalToolActivityViewFactory.java | 76 ++
.../views/ExternalToolConfigView.java | 868 +++++++++++++
.../views/ExternalToolFileViewer.java | 103 ++
.../ExternalToolRuntimeEnvironmentViewer.java | 56 +
.../views/ExternalToolStaticStringViewer.java | 53 +
.../views/ExternalToolStaticUrlViewer.java | 56 +
.../ExternalToolStringReplacementViewer.java | 97 ++
.../externaltool/views/FilePanel.java | 119 ++
.../externaltool/views/InvocationPanel.java | 394 ++++++
.../views/LoadDescriptionAction.java | 89 ++
.../views/SaveDescriptionAction.java | 124 ++
.../externaltool/views/ScriptPanel.java | 148 +++
.../externaltool/views/StaticStringPanel.java | 104 ++
.../externaltool/views/StaticUrlPanel.java | 106 ++
.../views/StringReplacementPanel.java | 130 ++
.../externaltool/views/ToolXMLPanel.java | 33 +
...ternaltool.manager.InvocationMechanismEditor | 2 -
...rvicedescriptions.ServiceDescriptionProvider | 2 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 4 -
.../net.sf.taverna.t2.workbench.ShutdownSPI | 1 -
.../net.sf.taverna.t2.workbench.StartupSPI | 1 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...rkbench.configuration.ConfigurationUIFactory | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...ternaltool.manager.InvocationMechanismEditor | 2 +
...rvicedescriptions.ServiceDescriptionProvider | 2 +
.../org.apache.taverna.ui.menu.MenuComponent | 4 +
.../org.apache.taverna.workbench.ShutdownSPI | 1 +
.../org.apache.taverna.workbench.StartupSPI | 1 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...rkbench.configuration.ConfigurationUIFactory | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
.../external-tool-activity-ui-context-osgi.xml | 32 +-
.../external-tool-activity-ui-context.xml | 24 +-
.../LocalworkerActivityConfigurationAction.java | 117 --
.../menu/ConfigureLocalworkerMenuAction.java | 62 -
.../LocalworkerActivityIcon.java | 58 -
.../LocalworkerServiceDescription.java | 105 --
.../LocalworkerServiceProvider.java | 302 -----
.../views/LocalworkerActivityConfigView.java | 42 -
.../LocalworkerActivityContextualView.java | 115 --
.../views/LocalworkerActivityViewFactory.java | 82 --
.../LocalworkerActivityConfigurationAction.java | 117 ++
.../menu/ConfigureLocalworkerMenuAction.java | 62 +
.../LocalworkerActivityIcon.java | 58 +
.../LocalworkerServiceDescription.java | 105 ++
.../LocalworkerServiceProvider.java | 302 +++++
.../views/LocalworkerActivityConfigView.java | 42 +
.../LocalworkerActivityContextualView.java | 115 ++
.../views/LocalworkerActivityViewFactory.java | 82 ++
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 1 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 1 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
.../localworker-activity-ui-context-osgi.xml | 16 +-
.../spring/localworker-activity-ui-context.xml | 8 +-
...rna.scuflworkers.biojava.GenBankParserWorker | 12 +-
...verna.scuflworkers.biojava.ReverseCompWorker | 12 +-
...a.scuflworkers.biojava.SwissProtParserWorker | 12 +-
...averna.scuflworkers.biojava.TranscribeWorker | 12 +-
...na.scuflworkers.io.ConcatenateFileListWorker | 20 +-
...ge.taverna.scuflworkers.io.EnvVariableWorker | 8 +-
...ge.taverna.scuflworkers.io.FileListByExtTask | 16 +-
....taverna.scuflworkers.io.FileListByRegexTask | 16 +-
...ceforge.taverna.scuflworkers.io.LocalCommand | 16 +-
...forge.taverna.scuflworkers.io.TextFileReader | 16 +-
...forge.taverna.scuflworkers.io.TextFileWriter | 20 +-
...rge.taverna.scuflworkers.jdbc.SQLQueryWorker | 40 +-
...ge.taverna.scuflworkers.jdbc.SQLUpdateWorker | 32 +-
...erna.scuflworkers.ncbi.NucleotideFastaWorker | 12 +-
...erna.scuflworkers.ncbi.NucleotideGBSeqWorker | 12 +-
...scuflworkers.ncbi.NucleotideINSDSeqXMLWorker | 12 +-
...scuflworkers.ncbi.NucleotideTinySeqXMLWorker | 12 +-
...taverna.scuflworkers.ncbi.ProteinFastaWorker | 12 +-
...taverna.scuflworkers.ncbi.ProteinGBSeqWorker | 12 +-
...na.scuflworkers.ncbi.ProteinINSDSeqXMLWorker | 12 +-
...na.scuflworkers.ncbi.ProteinTinySeqXMLWorker | 12 +-
...taverna.scuflworkers.ncbi.PubMedEFetchWorker | 20 +-
...averna.scuflworkers.ncbi.PubMedESearchWorker | 40 +-
...urceforge.taverna.scuflworkers.net.BrowseUrl | 8 +-
...forge.taverna.scuflworkers.net.ExtractHeader | 16 +-
...ourceforge.taverna.scuflworkers.ui.AskWorker | 16 +-
...ceforge.taverna.scuflworkers.ui.ChooseWorker | 20 +-
...rge.taverna.scuflworkers.ui.SelectFileWorker | 20 +-
...ceforge.taverna.scuflworkers.ui.SelectWorker | 20 +-
...urceforge.taverna.scuflworkers.ui.TellWorker | 16 +-
...urceforge.taverna.scuflworkers.ui.WarnWorker | 16 +-
...rge.taverna.scuflworkers.xml.XPathTextWorker | 20 +-
...rceforge.taverna.scuflworkers.xml.XSLTWorker | 24 +-
...na.scuflworkers.xml.XSLTWorkerWithParameters | 22 +-
...escience.scuflworkers.java.ByteArrayToString | 16 +-
....ebi.escience.scuflworkers.java.DecodeBase64 | 12 +-
...embl.ebi.escience.scuflworkers.java.EchoList | 12 +-
...escience.scuflworkers.java.EmitLotsOfStrings | 8 +-
....ebi.escience.scuflworkers.java.EncodeBase64 | 12 +-
...escience.scuflworkers.java.ExtractImageLinks | 12 +-
....escience.scuflworkers.java.FilterStringList | 16 +-
...l.ebi.escience.scuflworkers.java.FlattenList | 12 +-
...mbl.ebi.escience.scuflworkers.java.PadNumber | 16 +-
...cuflworkers.java.RegularExpressionStringList | 20 +-
...mbl.ebi.escience.scuflworkers.java.SendEmail | 24 +-
....ebi.escience.scuflworkers.java.SplitByRegex | 16 +-
....ebi.escience.scuflworkers.java.StringConcat | 16 +-
...i.escience.scuflworkers.java.StringListMerge | 16 +-
...cience.scuflworkers.java.StringSetDifference | 16 +-
...ence.scuflworkers.java.StringSetIntersection | 16 +-
...bi.escience.scuflworkers.java.StringSetUnion | 16 +-
...ence.scuflworkers.java.StringStripDuplicates | 12 +-
...scuflworkers.java.TestAlwaysFailingProcessor | 16 +-
...science.scuflworkers.java.TestSometimesFails | 12 +-
...i.escience.scuflworkers.java.WebImageFetcher | 16 +-
...bi.escience.scuflworkers.java.WebPageFetcher | 16 +-
taverna-rest-activity-ui/pom.xml | 10 +-
.../rest/ui/config/HTTPHeadersTableModel.java | 119 --
.../config/RESTActivityConfigurationPanel.java | 670 ----------
.../ui/config/RESTActivityConfigureAction.java | 51 -
.../rest/ui/menu/AddRESTTemplateAction.java | 107 --
.../rest/ui/menu/AddRESTTemplateMenuAction.java | 114 --
.../GenericRESTTemplateService.java | 82 --
.../ui/servicedescription/RESTActivityIcon.java | 54 -
.../serviceprovider/ExampleServiceDesc.java.bak | 99 --
.../ExampleServiceProvider.java.bak | 106 --
.../ExampleServiceProviderConfig.java.bak | 31 -
.../view/ConfigureRESTActivityMenuAction.java | 66 -
.../RESTActivityMainContextViewFactory.java | 62 -
.../ui/view/RESTActivityMainContextualView.java | 220 ----
.../rest/ui/config/HTTPHeadersTableModel.java | 138 ++
.../config/RESTActivityConfigurationPanel.java | 689 ++++++++++
.../ui/config/RESTActivityConfigureAction.java | 70 +
.../rest/ui/menu/AddRESTTemplateAction.java | 106 ++
.../rest/ui/menu/AddRESTTemplateMenuAction.java | 113 ++
.../GenericRESTTemplateService.java | 101 ++
.../ui/servicedescription/RESTActivityIcon.java | 73 ++
.../serviceprovider/ExampleServiceDesc.java.bak | 99 ++
.../ExampleServiceProvider.java.bak | 106 ++
.../ExampleServiceProviderConfig.java.bak | 31 +
.../view/ConfigureRESTActivityMenuAction.java | 85 ++
.../RESTActivityMainContextViewFactory.java | 81 ++
.../ui/view/RESTActivityMainContextualView.java | 239 ++++
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 3 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 3 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
.../spring/rest-activity-ui-context-osgi.xml | 20 +-
.../spring/rest-activity-ui-context.xml | 12 +-
.../activities/rest/ui/config/information.png | Bin 778 -> 0 bytes
.../t2/activities/rest/ui/config/mediatypes.txt | 65 -
.../ui/servicedescription/service_type_rest.png | Bin 1137 -> 0 bytes
.../activities/rest/ui/config/information.png | Bin 0 -> 778 bytes
.../activities/rest/ui/config/mediatypes.txt | 65 +
.../ui/servicedescription/service_type_rest.png | Bin 0 -> 1137 bytes
...dsheetImportActivityConfigurationAction.java | 72 --
.../il8n/SpreadsheetImportUIText.java | 46 -
.../SpreadsheetImportAddTemplateAction.java | 110 --
.../SpreadsheetImportAddTemplateMenuAction.java | 124 --
.../SpreadsheetImportConfigureMenuAction.java | 84 --
.../SpreadsheetImportActivityIcon.java | 71 --
.../SpreadsheetImportTemplateService.java | 101 --
.../SpreadsheetImportConfigTableModel.java | 190 ---
.../views/SpreadsheetImportConfigView.java | 1082 ----------------
.../views/SpreadsheetImportContextualView.java | 121 --
.../SpreadsheetImportContextualViewFactory.java | 87 --
...dsheetImportActivityConfigurationAction.java | 71 ++
.../il8n/SpreadsheetImportUIText.java | 45 +
.../SpreadsheetImportAddTemplateAction.java | 109 ++
.../SpreadsheetImportAddTemplateMenuAction.java | 123 ++
.../SpreadsheetImportConfigureMenuAction.java | 83 ++
.../SpreadsheetImportActivityIcon.java | 70 +
.../SpreadsheetImportTemplateService.java | 100 ++
.../SpreadsheetImportConfigTableModel.java | 188 +++
.../views/SpreadsheetImportConfigView.java | 1081 ++++++++++++++++
.../views/SpreadsheetImportContextualView.java | 120 ++
.../SpreadsheetImportContextualViewFactory.java | 86 ++
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 3 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 3 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
...eadsheet-import-activity-ui-context-osgi.xml | 20 +-
.../spreadsheet-import-activity-ui-context.xml | 12 +-
.../spreadsheet/iln8/ui-text.properties | 43 -
.../spreadsheet/iln8/ui-text.properties | 43 +
taverna-wsdl-activity-ui/pom.xml | 185 ++-
.../actions/AbstractAddXMLSplitterAction.java | 156 ---
.../wsdl/actions/AddXMLInputSplitterAction.java | 104 --
.../actions/AddXMLOutputSplitterAction.java | 105 --
.../wsdl/actions/AddXMLSplitterEdit.java | 315 -----
.../actions/WSDLActivityConfigureAction.java | 71 --
.../wsdl/actions/XMLSplitterPortBuilder.java | 127 --
...LInputSplitterForWSDLActivityMenuAction.java | 11 -
...utSplitterForXMLInputSplitterMenuAction.java | 11 -
.../menu/AddXMLInputSplitterMenuAction.java | 70 -
...OutputSplitterForWSDLActivityMenuAction.java | 11 -
...tSplitterForXMLOutputSplitterMenuAction.java | 11 -
.../menu/AddXMLOutputSplitterMenuAction.java | 66 -
.../wsdl/menu/ConfigureWSDLMenuAction.java | 78 --
.../AddWSDLServiceDialog.java | 303 -----
.../ConfirmTrustedCertificateDialog.java | 586 ---------
.../servicedescriptions/WSDLActivityIcon.java | 60 -
.../WSDLServiceDescription.java | 154 ---
.../WSDLServiceProvider.java | 206 ---
.../WSDLServiceProviderConfig.java | 32 -
.../XMLInputSplitterActivityIcon.java | 63 -
.../XMLOutputSplitterActivityIcon.java | 64 -
.../views/AbstractXMLSplitterActionView.java | 159 ---
.../views/WSDLActivityConfigurationView.java | 446 -------
.../wsdl/views/WSDLActivityContextualView.java | 108 --
.../wsdl/views/WSDLActivityViewFactory.java | 88 --
.../wsdl/views/XMLSplitterContextualView.java | 78 --
.../wsdl/views/XMLSplitterViewFactory.java | 66 -
.../actions/AbstractAddXMLSplitterAction.java | 155 +++
.../wsdl/actions/AddXMLInputSplitterAction.java | 102 ++
.../actions/AddXMLOutputSplitterAction.java | 103 ++
.../wsdl/actions/AddXMLSplitterEdit.java | 314 +++++
.../actions/WSDLActivityConfigureAction.java | 70 +
.../wsdl/actions/XMLSplitterPortBuilder.java | 126 ++
...LInputSplitterForWSDLActivityMenuAction.java | 30 +
...utSplitterForXMLInputSplitterMenuAction.java | 30 +
.../menu/AddXMLInputSplitterMenuAction.java | 85 ++
...OutputSplitterForWSDLActivityMenuAction.java | 30 +
...tSplitterForXMLOutputSplitterMenuAction.java | 30 +
.../menu/AddXMLOutputSplitterMenuAction.java | 82 ++
.../wsdl/menu/ConfigureWSDLMenuAction.java | 77 ++
.../AddWSDLServiceDialog.java | 302 +++++
.../ConfirmTrustedCertificateDialog.java | 585 +++++++++
.../servicedescriptions/WSDLActivityIcon.java | 59 +
.../WSDLServiceDescription.java | 153 +++
.../WSDLServiceProvider.java | 227 ++++
.../WSDLServiceProviderConfig.java | 51 +
.../XMLInputSplitterActivityIcon.java | 62 +
.../XMLOutputSplitterActivityIcon.java | 63 +
.../views/AbstractXMLSplitterActionView.java | 178 +++
.../views/WSDLActivityConfigurationView.java | 445 +++++++
.../wsdl/views/WSDLActivityContextualView.java | 107 ++
.../wsdl/views/WSDLActivityViewFactory.java | 87 ++
.../wsdl/views/XMLSplitterContextualView.java | 77 ++
.../wsdl/views/XMLSplitterViewFactory.java | 63 +
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 5 -
...a.t2.workbench.activityicons.ActivityIconSPI | 3 -
...ntextualviews.activity.ContextualViewFactory | 2 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 5 +
...erna.workbench.activityicons.ActivityIconSPI | 3 +
...ntextualviews.activity.ContextualViewFactory | 2 +
.../spring/wsdl-activity-ui-context-osgi.xml | 28 +-
.../spring/wsdl-activity-ui-context.xml | 22 +-
.../views/TestWSDLActivityContextualView.java | 53 -
.../views/TestWSDLActivityContextualView.java | 52 +
.../xpath/ui/config/TwoFieldQueryPanel.java | 110 --
.../config/XPathActivityConfigurationPanel.java | 1202 ------------------
...XPathActivityConfigurationPanelProvider.java | 158 ---
.../ui/config/XPathActivityConfigureAction.java | 52 -
.../ui/config/xmltree/TableCellListener.java | 186 ---
.../ui/config/xmltree/XPathActivityXMLTree.java | 572 ---------
.../XPathActivityXMLTreeAttributeNode.java | 50 -
.../XPathActivityXMLTreeElementNode.java | 62 -
.../xmltree/XPathActivityXMLTreeNode.java | 81 --
.../XPathActivityXMLTreeSelectionHandler.java | 251 ----
.../ConfigureXPathActivityMenuAction.java | 65 -
.../XPathActivityMainContextViewFactory.java | 59 -
.../XPathActivityMainContextualView.java | 209 ---
.../xpath/ui/menu/AddXPathTemplateAction.java | 110 --
.../ui/menu/AddXPathTemplateMenuAction.java | 117 --
.../servicedescription/XPathActivityIcon.java | 86 --
.../XPathTemplateService.java | 63 -
.../xpath/ui/config/TwoFieldQueryPanel.java | 110 ++
.../config/XPathActivityConfigurationPanel.java | 1202 ++++++++++++++++++
...XPathActivityConfigurationPanelProvider.java | 158 +++
.../ui/config/XPathActivityConfigureAction.java | 52 +
.../ui/config/xmltree/TableCellListener.java | 186 +++
.../ui/config/xmltree/XPathActivityXMLTree.java | 572 +++++++++
.../XPathActivityXMLTreeAttributeNode.java | 50 +
.../XPathActivityXMLTreeElementNode.java | 62 +
.../xmltree/XPathActivityXMLTreeNode.java | 81 ++
.../XPathActivityXMLTreeSelectionHandler.java | 251 ++++
.../ConfigureXPathActivityMenuAction.java | 65 +
.../XPathActivityMainContextViewFactory.java | 59 +
.../XPathActivityMainContextualView.java | 209 +++
.../xpath/ui/menu/AddXPathTemplateAction.java | 110 ++
.../ui/menu/AddXPathTemplateMenuAction.java | 117 ++
.../servicedescription/XPathActivityIcon.java | 86 ++
.../XPathTemplateService.java | 62 +
...rvicedescriptions.ServiceDescriptionProvider | 1 -
.../net.sf.taverna.t2.ui.menu.MenuComponent | 3 -
...a.t2.workbench.activityicons.ActivityIconSPI | 1 -
...ntextualviews.activity.ContextualViewFactory | 1 -
...rvicedescriptions.ServiceDescriptionProvider | 1 +
.../org.apache.taverna.ui.menu.MenuComponent | 3 +
...erna.workbench.activityicons.ActivityIconSPI | 1 +
...ntextualviews.activity.ContextualViewFactory | 1 +
.../spring/xpath-activity-ui-context-osgi.xml | 20 +-
.../spring/xpath-activity-ui-context.xml | 12 +-
.../xpath/ui/servicedescription/arrow_right.png | Bin 596 -> 0 bytes
.../famfamfam_silk/accept.png | Bin 781 -> 0 bytes
.../famfamfam_silk/exclamation.png | Bin 701 -> 0 bytes
.../servicedescription/famfamfam_silk/help.png | Bin 786 -> 0 bytes
.../famfamfam_silk/page_white_code.png | Bin 603 -> 0 bytes
.../servicedescription/famfamfam_silk/tag.png | Bin 389 -> 0 bytes
.../text_linespacing (collapse).png | Bin 371 -> 0 bytes
.../famfamfam_silk/text_linespacing.png | Bin 363 -> 0 bytes
.../xpath/ui/servicedescription/folds/fold.png | Bin 331 -> 0 bytes
.../ui/servicedescription/folds/unfold.png | Bin 334 -> 0 bytes
.../ui/servicedescription/xpath_attribute.png | Bin 1426 -> 0 bytes
.../xpath/ui/servicedescription/arrow_right.png | Bin 0 -> 596 bytes
.../famfamfam_silk/accept.png | Bin 0 -> 781 bytes
.../famfamfam_silk/exclamation.png | Bin 0 -> 701 bytes
.../servicedescription/famfamfam_silk/help.png | Bin 0 -> 786 bytes
.../famfamfam_silk/page_white_code.png | Bin 0 -> 603 bytes
.../servicedescription/famfamfam_silk/tag.png | Bin 0 -> 389 bytes
.../text_linespacing (collapse).png | Bin 0 -> 371 bytes
.../famfamfam_silk/text_linespacing.png | Bin 0 -> 363 bytes
.../xpath/ui/servicedescription/folds/fold.png | Bin 0 -> 331 bytes
.../ui/servicedescription/folds/unfold.png | Bin 0 -> 334 bytes
.../ui/servicedescription/xpath_attribute.png | Bin 0 -> 1426 bytes
426 files changed, 19401 insertions(+), 19032 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 17d95a0..8ba508e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,6 @@
/taverna-beanshell-activity-ui/target/
/taverna-spreadsheet-import-activity-ui/target/
/taverna-external-tool-activity-ui/target/
-/taverna-localworker-activity-ui/target/
\ No newline at end of file
+/taverna-localworker-activity-ui/target/
+/taverna-xpath-activity-ui/target/
+/taverna-rest-activity-ui/target/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/actions/BeanshellActivityConfigurationAction.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
deleted file mode 100644
index be81889..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
+++ /dev/null
@@ -1,71 +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.beanshell.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public class BeanshellActivityConfigurationAction extends ActivityConfigurationAction {
-
- public static final String EDIT_BEANSHELL_SCRIPT = "Edit beanshell script";
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ApplicationConfiguration applicationConfiguration;
-
- public BeanshellActivityConfigurationAction(Activity activity, Frame owner,
- EditManager editManager, FileManager fileManager,
- ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry,
- ApplicationConfiguration applicationConfiguration) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.applicationConfiguration = applicationConfiguration;
- putValue(NAME, EDIT_BEANSHELL_SCRIPT);
- }
-
- public void actionPerformed(ActionEvent e) {
- ActivityConfigurationDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
- final BeanshellConfigurationPanel beanshellConfigView = new BeanshellConfigurationPanel(
- getActivity(), applicationConfiguration);
- final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
- beanshellConfigView, editManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateAction.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateAction.java
deleted file mode 100644
index 7bd5d61..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateAction.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.beanshell.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action to add a beanshell activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddBeanshellTemplateAction extends AbstractContextualMenuAction {
-
- private static final String ADD_BEANSHELL = "Beanshell";
-
- private static final URI insertSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/insert");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public AddBeanshellTemplateAction() {
- super(insertSection, 300);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
- }
-
- @Override
- protected Action createAction() {
-
- return new AddBeanshellAction();
- }
-
- protected class AddBeanshellAction extends AbstractAction {
- AddBeanshellAction() {
- super(ADD_BEANSHELL, activityIconManager
- .iconForActivity(BeanshellTemplateService.ACTIVITY_TYPE));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(serviceDescriptionRegistry
- .getServiceDescription(BeanshellTemplateService.ACTIVITY_TYPE), false,
- editManager, menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
deleted file mode 100644
index 6aa1ce2..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.beanshell.menu;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * An action to add a beanshell activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author alanrw
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddBeanshellTemplateMenuAction extends AbstractMenuAction {
-
- private static final String ADD_BEANSHELL = "Beanshell";
-
- private static final URI INSERT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
- private static final URI ADD_BEANSHELL_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddBeanshell");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public AddBeanshellTemplateMenuAction() {
- super(INSERT, 300, ADD_BEANSHELL_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddBeanshellMenuAction();
- }
-
- protected class AddBeanshellMenuAction extends AbstractAction implements DesignOnlyAction {
- AddBeanshellMenuAction() {
- super();
- putValue(SMALL_ICON,
- activityIconManager.iconForActivity(BeanshellTemplateService.ACTIVITY_TYPE));
- putValue(NAME, ADD_BEANSHELL);
- putValue(SHORT_DESCRIPTION, "Beanshell service");
- putValue(
- Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.SHIFT_DOWN_MASK
- | InputEvent.ALT_DOWN_MASK));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(serviceDescriptionRegistry
- .getServiceDescription(BeanshellTemplateService.ACTIVITY_TYPE), false,
- editManager, menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/ConfigureBeanshellMenuAction.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
deleted file mode 100644
index deea214..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.sf.taverna.t2.activities.beanshell.menu;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.activities.beanshell.actions.BeanshellActivityConfigurationAction;
-import net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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;
-
-import javax.swing.Action;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-public class ConfigureBeanshellMenuAction extends AbstractConfigureActivityMenuAction {
-
- public static final URI LOCALWORKER_ACTIVITY = URI
- .create("http://ns.taverna.org.uk/2010/activity/localworker");
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ApplicationConfiguration applicationConfiguration;
-
- public ConfigureBeanshellMenuAction() {
- super(BeanshellTemplateService.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- Activity a = findActivity();
- Action result = null;
- if (!(a.getType().equals(LOCALWORKER_ACTIVITY))) {
- result = new BeanshellActivityConfigurationAction(findActivity(), getParentFrame(),
- editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
- applicationConfiguration);
- result.putValue(Action.NAME, BeanshellActivityConfigurationAction.EDIT_BEANSHELL_SCRIPT);
- addMenuDots(result);
- }
- return result;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
deleted file mode 100644
index 055aa81..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
+++ /dev/null
@@ -1,58 +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.beanshell.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- * @author David Withers
- */
-public class BeanshellActivityIcon implements ActivityIconSPI {
-
- private static Icon icon = null;
-
- @Override
- public int canProvideIconScore(URI activityType) {
- if (BeanshellTemplateService.ACTIVITY_TYPE.equals(activityType))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- @Override
- public Icon getIcon(URI activityType) {
- return getBeanshellIcon();
- }
-
- public static Icon getBeanshellIcon() {
- if (icon == null) {
- icon = new ImageIcon(BeanshellActivityIcon.class.getResource("/beanshell.png"));
- }
- return icon;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellTemplateService.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
deleted file mode 100644
index 847b73c..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/servicedescriptions/BeanshellTemplateService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.sf.taverna.t2.activities.beanshell.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public class BeanshellTemplateService extends AbstractTemplateService {
-
- public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/beanshell");
-
- private static final String BEANSHELL = "Beanshell";
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/beanshell");
-
- public String getName() {
- return BEANSHELL;
- }
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- configuration.getJsonAsObjectNode().put("script", "");
- configuration.getJsonAsObjectNode().put("classLoaderSharing", "workflow");
- return configuration;
- }
-
- @Override
- public Icon getIcon() {
- return BeanshellActivityIcon.getBeanshellIcon();
- }
-
- @Override
- public String getDescription() {
- return "A service that allows Beanshell scripts, with dependencies on libraries";
- }
-
- public static ServiceDescription getServiceDescription() {
- BeanshellTemplateService bts = new BeanshellTemplateService();
- return bts.templateService;
- }
-
- public String getId() {
- return providerId.toString();
- }
-
- @Override
- public ServiceDescriptionProvider newInstance() {
- return new BeanshellTemplateService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellActivityViewFactory.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellActivityViewFactory.java
deleted file mode 100644
index 58dd0d4..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellActivityViewFactory.java
+++ /dev/null
@@ -1,84 +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.beanshell.views;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-public class BeanshellActivityViewFactory implements ContextualViewFactory<Activity> {
-
- private static final URI ACTIVITY_TYPE = URI
- .create("http://ns.taverna.org.uk/2010/activity/beanshell");
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
- private ApplicationConfiguration applicationConfiguration;
-
- public boolean canHandle(Object object) {
- return object instanceof Activity && ((Activity) object).getType().equals(ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays.asList(new ContextualView[] { new BeanshellContextualView(activity,
- editManager, fileManager, activityIconManager, colourManager,
- serviceDescriptionRegistry, applicationConfiguration) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellConfigurationPanel.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellConfigurationPanel.java
deleted file mode 100644
index a4bece7..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellConfigurationPanel.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.beanshell.views;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-import net.sf.taverna.t2.lang.ui.EditorKeySetUtil;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityPortConfiguration;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.DependencyConfigurationPanel;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ListConfigurationComponent;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ScriptConfigurationComponent;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ValidatingTextField;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ValidatingTextGroup;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-
-/**
- * Component for configuring a Beanshell activity.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class BeanshellConfigurationPanel extends MultiPageActivityConfigurationPanel {
-
- private ScriptConfigurationComponent scriptConfigurationComponent;
- private ValidatingTextGroup inputTextGroup, outputTextGroup;
- private DependencyConfigurationPanel dependencyConfigurationPanel;
- private File libDir;
-
- public BeanshellConfigurationPanel(Activity activity,
- ApplicationConfiguration applicationConfiguration) {
- super(activity);
- libDir = new File(applicationConfiguration.getApplicationHomeDir(), "lib");
- if (!libDir.exists()) {
- libDir.mkdir();
- }
- initialise();
- }
-
- @Override
- protected void initialise() {
- super.initialise();
- removeAllPages();
- addPage("Script", createScriptEditPanel());
- addPage("Input ports", createInputPanel());
- addPage("Output ports", createOutputPanel());
- addPage("Dependencies", createDependenciesPanel());
- setPreferredSize(new Dimension(600, 500));
- }
-
- @Override
- public void noteConfiguration() {
- setProperty("script", scriptConfigurationComponent.getScript());
- setProperty("classLoaderSharing", dependencyConfigurationPanel.getClassLoaderSharing());
- List<String> localDependencies = dependencyConfigurationPanel.getLocalDependencies();
- if (localDependencies == null || localDependencies.isEmpty()) {
- getJson().remove("localDependency");
- } else {
- ArrayNode localDependenciesArray = getJson().arrayNode();
- for (String localDependency : localDependencies) {
- localDependenciesArray.add(localDependency);
- }
- getJson().put("localDependency", localDependenciesArray);
- }
- }
-
- @Override
- public boolean checkValues() {
- return true;
- }
-
- private Component createScriptEditPanel() {
- Set<String> keywords = EditorKeySetUtil.loadKeySet(getClass().getResourceAsStream(
- "keys.txt"));
- Set<String> ports = new HashSet<>();
- for (InputActivityPort ip : getActivity().getInputPorts()) {
- ports.add(ip.getName());
- }
- for (OutputActivityPort op : getActivity().getOutputPorts()) {
- ports.add(op.getName());
- }
- scriptConfigurationComponent = new ScriptConfigurationComponent(getProperty("script"),
- keywords, ports, "Beanshell", ".bsh");
- return scriptConfigurationComponent;
- }
-
- private Component createInputPanel() {
- inputTextGroup = new ValidatingTextGroup();
- ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>(
- "Input Port", getInputPorts()) {
- @Override
- protected Component createItemComponent(ActivityPortConfiguration port) {
- return new PortComponent(port, inputTextGroup);
- }
-
- @Override
- protected ActivityPortConfiguration createDefaultItem() {
- return new ActivityPortConfiguration("in", 0);
- }
- };
- return inputPanel;
- }
-
- private Component createOutputPanel() {
- outputTextGroup = new ValidatingTextGroup();
- ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>(
- "Output Port", getOutputPorts()) {
- @Override
- protected Component createItemComponent(ActivityPortConfiguration port) {
- return new PortComponent(port, outputTextGroup);
- }
-
- @Override
- protected ActivityPortConfiguration createDefaultItem() {
- return new ActivityPortConfiguration("out", 0);
- }
- };
- return inputPanel;
- }
-
- private Component createDependenciesPanel() {
- String classLoaderSharing = getProperty("classLoaderSharing");
- List<String> localDependencies = new ArrayList<>();
- if (getJson().has("localDependency")) {
- for (JsonNode localDependency : getJson().get("localDependency")) {
- localDependencies.add(localDependency.textValue());
- }
- }
- dependencyConfigurationPanel = new DependencyConfigurationPanel(classLoaderSharing,
- localDependencies, libDir);
- return dependencyConfigurationPanel;
- }
-
- class PortComponent extends JPanel {
-
- private ValidatingTextField nameField;
- private SpinnerNumberModel depthModel;
- private final ValidatingTextGroup validatingTextGroup;
-
- public PortComponent(final ActivityPortConfiguration portConfiguration,
- ValidatingTextGroup validatingTextGroup) {
- this.validatingTextGroup = validatingTextGroup;
-
- nameField = new ValidatingTextField(portConfiguration.getName());
- nameField.getDocument().addDocumentListener(new DocumentListener() {
- @Override
- public void removeUpdate(DocumentEvent e) {
- portConfiguration.setName(nameField.getText());
- }
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- portConfiguration.setName(nameField.getText());
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- portConfiguration.setName(nameField.getText());
- }
- });
- validatingTextGroup.addValidTextComponent(nameField);
- depthModel = new SpinnerNumberModel(portConfiguration.getDepth(), 0, 100, 1);
- depthModel.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- portConfiguration.setDepth(depthModel.getNumber().intValue());
- }
- });
-
- setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = GridBagConstraints.WEST;
- add(new JLabel("Name"), c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1;
- add(nameField, c);
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- add(new JLabel("Depth"), c);
- add(new JSpinner(depthModel), c);
-
- }
-
- public void removeNotify() {
- validatingTextGroup.removeTextComponent(nameField);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellContextualView.java b/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellContextualView.java
deleted file mode 100644
index 1f08aa9..0000000
--- a/taverna-beanshell-activity-ui/src/main/java/net/sf/taverna/t2/activities/beanshell/views/BeanshellContextualView.java
+++ /dev/null
@@ -1,104 +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.beanshell.views;
-
-import java.awt.Frame;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.beanshell.actions.BeanshellActivityConfigurationAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-/**
- * A simple non editable HTML table view over a {@link BeanshellActivity}.
- * Clicking on the configure button shows the editable {@link BeanshellConfigView}
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class BeanshellContextualView extends HTMLBasedActivityContextualView {
-
- private EditManager editManager;
- private FileManager fileManager;
- private final ActivityIconManager activityIconManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
- private final ApplicationConfiguration applicationConfiguration;
-
- public BeanshellContextualView(Activity activity, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry,
- ApplicationConfiguration applicationConfiguration) {
- super(activity, colourManager);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- this.applicationConfiguration = applicationConfiguration;
- init();
- }
-
- private void init() {
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- StringBuilder html = new StringBuilder();
- html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
- for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
- html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
- html.append(inputActivityPort.getDepth() + "</td></tr>");
- }
- html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
- for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
- html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
- html.append(outputActivityPort.getDepth() + "</td></tr>");
- }
- return html.toString();
- }
-
- @Override
- public String getViewTitle() {
- return "Beanshell service";
- }
-
- @Override
- public Action getConfigureAction(Frame owner) {
- return new BeanshellActivityConfigurationAction(getActivity(), owner, editManager,
- fileManager, activityIconManager, serviceDescriptionRegistry, applicationConfiguration);
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/actions/BeanshellActivityConfigurationAction.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
new file mode 100644
index 0000000..1a7b189
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/actions/BeanshellActivityConfigurationAction.java
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.activities.beanshell.views.BeanshellConfigurationPanel;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class BeanshellActivityConfigurationAction extends ActivityConfigurationAction {
+
+ public static final String EDIT_BEANSHELL_SCRIPT = "Edit beanshell script";
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ApplicationConfiguration applicationConfiguration;
+
+ public BeanshellActivityConfigurationAction(Activity activity, Frame owner,
+ EditManager editManager, FileManager fileManager,
+ ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry,
+ ApplicationConfiguration applicationConfiguration) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.applicationConfiguration = applicationConfiguration;
+ putValue(NAME, EDIT_BEANSHELL_SCRIPT);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+ final BeanshellConfigurationPanel beanshellConfigView = new BeanshellConfigurationPanel(
+ getActivity(), applicationConfiguration);
+ final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
+ beanshellConfigView, editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateAction.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateAction.java
new file mode 100644
index 0000000..60186a5
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateAction.java
@@ -0,0 +1,112 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action to add a beanshell activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddBeanshellTemplateAction extends AbstractContextualMenuAction {
+
+ private static final String ADD_BEANSHELL = "Beanshell";
+
+ private static final URI insertSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/insert");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public AddBeanshellTemplateAction() {
+ super(insertSection, 300);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+
+ return new AddBeanshellAction();
+ }
+
+ protected class AddBeanshellAction extends AbstractAction {
+ AddBeanshellAction() {
+ super(ADD_BEANSHELL, activityIconManager
+ .iconForActivity(BeanshellTemplateService.ACTIVITY_TYPE));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(serviceDescriptionRegistry
+ .getServiceDescription(BeanshellTemplateService.ACTIVITY_TYPE), false,
+ editManager, menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
new file mode 100644
index 0000000..7ec6d66
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/AddBeanshellTemplateMenuAction.java
@@ -0,0 +1,120 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * An action to add a beanshell activity + a wrapping processor to the workflow.
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddBeanshellTemplateMenuAction extends AbstractMenuAction {
+
+ private static final String ADD_BEANSHELL = "Beanshell";
+
+ private static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ private static final URI ADD_BEANSHELL_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddBeanshell");
+
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public AddBeanshellTemplateMenuAction() {
+ super(INSERT, 300, ADD_BEANSHELL_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddBeanshellMenuAction();
+ }
+
+ protected class AddBeanshellMenuAction extends AbstractAction implements DesignOnlyAction {
+ AddBeanshellMenuAction() {
+ super();
+ putValue(SMALL_ICON,
+ activityIconManager.iconForActivity(BeanshellTemplateService.ACTIVITY_TYPE));
+ putValue(NAME, ADD_BEANSHELL);
+ putValue(SHORT_DESCRIPTION, "Beanshell service");
+ putValue(
+ Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.SHIFT_DOWN_MASK
+ | InputEvent.ALT_DOWN_MASK));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowView.importServiceDescription(serviceDescriptionRegistry
+ .getServiceDescription(BeanshellTemplateService.ACTIVITY_TYPE), false,
+ editManager, menuManager, selectionManager, serviceRegistry);
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/ConfigureBeanshellMenuAction.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
new file mode 100644
index 0000000..bcecbc5
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/menu/ConfigureBeanshellMenuAction.java
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.activities.beanshell.actions.BeanshellActivityConfigurationAction;
+import org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+import javax.swing.Action;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class ConfigureBeanshellMenuAction extends AbstractConfigureActivityMenuAction {
+
+ public static final URI LOCALWORKER_ACTIVITY = URI
+ .create("http://ns.taverna.org.uk/2010/activity/localworker");
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ApplicationConfiguration applicationConfiguration;
+
+ public ConfigureBeanshellMenuAction() {
+ super(BeanshellTemplateService.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ Activity a = findActivity();
+ Action result = null;
+ if (!(a.getType().equals(LOCALWORKER_ACTIVITY))) {
+ result = new BeanshellActivityConfigurationAction(findActivity(), getParentFrame(),
+ editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
+ applicationConfiguration);
+ result.putValue(Action.NAME, BeanshellActivityConfigurationAction.EDIT_BEANSHELL_SCRIPT);
+ addMenuDots(result);
+ }
+ return result;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
new file mode 100644
index 0000000..0708f0a
--- /dev/null
+++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellActivityIcon.java
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.beanshell.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ * @author David Withers
+ */
+public class BeanshellActivityIcon implements ActivityIconSPI {
+
+ private static Icon icon = null;
+
+ @Override
+ public int canProvideIconScore(URI activityType) {
+ if (BeanshellTemplateService.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ @Override
+ public Icon getIcon(URI activityType) {
+ return getBeanshellIcon();
+ }
+
+ public static Icon getBeanshellIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(BeanshellActivityIcon.class.getResource("/beanshell.png"));
+ }
+ return icon;
+ }
+}
[04/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanel.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
deleted file mode 100644
index 54719a2..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanel.java
+++ /dev/null
@@ -1,1202 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config;
-
-import java.awt.AWTEvent;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Toolkit;
-import java.awt.event.AWTEventListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.geom.Area;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTabbedPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.JToggleButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.Popup;
-import javax.swing.PopupFactory;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-import javax.swing.event.CaretEvent;
-import javax.swing.event.CaretListener;
-import javax.swing.filechooser.FileFilter;
-import javax.swing.table.DefaultTableModel;
-
-import org.apache.taverna.activities.xpath.XPathActivityConfigurationBean;
-import net.sf.taverna.t2.activities.xpath.ui.config.xmltree.TableCellListener;
-import net.sf.taverna.t2.activities.xpath.ui.config.xmltree.XPathActivityXMLTree;
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathActivityIcon;
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
-
-import org.apache.log4j.Logger;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
-import org.dom4j.InvalidXPathException;
-import org.dom4j.Node;
-import org.dom4j.XPath;
-import org.dom4j.XPathException;
-
-/**
- * @author Sergejs Aleksejevs
- */
-@SuppressWarnings("serial")
-public class XPathActivityConfigurationPanel extends JPanel {
-
- private Logger logger = Logger.getLogger(XPathActivityConfigurationPanel.class);
-
- // --- CONSTANTS ---
- public static final int MAX_NUMBER_OF_MATCHING_NODES_TO_HIGHLIGHT_IN_THE_TREE = 100;
-
- private static final Color INACTIVE_PANEL_BACKGROUND_COLOR = new Color(215,
- 215, 215);
-
- private static final String EXAMPLE_XML_PROMPT = "Paste example XML here...";
-
- private static final String XPATH_XML_DOCUMENT_DIR_PROPERTY="XPathXMLDocumentDir";
-
- private XPathActivityConfigurationPanel thisPanel;
-
- // --- COMPONENTS FOR ACTIVITY CONFIGURATION PANEL ---
- private JPanel jpActivityConfiguration;
-
- private JPanel jpLeft;
- private JPanel jpRight;
-
- private JToggleButton bShowXMLTreeSettings;
- private Popup xmlTreeSettingsMenu;
- private long xmlTreeSettingsMenuLastShownAt;
- private JButton bGenerateXPathExpression;
- private JPanel jpXMLTreeSettingsMenuContents;
- private JCheckBoxMenuItem miIncludeAttributes;
- private JCheckBoxMenuItem miIncludeValues;
- private JCheckBoxMenuItem miIncludeNamespaces;
-
- private JTextArea taSourceXML;
- private JButton bLoadXMLDocument;
- private JButton bParseXML;
- private XPathActivityXMLTree xmlTree;
- private JScrollPane spXMLTreePlaceholder;
-
- // --- COMPONENTS FOR XPATH EDITING PANEL ---
- private JLabel jlXPathExpressionStatus;
- private JLabel jlXPathExpression;
- private JTextField tfXPathExpression;
- private Map<String, String> xpathNamespaceMap;
- private JButton bRunXPath;
-
- private JLabel jlShowHideNamespaceMappings;
- private JTable jtXPathNamespaceMappings;
- private JButton bAddMapping;
- private JButton bRemoveMapping;
- private JPanel jpNamespaceMappingsWithButton;
-
- // --- COMPONENTS FOR XPATH TESTING PANEL ---
- private JPanel jpXPathTesting;
-
- private JTextField tfExecutedXPathExpression;
- private JTextField tfMatchingElementCount;
-
- private JTabbedPane tpExecutedXPathExpressionResults;
- private JTextArea taExecutedXPathExpressionResultsAsText;
- private JScrollPane spExecutedXPathExpressionResultsAsText;
- private JTextArea taExecutedXPathExpressionResultsAsXML;
- private JScrollPane spExecutedXPathExpressionResultsAsXML;
-
- public XPathActivityConfigurationPanel() {
- this.thisPanel = this;
-
- this.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 0.50;
- c.insets = new Insets(0, 10, 10, 10);
- this.jpActivityConfiguration = createActivityConfigurationPanel();
- this.add(this.jpActivityConfiguration, c);
-
- c.gridy++;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weighty = 0;
- c.insets = new Insets(0, 10, 0, 10);
- this.add(new JSeparator(), c);
-
- // XPath expression editing panel
- c.gridy++;
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 0.05;
- c.insets = new Insets(5, 10, 5, 10);
- this.add(createXPathExpressionEditingPanel(), c);
-
- c.gridy++;
- ;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weighty = 0;
- c.insets = new Insets(0, 10, 0, 10);
- this.add(new JSeparator(), c);
-
- // XPath expression testing panel
- c.gridy++;
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 0.35;
- c.insets = new Insets(5, 10, 0, 10);
- this.jpXPathTesting = createXPathExpressionTestingPanel();
- this.add(this.jpXPathTesting, c);
- }
-
- private JPanel createActivityConfigurationPanel() {
- JPanel jpConfig = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- // text area for example XML document
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 0.5;
- c.weighty = 1.0;
- c.insets = new Insets(5, 0, 0, 5);
- taSourceXML = new JTextArea(10, 30);
- taSourceXML
- .setToolTipText("<html>Use this text area to paste or load an example XML document.<br>"
- + "This document can then be parsed by clicking the button<br>"
- + "with a green arrow in order to see its tree structure.</html>");
- taSourceXML.setText(EXAMPLE_XML_PROMPT);
- taSourceXML.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- taSourceXML.selectAll();
- }
-
- public void focusLost(FocusEvent e) { /* do nothing */
- }
- });
- taSourceXML.addCaretListener(new CaretListener() {
- public void caretUpdate(CaretEvent e) {
- // make sure that it is only allowed to "parse example XML"
- // when something is actually present in the text area
- bParseXML.setEnabled(taSourceXML.getText().trim().length() > 0
- && !taSourceXML.getText().trim().equals(
- EXAMPLE_XML_PROMPT));
- }
- });
- jpLeft = new JPanel(new GridLayout(1, 1));
- jpLeft.add(new JScrollPane(taSourceXML));
- jpConfig.add(jpLeft, c);
-
- // button to parse example XML document
-
- c.gridx++;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(0, 0, 0, 0);
- bParseXML = new JButton(
- XPathActivityIcon
- .getIconById(XPathActivityIcon.XPATH_ACTIVITY_CONFIGURATION_PARSE_XML_ICON));
- bParseXML
- .setToolTipText("Parse example XML document and generate its tree structure");
- bParseXML.setEnabled(false);
- bParseXML.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- parseXML();
- }
- });
- jpConfig.add(bParseXML, c);
-
- // placeholder for XML tree (will be replaced by a real tree when the
- // parsing is done)
-
- c.gridx++;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 0.5;
- c.weighty = 1.0;
- c.insets = new Insets(5, 5, 0, 0);
- JTextArea taXMLTreePlaceholder = new JTextArea(10, 30);
- taXMLTreePlaceholder
- .setToolTipText("<html>This area will show tree structure of the example XML after you<br>"
- + "paste it into the space on the left-hand side and press 'Parse'<br>"
- + "button with the green arrow.</html>");
- taXMLTreePlaceholder.setEditable(false);
- taXMLTreePlaceholder.setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
- spXMLTreePlaceholder = new JScrollPane(taXMLTreePlaceholder);
- jpRight = new JPanel(new GridLayout(1, 1));
- jpRight.add(spXMLTreePlaceholder);
- jpConfig.add(jpRight, c);
-
- // Button to load XML document from a file
-
- bLoadXMLDocument = new JButton("Load XML from file", WorkbenchIcons.openIcon);
- bLoadXMLDocument.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- JFileChooser fileChooser = new JFileChooser();
- Preferences prefs = Preferences.userNodeForPackage(getClass());
- String curDir = prefs.get(XPATH_XML_DOCUMENT_DIR_PROPERTY, System.getProperty("user.home"));
- fileChooser.setDialogTitle("Select file to load XML from");
- fileChooser.setFileFilter(new FileFilter() {
- public boolean accept(File f) {
- return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");
- }
-
- public String getDescription() {
- return ".xml files";
- }
- });
- fileChooser.setCurrentDirectory(new File(curDir));
- int returnVal = fileChooser.showOpenDialog(((JButton) e
- .getSource()).getParent());
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- prefs.put(XPATH_XML_DOCUMENT_DIR_PROPERTY, fileChooser
- .getCurrentDirectory().toString());
- File file = fileChooser.getSelectedFile();
- // Read the contents of a file into a string
- // and set the value of the XML document text area to it
- FileInputStream fis = null;
- try{
- byte[] fileBytes = new byte[(int)file.length()];
- fis = new FileInputStream(file);
- fis.read(fileBytes);
- String xmlDocument = new String(fileBytes, "UTF-8");
- setSourceXML(xmlDocument);
- }
- catch(Exception ex){
- logger.error("An error occured while trying to read the XML document from file " + file.getAbsolutePath(), ex);
- JOptionPane.showMessageDialog(
- ((JButton) e.getSource()).getParent(),
- "There was an error while trying to read the file",
- "XPath Activity",
- JOptionPane.ERROR_MESSAGE);
- }
- finally{
- try {
- fis.close();
- } catch (IOException e1) {
- // Ignore
- }
- }
-
- }
- }
- });
- c.gridx = 0;
- c.gridy++;
- c.gridwidth = 1;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(5, 0, 0, 5);
- c.anchor = GridBagConstraints.EAST;
- jpConfig.add(bLoadXMLDocument, c);
-
- // settings for the view of XML tree from example XML document
-
- miIncludeAttributes = new JCheckBoxMenuItem("Show XML node attributes");
- miIncludeAttributes.setSelected(true);
- miIncludeAttributes.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- refreshXMLTreeUI();
- }
- });
-
- miIncludeValues = new JCheckBoxMenuItem(
- "Show values of XML elements and attributes");
- miIncludeValues.setSelected(true);
- miIncludeValues.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- refreshXMLTreeUI();
- }
- });
-
- miIncludeNamespaces = new JCheckBoxMenuItem(
- "Show namespaces of XML elements");
- miIncludeNamespaces.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- refreshXMLTreeUI();
- }
- });
-
- jpXMLTreeSettingsMenuContents = new JPanel();
- jpXMLTreeSettingsMenuContents.setBorder(BorderFactory
- .createRaisedBevelBorder());
- jpXMLTreeSettingsMenuContents.setLayout(new BoxLayout(
- jpXMLTreeSettingsMenuContents, BoxLayout.Y_AXIS));
- jpXMLTreeSettingsMenuContents.add(miIncludeAttributes);
- jpXMLTreeSettingsMenuContents.add(miIncludeValues);
- jpXMLTreeSettingsMenuContents.add(miIncludeNamespaces);
-
- bShowXMLTreeSettings = new JToggleButton("Show XML tree settings...",
- XPathActivityIcon.getIconById(XPathActivityIcon.UNFOLD_ICON));
- bShowXMLTreeSettings.setSelectedIcon(XPathActivityIcon
- .getIconById(XPathActivityIcon.FOLD_ICON));
- bShowXMLTreeSettings.setEnabled(false);
- bShowXMLTreeSettings.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (xmlTreeSettingsMenu == null) {
- xmlTreeSettingsMenuLastShownAt = System.currentTimeMillis();
-
- Point parentPosition = bShowXMLTreeSettings
- .getLocationOnScreen();
- xmlTreeSettingsMenu = PopupFactory.getSharedInstance()
- .getPopup(
- bShowXMLTreeSettings,
- jpXMLTreeSettingsMenuContents,
- parentPosition.x,
- parentPosition.y
- + bShowXMLTreeSettings.getHeight());
- xmlTreeSettingsMenu.show();
- } else {
- bShowXMLTreeSettings.setSelected(false);
- }
- }
- });
-
- bGenerateXPathExpression = new JButton("Generate XPath expression",
- XPathActivityIcon
- .getIconById(XPathActivityIcon.XML_TREE_NODE_ICON));
- bGenerateXPathExpression.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- updateXPathEditingPanelValues();
- }
- });
-
- JPanel xmlTreeButtonPanel = new JPanel();
- xmlTreeButtonPanel.add(bGenerateXPathExpression);
- xmlTreeButtonPanel.add(bShowXMLTreeSettings);
-
- c.gridx = 2;
- c.gridwidth = 1;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(5, 0, 0, 0);
- c.anchor = GridBagConstraints.EAST;
- jpConfig.add(xmlTreeButtonPanel, c);
-
- // register a new listener for all AWT mouse events - this will be used
- // to identify clicks outside of the XML tree popup menu and the toggle
- // button used to show/hide it
- Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
- public void eventDispatched(AWTEvent event) {
- if (event instanceof MouseEvent && xmlTreeSettingsMenu != null) {
- MouseEvent e = (MouseEvent) event;
- if (e.getClickCount() > 0
- && (e.getWhen() - xmlTreeSettingsMenuLastShownAt) > 100) {
- // convert a point where mouse click was made from
- // relative coordinates of the source component
- // to the coordinates of the panel that represents the
- // contents of the popup menu
- Point clickRelativeToOverlay = SwingUtilities
- .convertPoint((Component) e.getSource(), e
- .getPoint(),
- jpXMLTreeSettingsMenuContents);
-
- Area areaOfPopupPanelAndToggleButton = new Area(
- jpXMLTreeSettingsMenuContents.getBounds());
-
- // only hide the popup menu if a click was made outside
- // of the calculated area --
- // plus not on one of the associated toggle buttons
- if (!areaOfPopupPanelAndToggleButton
- .contains(clickRelativeToOverlay)) {
- xmlTreeSettingsMenu.hide();
- bShowXMLTreeSettings.setSelected(false);
-
- // if the popup menu was dismissed by a click on the
- // toggle button that
- // has made it visible, this timer makes sure that
- // this click doesn't
- // re-show the popup menu
- new Timer(100, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- ((Timer) e.getSource()).stop();
- xmlTreeSettingsMenu = null;
- }
- }).start();
-
- }
- }
- }
- }
- }, AWTEvent.MOUSE_EVENT_MASK);
-
- return (jpConfig);
- }
-
- private JPanel createXPathExpressionEditingPanel() {
- this.jlXPathExpressionStatus = new JLabel();
-
- this.jlXPathExpression = new JLabel("XPath expression");
-
- this.bRunXPath = new JButton("Run XPath");
- this.bRunXPath.setEnabled(false);
- this.bRunXPath.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- runXPath(true);
- }
- });
-
- this.tfXPathExpression = new JTextField(30);
- this.tfXPathExpression.setPreferredSize(new Dimension(0, this.bRunXPath
- .getPreferredSize().height));
- this.tfXPathExpression.setMinimumSize(new Dimension(0, this.bRunXPath
- .getPreferredSize().height));
- this.tfXPathExpression.addCaretListener(new CaretListener() {
- public void caretUpdate(CaretEvent e) {
- validateXPathAndUpdateUI();
- }
- });
- this.tfXPathExpression.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- if (bRunXPath.isEnabled()) {
- // it is safe to check that ENTER key may execute the
- // XPath expression if the
- // "Run XPath" button is enabled, as expression
- // validation is responsible for
- // enabling / disabling the button as the expression
- // changes
- runXPath(true);
- }
- }
- }
-
- public void keyReleased(KeyEvent e) { /* not in use */
- }
-
- public void keyTyped(KeyEvent e) { /* not in use */
- }
- });
-
- JPanel jpXPath = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weighty = 0;
-
- c.gridx = 0;
- c.gridy = 0;
- c.weightx = 0;
- jpXPath.add(jlXPathExpressionStatus);
-
- c.gridx++;
- c.weightx = 0.0;
- c.insets = new Insets(0, 10, 0, 0);
- jpXPath.add(jlXPathExpression, c);
-
- c.gridx++;
- c.weightx = 1.0;
- c.insets = new Insets(0, 10, 0, 10);
- jpXPath.add(tfXPathExpression, c);
-
- c.gridx++;
- c.weightx = 0;
- c.insets = new Insets(0, 0, 0, 0);
- jpXPath.add(bRunXPath, c);
-
- c.gridx = 2;
- c.gridy++;
- c.weightx = 1.0;
- c.weighty = 0;
- c.gridwidth = 2;
- c.fill = GridBagConstraints.NONE;
- c.anchor = GridBagConstraints.WEST;
- c.insets = new Insets(0, 10, 0, 10);
- jlShowHideNamespaceMappings = new JLabel("Show namespace mappings...");
- jlShowHideNamespaceMappings.setForeground(Color.BLUE);
- jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR));
- jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- jpNamespaceMappingsWithButton
- .setVisible(!jpNamespaceMappingsWithButton.isVisible());
- jlShowHideNamespaceMappings
- .setText((jpNamespaceMappingsWithButton.isVisible() ? "Hide"
- : "Show")
- + " namespace mappings...");
- thisPanel.validate();
- }
- });
- jpXPath.add(jlShowHideNamespaceMappings, c);
-
- // namespace mapping table
- DefaultTableModel tableModel = new DefaultTableModel();
- tableModel.addColumn("Namespace Prefix");
- tableModel.addColumn("Namespace URI");
-
- jtXPathNamespaceMappings = new JTable();
- jtXPathNamespaceMappings.setModel(tableModel);
- // ((DefaultCellEditor)jtXPathNamespaceMappings.getDefaultEditor(String.class)).setClickCountToStart(1);
- // // TODO - enable if one-click-to-start-editing behaviour is required
- // TODO - next line is to be enabled when Taverna is migrated to Java
- // 1.6; for now it's fine to run without this
- // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure
- // that when the dedicated area is larger than the table, the latter is
- // stretched vertically to fill the empty space
- jtXPathNamespaceMappings
- .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one row can be selected at a time
- jtXPathNamespaceMappings
- .setPreferredScrollableViewportSize(new Dimension(200, 50)); // NB! this prevents the table from occupying most of the space in the panel when screen is maximized
- jtXPathNamespaceMappings.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_DELETE) {
- removeNamespaceMapping();
- }
- }
- });
-
- TableCellListener cellListener = new TableCellListener(
- jtXPathNamespaceMappings, new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- TableCellListener tcl = (TableCellListener) e
- .getSource();
-
- if (tcl.getColumn() == 0) {
- // prefix was modified
- String newPrefix = (String) tcl.getNewValue();
- if (xpathNamespaceMap.containsKey(newPrefix)) {
- // such prefix already exists - change won't be
- // saved
- JOptionPane
- .showMessageDialog(
- thisPanel,
- "Cannot update namespace prefix: "
- + "updated value already exists",
- "XPath Activity",
- JOptionPane.WARNING_MESSAGE);
- } else {
- // update the map with the new prefix for the
- // same URI value
- String oldPrefix = (String) tcl.getOldValue();
- xpathNamespaceMap.put(newPrefix,
- xpathNamespaceMap.remove(oldPrefix));
- }
- } else {
- // simple case - just the URI value has changed:
- // just overwrite the value in the namespace map
- String prefixOfUpdatedURI = (String) jtXPathNamespaceMappings
- .getModel().getValueAt(tcl.getRow(), 0);
- xpathNamespaceMap.put(prefixOfUpdatedURI,
- (String) tcl.getNewValue());
- }
-
- // either way - reload from the local map (map could be
- // not updated if the validation didn't succeed)
- reloadNamespaceMappingTableFromLocalMap();
- }
- });
-
- jtXPathNamespaceMappings.getColumnModel().getColumn(0)
- .setPreferredWidth(20); // set relative sizes of columns
- jtXPathNamespaceMappings.getColumnModel().getColumn(1)
- .setPreferredWidth(300);
-
- JScrollPane spXPathNamespaceMappings = new JScrollPane(
- jtXPathNamespaceMappings);
- spXPathNamespaceMappings.setAlignmentY(TOP_ALIGNMENT);
- spXPathNamespaceMappings.setMinimumSize(new Dimension(200, 50)); // makes the table to have at least two rows visible in all cases - no matter how small the parent panel is
-
- bAddMapping = new JButton("Add Mapping");
- bAddMapping.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- addNamespaceMapping();
- }
- });
-
- bRemoveMapping = new JButton("Remove Mapping");
- bRemoveMapping.setEnabled(false);
- bRemoveMapping.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- removeNamespaceMapping();
- }
- });
-
- bAddMapping.setMinimumSize(bRemoveMapping.getPreferredSize()); // make sure that the 'Add Mapping' button is of the same size as 'Remove Mapping'
-
- bAddMapping.setPreferredSize(bRemoveMapping.getPreferredSize()); // -- both are required to achieve desired behaviour when window is resized / namespace mapping table is enabled/disabled
-
- bRunXPath.setMinimumSize(bRemoveMapping.getPreferredSize()); // do the same for 'Run XPath' button
-
- bRunXPath.setPreferredSize(bRemoveMapping.getPreferredSize());
-
- JPanel jpAddRemoveButtons = new JPanel();
- jpAddRemoveButtons.setLayout(new GridBagLayout());
- GridBagConstraints cAddRemove = new GridBagConstraints();
- cAddRemove.gridx = 0;
- cAddRemove.gridy = 0;
- cAddRemove.weightx = 1.0;
- cAddRemove.anchor = GridBagConstraints.NORTH;
- cAddRemove.fill = GridBagConstraints.HORIZONTAL;
- jpAddRemoveButtons.add(bAddMapping, cAddRemove);
- cAddRemove.gridy++;
- cAddRemove.weighty = 1.0;
- cAddRemove.insets = new Insets(2, 0, 0, 0);
- jpAddRemoveButtons.add(bRemoveMapping, cAddRemove);
-
- jpNamespaceMappingsWithButton = new JPanel();
- jpNamespaceMappingsWithButton.setVisible(false);
- jpNamespaceMappingsWithButton.setLayout(new BorderLayout(10, 0));
- jpNamespaceMappingsWithButton.add(spXPathNamespaceMappings,
- BorderLayout.CENTER);
- jpNamespaceMappingsWithButton
- .add(jpAddRemoveButtons, BorderLayout.EAST);
-
- c.gridx = 0;
- c.gridy++;
- c.gridwidth = 4;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 1.0;
- c.insets = new Insets(5, 0, 0, 0);
- jpXPath.add(jpNamespaceMappingsWithButton, c);
-
- // initialise some values / tooltips
- resetXPathEditingPanel();
-
- return (jpXPath);
- }
-
- protected void addNamespaceMapping() {
- TwoFieldQueryPanel queryPanel = new TwoFieldQueryPanel(
- "Namespace prefix:", "Namespace URI:");
- int result = JOptionPane.showConfirmDialog(this, queryPanel,
- "XPath Activity - Create new namespace mapping",
- JOptionPane.OK_CANCEL_OPTION);
-
- if (result == JOptionPane.OK_OPTION) {
- boolean bInvalidMapping = true;
- do {
- bInvalidMapping = queryPanel.getFirstValue().length() == 0
- || queryPanel.getSecondValue().length() == 0
- || xpathNamespaceMap.containsKey(queryPanel
- .getFirstValue());
-
- if (bInvalidMapping) {
- queryPanel = new TwoFieldQueryPanel(
- "<html><center><font color=\"red\">ERROR: you must "
- + "enter values for both namespace prefix and URI. Prefix must be<br>"
- + "unique in the mapping table - duplicates are not allowed!</font></center></html>",
- "Namespace prefix:", queryPanel.getFirstValue(),
- "Namespace URI:", queryPanel.getSecondValue());
- result = JOptionPane.showConfirmDialog(this, queryPanel,
- "XPath Activity - Create new namespace mapping",
- JOptionPane.OK_CANCEL_OPTION);
- }
- } while (bInvalidMapping && result == JOptionPane.OK_OPTION);
-
- if (result == JOptionPane.OK_OPTION && !bInvalidMapping) {
- // the value appears to be valid and OK was pressed - create new
- // mapping
- this.xpathNamespaceMap.put(queryPanel.getFirstValue(),
- queryPanel.getSecondValue());
- reloadNamespaceMappingTableFromLocalMap();
- }
- }
- }
-
- protected void removeNamespaceMapping() {
- int selectedRow = jtXPathNamespaceMappings.getSelectedRow();
- if (selectedRow != -1) {
- // some row is selected - need to delete it and refresh table's UI
- // (but first stop editing to avoid
- // problems with cell editor trying to store an edited value after
- // edited row has been deleted)
- if (jtXPathNamespaceMappings.getCellEditor() != null) {
- jtXPathNamespaceMappings.getCellEditor().stopCellEditing();
- }
- xpathNamespaceMap.remove(jtXPathNamespaceMappings.getValueAt(
- selectedRow, 0));
- reloadNamespaceMappingTableFromLocalMap();
-
- // select another row in the table
- int rowCount = jtXPathNamespaceMappings.getRowCount();
- if (rowCount > 0) {
- if (selectedRow < jtXPathNamespaceMappings.getRowCount()) {
- // select the row that followed the one that was deleted
- jtXPathNamespaceMappings.getSelectionModel()
- .setSelectionInterval(selectedRow, selectedRow);
- } else {
- // last row in the table was deleted - select the one that
- // is the new last row
- jtXPathNamespaceMappings.getSelectionModel()
- .setSelectionInterval(rowCount - 1, rowCount - 1);
- }
- }
- } else {
- JOptionPane.showMessageDialog(thisPanel,
- "Please select a mapping to delete in the table first!",
- "XPath Activity", JOptionPane.WARNING_MESSAGE);
- }
- }
-
- private JPanel createXPathExpressionTestingPanel() {
- JPanel jpTesting = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
-
- c.gridx = 0;
- c.gridy = 0;
- c.gridwidth = 1;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(0, 0, 10, 10);
- jpTesting.add(new JLabel("Executed XPath expression:"), c);
-
- c.gridx++;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
- c.weighty = 0;
- c.insets = new Insets(0, 0, 10, 10);
- tfExecutedXPathExpression = new JTextField();
- tfExecutedXPathExpression.setEditable(false);
- tfExecutedXPathExpression.setBorder(null);
- jpTesting.add(tfExecutedXPathExpression, c);
-
- c.gridx = 0;
- c.gridy++;
- c.fill = GridBagConstraints.NONE;
- c.weightx = 0;
- c.weighty = 0;
- c.insets = new Insets(0, 0, 5, 10);
- jpTesting.add(new JLabel("Number of matching nodes:"), c);
-
- c.gridx++;
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 1.0;
- c.weighty = 0;
- c.insets = new Insets(0, 0, 5, 10);
- tfMatchingElementCount = new JTextField();
- tfMatchingElementCount.setEditable(false);
- tfMatchingElementCount.setBorder(null);
- jpTesting.add(tfMatchingElementCount, c);
-
- c.gridx = 0;
- c.gridy++;
- c.gridwidth = 2;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 1.0;
- tpExecutedXPathExpressionResults = new JTabbedPane();
- jpTesting.add(tpExecutedXPathExpressionResults, c);
-
- taExecutedXPathExpressionResultsAsText = new JTextArea();
- taExecutedXPathExpressionResultsAsText.setEditable(false);
- spExecutedXPathExpressionResultsAsText = new JScrollPane(
- taExecutedXPathExpressionResultsAsText);
- spExecutedXPathExpressionResultsAsText.setPreferredSize(new Dimension(
- 200, 60));
- spExecutedXPathExpressionResultsAsText.setBorder(BorderFactory
- .createLineBorder(INACTIVE_PANEL_BACKGROUND_COLOR, 3));
- tpExecutedXPathExpressionResults.add("Results as text",
- spExecutedXPathExpressionResultsAsText);
-
- taExecutedXPathExpressionResultsAsXML = new JTextArea();
- taExecutedXPathExpressionResultsAsXML.setEditable(false);
- spExecutedXPathExpressionResultsAsXML = new JScrollPane(
- taExecutedXPathExpressionResultsAsXML);
- spExecutedXPathExpressionResultsAsXML.setPreferredSize(new Dimension(
- 200, 60));
- spExecutedXPathExpressionResultsAsXML.setBorder(BorderFactory
- .createLineBorder(INACTIVE_PANEL_BACKGROUND_COLOR, 3));
- tpExecutedXPathExpressionResults.add("Results as XML",
- spExecutedXPathExpressionResultsAsXML);
-
- // initialise some values / tooltips
- resetXPathTestingPanel();
-
- return (jpTesting);
- }
-
- protected void parseXML() {
- String xmlData = taSourceXML.getText();
-
- try {
- xmlTree = XPathActivityXMLTree.createFromXMLData(xmlData,
- miIncludeAttributes.isSelected(), miIncludeValues
- .isSelected(), miIncludeNamespaces.isSelected(),
- this);
- xmlTree
- .setToolTipText("<html>This is a tree structure of the XML document that you have pasted.<br><br>"
- + "Clicking on the nodes in this tree will automatically generate a<br>"
- + "corresponding XPath expression. Multiple <b>identical</b> nodes can<br>"
- + "be selected at once - in this case <b>wildcards</b> will be used in the<br>"
- + "generated XPath expression to if selected nodes have different<br>"
- + "ancestors. Other nodes that match the generated XPath expression<br>"
- + "will also be selected in the tree.<br><br>"
- + "Contextual menu provides convenience methods for expanding or<br>"
- + "collapsing the tree." + "</html>");
- xmlTree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- JScrollPane spXMLTree = new JScrollPane(xmlTree);
- spXMLTree.setPreferredSize(spXMLTreePlaceholder.getPreferredSize());
- jpRight.removeAll();
- jpRight.add(spXMLTree);
-
- // all successful - enable options to modify the tree
- this.bShowXMLTreeSettings.setEnabled(true);
-
- // data structures inside the XML tree were reset (as the tree was
- // re-created) -
- // now reset the UI to the initial state as well
- resetXPathEditingPanel();
- resetXPathTestingPanel();
-
- // XML tree has pre-populated the namespace map with the namespaces
- // specified in the
- // root element of the tree - load these values
- updateXPathEditingPanelValues();
-
- this.validate();
- this.repaint();
- } catch (DocumentException e) {
- JOptionPane.showMessageDialog(this, e.getMessage(),
- "XPath Activity", JOptionPane.ERROR_MESSAGE);
- this.taSourceXML.requestFocusInWindow();
- return;
- }
- }
-
- /**
- * Makes the {@link XPathActivityXMLTree} to refresh its UI from the
- * original XML document that was used to create it in first place.
- *
- * The reason for using this method is to apply new options to the way the
- * tree is rendered - e.g. attributes shown/hidden in the tree, values and
- * namespaces shown/hidden, etc.
- */
- protected void refreshXMLTreeUI() {
- this.xmlTree.refreshFromExistingDocument(this.miIncludeAttributes
- .isSelected(), this.miIncludeValues.isSelected(),
- this.miIncludeNamespaces.isSelected());
- }
-
- /**
- * Initialises XPath Editing panel: -- resets XPath expression that is being
- * shown; -- resets local copy of namespace map; -- resets UI of namespace
- * mapping table;
- */
- private void resetXPathEditingPanel() {
- tfXPathExpression.setText("");
- validateXPathAndUpdateUI();
-
- // clear the local copy of namespace map
- xpathNamespaceMap = new HashMap<String, String>();
-
- // clear the namespace mapping table and reload the data from the map
- DefaultTableModel tableModel = (DefaultTableModel) jtXPathNamespaceMappings
- .getModel();
- tableModel.getDataVector().removeAllElements();
- }
-
- /**
- * Initialises XPath testing panel which shows results of executing current
- * XPath expression against the example XML - the panel is returned to the
- * way it looks when it is first loaded.
- */
- private void resetXPathTestingPanel() {
- this.tfExecutedXPathExpression.setText("--");
- this.tfMatchingElementCount.setText("--");
-
- this.taExecutedXPathExpressionResultsAsText.setText("");
- this.taExecutedXPathExpressionResultsAsText
- .setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
-
- this.taExecutedXPathExpressionResultsAsXML.setText("");
- this.taExecutedXPathExpressionResultsAsXML
- .setBackground(INACTIVE_PANEL_BACKGROUND_COLOR);
- }
-
- public void updateXPathEditingPanelValues() {
- if (xmlTree.getCurrentXPathExpression() != null) {
- tfXPathExpression.setText(xmlTree.getCurrentXPathExpression()
- .getText());
- }
-
- // clear the local copy of namespace map and update it with all values
- // from
- // the map in XML tree instance (which was apparently just re-generated
- // on user request)
- xpathNamespaceMap.clear();
- xpathNamespaceMap.putAll(xmlTree.getCurrentXPathNamespaces());
-
- // clear the namespace mapping table and reload the data from the map
- reloadNamespaceMappingTableFromLocalMap();
- }
-
- protected void reloadNamespaceMappingTableFromLocalMap() {
- // clear the namespace mapping table and reload the data from the map
- DefaultTableModel tableModel = (DefaultTableModel) jtXPathNamespaceMappings
- .getModel();
- tableModel.getDataVector().removeAllElements();
- for (Map.Entry<String, String> mapping : this.xpathNamespaceMap
- .entrySet()) {
- tableModel.addRow(new Object[] { mapping.getKey(),
- mapping.getValue() });
- }
-
- bRemoveMapping.setEnabled(this.xpathNamespaceMap.entrySet().size() > 0);
-
- repaint();
- }
-
- private String getXPathValidationErrorMessage() {
- try {
- // try to parse the XPath expression...
- DocumentHelper.createXPath(tfXPathExpression.getText().trim());
- // ...success
- return ("");
- } catch (InvalidXPathException e) {
- // ...failed to parse the XPath expression: notify of the error
- return (e.getMessage());
- }
- }
-
- /**
- * Validates the current XPath expression and updates UI accordingly: --
- * XPath status icon is updated; -- tooltip for the icon explains the
- * status; -- 'Run XPath' button is enabled/disabled depending on validity
- * of XPath expression and existence of example data in the XML tree
- */
- protected void validateXPathAndUpdateUI() {
- String candidatePath = tfXPathExpression.getText();
- int xpathStatus = XPathActivityConfigurationBean
- .validateXPath(candidatePath);
-
- switch (xpathStatus) {
- case XPathActivityConfigurationBean.XPATH_VALID:
- // success: expression is correct
- jlXPathExpressionStatus.setIcon(XPathActivityIcon
- .getIconById(XPathActivityIcon.XPATH_STATUS_OK_ICON));
- jlXPathExpressionStatus
- .setToolTipText("Current XPath expression is well-formed and valid");
-
- // could allow to execute against example XML, with only condition:
- // XML tree must be populated
- // (that is, there should be something to run the expression
- // against)
- if (xmlTree != null) {
- this.bRunXPath.setEnabled(true);
- this.bRunXPath
- .setToolTipText("<html>Evaluate current XPath expression against the XML document<br>"
- + "whose structure is shown in the tree view above.</html>");
- } else {
- this.bRunXPath.setEnabled(false);
- this.bRunXPath
- .setToolTipText("<html>No XML document to evaluate the current XPath expression against.<br><br>"
- + "Paste some example XML into the area in the top-left section of the<br>"
- + "window, then parse it by clicking on the button with the green arrow<br>"
- + "in order to test your XPath expression.</html>");
- }
- break;
-
- case XPathActivityConfigurationBean.XPATH_EMPTY:
- // no XPath expression - can't tell if it is correct + nothing to
- // execute
- jlXPathExpressionStatus.setIcon(XPathActivityIcon
- .getIconById(XPathActivityIcon.XPATH_STATUS_UNKNOWN_ICON));
- jlXPathExpressionStatus
- .setToolTipText("<html>There is no XPath expression to validate.<br><br>"
- + "<b>Hint:</b> select something in the tree view showing the structure<br>"
- + "of the XML document that you have pasted (or type the XPath<br>"
- + "expression manually).</html>");
- this.bRunXPath.setEnabled(false);
- this.bRunXPath.setToolTipText("No XPath expression to execute");
- break;
-
- case XPathActivityConfigurationBean.XPATH_INVALID:
- // failed to parse the XPath expression: notify of the error
- jlXPathExpressionStatus.setIcon(XPathActivityIcon
- .getIconById(XPathActivityIcon.XPATH_STATUS_ERROR_ICON));
- jlXPathExpressionStatus
- .setToolTipText(getXPathValidationErrorMessage());
-
- this.bRunXPath.setEnabled(false);
- this.bRunXPath
- .setToolTipText("Cannot execute invalid XPath expression");
- break;
- }
-
- }
-
- /**
- * Executes the current XPath expression against the current XML tree.
- *
- * @param displayResults
- * <code>true</code> to execute and display results in the XPath
- * activity configuration panel (this happens when the 'Run
- * XPath' button is clicked);<br/>
- * <false> to run the expression quietly and simply return the
- * number of matching nodes.
- * @return Number of nodes in the XML tree that match the current XPath
- * expression. (Or <code>-1</code> if an error has occurred during
- * the execution -- error messages will only be shown if
- * <code>displayResults == true</code>).
- */
- public int runXPath(boolean displayResults) {
- // ----- RUNNING THE XPath EXPRESSION -----
- XPath expr = null;
- try {
- expr = DocumentHelper.createXPath(this.tfXPathExpression.getText());
- expr.setNamespaceURIs(this.xpathNamespaceMap);
- } catch (InvalidXPathException e) {
- if (displayResults) {
- JOptionPane
- .showMessageDialog(
- thisPanel,
- "Incorrect XPath Expression\n\n"
- + "Please check the expression if you have manually modified it;\n"
- + "Alternatively, try to select another node from the XML tree.\n\n"
- + "------------------------------------------------------------------------------------\n\n"
- + "XPath processing library reported the following error:\n"
- + e.getMessage(), "XPath Activity",
- JOptionPane.ERROR_MESSAGE);
- }
- return (-1);
- }
-
- Document doc = xmlTree.getDocumentUsedToPopulateTree();
- List<Node> matchingNodes = null;
- int matchingNodeCount = -1;
- try {
- matchingNodes = expr.selectNodes(doc);
- matchingNodeCount = matchingNodes.size();
- } catch (XPathException e) {
- if (displayResults) {
- JOptionPane
- .showMessageDialog(
- thisPanel,
- "Unexpected error has occurred while executing the XPath expression.\n\n"
- + "If you have manually modified the XPath expression and/or namespace mappings,\n"
- + "please check you changes. Alternatively, make your selection in the XML tree and\n"
- + "a correct XPath expression with corresponding namespace mapping will be generated.\n\n"
- + "-------------------------------------------------------------------------------------------------------------\n\n"
- + "XPath processing library reported the following error:\n"
- + e.getMessage(), "XPath Activity",
- JOptionPane.ERROR_MESSAGE);
- }
- return (-1);
- }
-
- // ----- DISPLAYING THE RESULTS -----
- if (displayResults) {
- tfExecutedXPathExpression.setText(expr.getText());
- tfMatchingElementCount.setText("" + matchingNodeCount);
-
- StringBuffer outNodesText = new StringBuffer();
- StringBuffer outNodesXML = new StringBuffer();
- for (Node n : matchingNodes) {
- if (n.getStringValue() != null
- && n.getStringValue().length() > 0) {
- outNodesText.append(n.getStringValue() + "\n");
- }
- outNodesXML.append(n.asXML() + "\n");
- }
-
- // tpExecutedXPathExpressionResults.setSelectedIndex(0); // open the
- // first tab (should be the one with textual results) // TODO -
- // enable if needed
-
- taExecutedXPathExpressionResultsAsText.setText(outNodesText
- .toString());
- taExecutedXPathExpressionResultsAsText.setBackground(Color.WHITE);
- taExecutedXPathExpressionResultsAsText.setCaretPosition(0);
- spExecutedXPathExpressionResultsAsText.setBorder(BorderFactory
- .createLineBorder(Color.WHITE, 3));
-
- taExecutedXPathExpressionResultsAsXML.setText(outNodesXML
- .toString());
- taExecutedXPathExpressionResultsAsXML.setBackground(Color.WHITE);
- taExecutedXPathExpressionResultsAsXML.setCaretPosition(0);
- spExecutedXPathExpressionResultsAsXML.setBorder(BorderFactory
- .createLineBorder(Color.WHITE, 3));
- }
-
- return (matchingNodeCount);
- }
-
- protected void setSourceXML(String xmlData) {
- this.taSourceXML.setText(xmlData);
- }
-
- protected String getCurrentXPathExpression() {
- return (this.tfXPathExpression.getText().trim());
- }
-
- protected void setCurrentXPathExpression(String xpathExpression) {
- this.tfXPathExpression.setText(xpathExpression);
- }
-
- protected Map<String, String> getCurrentXPathNamespaceMap() {
- return (this.xpathNamespaceMap);
- }
-
- /**
- * This method doesn't simply set a reference to the passed map, but rather
- * performs a shallow copy of values.
- *
- * This is because the method is used during configuration panel's
- * initialisation from the values that are held in the configuration bean.
- * In case of simple reference assignment, any changes made to map in the
- * configuration panel are also taking effect on the same map - referenced
- * from the configuration bean, which leads to undesired behaviour.
- */
- protected void setCurrentXPathNamespaceMapValues(
- Map<String, String> xpathNamespaceMap) {
- this.xpathNamespaceMap.clear();
- this.xpathNamespaceMap.putAll(xpathNamespaceMap);
- }
-
- protected XPathActivityXMLTree getCurrentXMLTree() {
- return (this.xmlTree);
- }
-
- /**
- * For testing
- */
- public static void main(String[] args) {
- JFrame frame = new JFrame();
- frame.getContentPane().add(new XPathActivityConfigurationPanel());
- frame.pack();
- frame.setSize(new Dimension(900, 600));
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
deleted file mode 100644
index dec6f61..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigurationPanelProvider.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config;
-
-import java.awt.BorderLayout;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.swing.BorderFactory;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.activities.xpath.XPathActivityConfigurationBean;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-
-/**
- *
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class XPathActivityConfigurationPanelProvider extends ActivityConfigurationPanel {
-
- private XPathActivityConfigurationPanel configPanel;
- private final ServiceRegistry serviceRegistry;
-
- public XPathActivityConfigurationPanelProvider(Activity activity, ServiceRegistry serviceRegistry) {
- super(activity);
- this.serviceRegistry = serviceRegistry;
- initialise();
- }
-
- @Override
- protected void initialise() {
- super.initialise();
- removeAll();
- setLayout(new BorderLayout());
-
- // create actual contents of the config panel
- this.configPanel = new XPathActivityConfigurationPanel();
- add(configPanel, BorderLayout.CENTER);
-
- // place the whole configuration panel into a raised area, so that
- // automatically added 'Apply' / 'Close' buttons visually apply to
- // the whole of the panel, not just part of it
- this.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createEmptyBorder(12, 12, 2, 12),
- BorderFactory.createRaisedBevelBorder()));
-
- // Populate fields from activity configuration bean
- refreshConfiguration();
- }
-
- /**
- * Prepare a new configuration bean from the UI, to be returned with
- * getConfiguration()
- */
- @Override
- public void noteConfiguration() {
- if (configPanel.getCurrentXMLTree() != null) {
- setProperty("exampleXmlDocument", configPanel.getCurrentXMLTree()
- .getDocumentUsedToPopulateTree().asXML());
- }
- setProperty("xpathExpression", configPanel.getCurrentXPathExpression());
-
- Map<String, String> xPathNamespaceMap = configPanel.getCurrentXPathNamespaceMap();
- if (xPathNamespaceMap.isEmpty()) {
- json.remove("xpathNamespaceMap");
- } else {
- ArrayNode namespaceMapNode = json.arrayNode();
- for (Entry<String, String> namespaceMapping : xPathNamespaceMap.entrySet()) {
- namespaceMapNode.addObject().put("prefix", namespaceMapping.getKey()).put("uri", namespaceMapping.getValue());
- }
- json.set("xpathNamespaceMap", namespaceMapNode);
- }
-
- configureInputPorts(serviceRegistry);
- configureOutputPorts(serviceRegistry);
-}
-
- /**
- * Check that user values in the UI are valid.
- */
- @Override
- public boolean checkValues() {
- // the only validity condition is the correctness of the XPath
- // expression -- so checking that
- int xpathExpressionStatus = XPathActivityConfigurationBean.validateXPath(this.configPanel
- .getCurrentXPathExpression());
-
- // show an explicit warning message to explain the problem
- if (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_EMPTY) {
- JOptionPane.showMessageDialog(this, "XPath expression should not be empty",
- "XPath Activity", JOptionPane.WARNING_MESSAGE);
- } else if (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_INVALID) {
- JOptionPane.showMessageDialog(this,
- "<html><center>XPath expression is invalid - hover the mouse over the XPath status<br>"
- + "icon to get more information</center></html>", "XPath Activity",
- JOptionPane.WARNING_MESSAGE);
- }
-
- return (xpathExpressionStatus == XPathActivityConfigurationBean.XPATH_VALID);
- }
-
- /**
- * Update GUI from a changed configuration bean (perhaps by undo / redo).
- */
- @Override
- public void refreshConfiguration() {
- if (json.has("exampleXmlDocument")) {
- configPanel.setSourceXML(getProperty("exampleXmlDocument"));
- configPanel.parseXML();
- }
-
- configPanel.setCurrentXPathExpression(getProperty("xpathExpression"));
-
- Map<String, String> xpathNamespaceMap = new HashMap<>();
- if (json.has("xpathNamespaceMap")) {
- for (JsonNode namespaceMapping : json.get("xpathNamespaceMap")) {
- xpathNamespaceMap.put(namespaceMapping.get("prefix").asText(), namespaceMapping.get("uri").asText());
- }
- }
- configPanel.setCurrentXPathNamespaceMapValues(xpathNamespaceMap);
- configPanel.reloadNamespaceMappingTableFromLocalMap();
-
- // if the XML tree was populated, (re-)run the XPath expression
- // and restore selection of nodes in the tree, if possible
- if (configPanel.getCurrentXMLTree() != null) {
- configPanel.runXPath(true);
-
- // convert the XPath expression into the required list form;
- // discard the first 'leg', as it's a side effect of
- // "String.split()" -
- // non-existent string to the left of the first "/"
- String[] xpathLegs = getProperty("xpathExpression").split("/");
- List<String> xpathLegList = new ArrayList<String>();
- for (int i = 1; i < xpathLegs.length; i++) {
- xpathLegList.add("/" + xpathLegs[i]);
- }
-
- // if nothing was obtained, we should be looking at the root node -
- // but add the actual expression as it was, just in case
- if (xpathLegList.size() == 0) {
- xpathLegList.add(configPanel.getCurrentXPathExpression());
- }
-
- // invoke selection handler of the XML tree to do the job
- configPanel.getCurrentXMLTree().getXMLTreeSelectionHandler()
- .selectAllNodesThatMatchTheCurrentXPath(xpathLegList, null);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigureAction.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigureAction.java
deleted file mode 100644
index 3bdc74c..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/XPathActivityConfigureAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class XPathActivityConfigureAction extends ActivityConfigurationAction {
-
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ServiceRegistry serviceRegistry;
-
- public XPathActivityConfigureAction(Activity activity, Frame owner,
- EditManager editManager, FileManager fileManager,
- ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.serviceRegistry = serviceRegistry;
- }
-
- public void actionPerformed(ActionEvent e) {
- ActivityConfigurationDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
-
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
-
- XPathActivityConfigurationPanelProvider panel = new XPathActivityConfigurationPanelProvider(
- getActivity(), serviceRegistry);
- ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(
- getActivity(), panel, editManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/TableCellListener.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/TableCellListener.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/TableCellListener.java
deleted file mode 100644
index 872fd70..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/TableCellListener.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import java.awt.event.*;
-import javax.swing.*;
-import java.beans.*;
-
-/**
- * This class listens for changes made to the data in the table via the
- * TableCellEditor. When editing is started, the value of the cell is saved
- * When editing is stopped the new value is saved. When the oold and new
- * values are different, then the provided Action is invoked.
- *
- * The source of the Action is a TableCellListener instance.
- *
- * TODO: update to work with Java 1.6, when Taverna is migrated to that version
- * (see the next TODO tag - this is where the change needs to be made)
- *
- * @author Robert Camick
- *
- * @see <a href="http://tips4java.wordpress.com/2009/06/07/table-cell-listener/">http://tips4java.wordpress.com/2009/06/07/table-cell-listener/</a>
- * @see <a href="http://www.camick.com/java/source/TableCellListener.java">http://www.camick.com/java/source/TableCellListener.java</a>
- */
-public class TableCellListener implements PropertyChangeListener, Runnable
-{
- private JTable table;
- private Action action;
-
- private int row;
- private int column;
- private Object oldValue;
- private Object newValue;
-
- /**
- * Create a TableCellListener.
- *
- * @param table the table to be monitored for data changes
- * @param action the Action to invoke when cell data is changed
- */
- public TableCellListener(JTable table, Action action)
- {
- this.table = table;
- this.action = action;
- this.table.addPropertyChangeListener( this );
- }
-
- /**
- * Create a TableCellListener with a copy of all the data relevant to
- * the change of data for a given cell.
- *
- * @param row the row of the changed cell
- * @param column the column of the changed cell
- * @param oldValue the old data of the changed cell
- * @param newValue the new data of the changed cell
- */
- private TableCellListener(JTable table, int row, int column, Object oldValue, Object newValue)
- {
- this.table = table;
- this.row = row;
- this.column = column;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- /**
- * Get the column that was last edited - value as in table model, not in the UI
- *
- * @return the column that was edited
- */
- public int getColumn()
- {
- return column;
- }
-
- /**
- * Get the new value in the cell
- *
- * @return the new value in the cell
- */
- public Object getNewValue()
- {
- return newValue;
- }
-
- /**
- * Get the old value of the cell
- *
- * @return the old value of the cell
- */
- public Object getOldValue()
- {
- return oldValue;
- }
-
- /**
- * Get the row that was last edited - value as in table model, not in the UI
- *
- * @return the row that was edited
- */
- public int getRow()
- {
- return row;
- }
-
- /**
- * Get the table of the cell that was changed
- *
- * @return the table of the cell that was changed
- */
- public JTable getTable()
- {
- return table;
- }
-
- //
- // Implement the PropertyChangeListener interface
- //
- public void propertyChange(PropertyChangeEvent e)
- {
- // A cell has started/stopped editing
-
- if ("tableCellEditor".equals(e.getPropertyName()))
- {
- if (table.isEditing())
- processEditingStarted();
- else
- processEditingStopped();
- }
- }
-
- /*
- * Save information of the cell about to be edited
- */
- private void processEditingStarted()
- {
- // The invokeLater is necessary because the editing row and editing
- // column of the table have not been set when the "tableCellEditor"
- // PropertyChangeEvent is fired.
- // This results in the "run" method being invoked
-
- SwingUtilities.invokeLater( this );
- }
-
- /*
- * See above.
- */
- public void run()
- {
-// TODO - the next line is a correct implementation for Java 1.6
-// row = table.convertRowIndexToModel( table.getEditingRow() );
-
-// in Java 1.5 which is currently used, tables are not easily sortable
-// (and that is the case for the XPath Activity, where this class is used) --
-// hence, row numbers in the view and in the model will always be identical
-// --> HACK: just use the row number from the view...
- row = table.getEditingRow();
-
- column = table.convertColumnIndexToModel( table.getEditingColumn() );
- oldValue = table.getModel().getValueAt(row, column);
- newValue = null;
- }
-
- /*
- * Update the Cell history when necessary
- */
- private void processEditingStopped()
- {
- newValue = table.getModel().getValueAt(row, column);
-
- // The data has changed, invoke the supplied Action
-
- if (! newValue.equals(oldValue))
- {
- // Make a copy of the data in case another cell starts editing
- // while processing this change
-
- TableCellListener tcl = new TableCellListener(
- getTable(), getRow(), getColumn(), getOldValue(), getNewValue());
-
- ActionEvent event = new ActionEvent(
- tcl,
- ActionEvent.ACTION_PERFORMED,
- "");
- action.actionPerformed(event);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
deleted file mode 100644
index 4f98851..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTree.java
+++ /dev/null
@@ -1,572 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JTree;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.text.Position;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.activities.xpath.ui.config.XPathActivityConfigurationPanel;
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathActivityIcon;
-
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
-import org.dom4j.Element;
-import org.dom4j.Namespace;
-import org.dom4j.QName;
-import org.dom4j.XPath;
-
-
-/**
- *
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityXMLTree extends JTree
-{
- private XPathActivityXMLTree instanceOfSelf;
- private XPathActivityXMLTreeRenderer treeRenderer;
-
- private JPopupMenu contextualMenu;
-
- private TreeSelectionListener[] allSelectionListeners;
- private XPathActivityXMLTreeSelectionHandler xmlTreeSelectionHandler;
-
- /**
- *
- */
- private XPathActivityConfigurationPanel parentConfigPanel;
-
- private Document documentUsedToPopulateTree;
-
- /**
- * holds value of the current XPath expression obtained from
- * the combination of nodes selected in the XML tree
- */
- private XPath currentXPathExpression;
-
- private Map<String,String> currentXPathNamespaces;
-
-
-
- private XPathActivityXMLTree(XPathActivityXMLTreeNode root, Document documentUsedToPopulateTree,
- boolean bIncludeElementValues, boolean bIncludeElementNamespaces, XPathActivityConfigurationPanel parentConfigPanel)
- {
- super(root);
-
- this.instanceOfSelf = this;
- this.allSelectionListeners = new TreeSelectionListener[0];
-
- this.parentConfigPanel = parentConfigPanel;
-
- this.documentUsedToPopulateTree = documentUsedToPopulateTree;
- this.currentXPathExpression = null;
- this.currentXPathNamespaces = new HashMap<String,String>();
- this.prepopulateNamespaceMap();
-
-
- // custom renderer of the nodes in the XML tree
- this.treeRenderer = new XPathActivityXMLTreeRenderer(bIncludeElementValues, bIncludeElementNamespaces);
- this.setCellRenderer(treeRenderer);
-
-
- // add listener to handle various selections of nodes in the tree
- this.xmlTreeSelectionHandler = new XPathActivityXMLTreeSelectionHandler(parentConfigPanel, this);
- this.addTreeSelectionListener(xmlTreeSelectionHandler);
-
-
- // --- CONTEXTUAL MENU FOR EXPANDING / COLLAPSING THE TREE ---
-
- // create popup menu for expanding / collapsing all nodes in the tree
- JMenuItem miExpandAll = new JMenuItem("Expand all", XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_EXPAND_ALL_ICON));
- miExpandAll.setToolTipText("Expand all nodes in the filtering tree");
- miExpandAll.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- for (int i = 0; i < getRowCount(); i++) {
- instanceOfSelf.expandRow(i);
- }
- }
- });
- JMenuItem miCollapseAll = new JMenuItem("Collapse all", XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_COLLAPSE_ALL_ICON));
- miCollapseAll.setToolTipText("Collapse all expanded nodes in the filtering tree");
- miCollapseAll.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- for (int i = getRowCount() - 1; i >= 0; i--) {
- instanceOfSelf.collapseRow(i);
- }
- }
- });
-
- // populate the popup menu with created menu items
- contextualMenu = new JPopupMenu();
- contextualMenu.add(miExpandAll);
- contextualMenu.add(miCollapseAll);
-
- // mouse events may cause the contextual menu to be shown - adding a listener
- this.addMouseListener(new MouseAdapter()
- {
- public void mousePressed(MouseEvent e) {
- if (e.isPopupTrigger()) {
- contextualMenu.show(instanceOfSelf, e.getX(), e.getY());
- }
- }
- public void mouseReleased(MouseEvent e) {
- if (e.isPopupTrigger()) {
- // another way a popup menu may be called on different systems
- contextualMenu.show(instanceOfSelf, e.getX(), e.getY());
- }
- }
- });
-
- }
-
-
- /**
- * Pre-populates namespace map with the namespaced declared in the root
- * node of the XML document, which was used to populate the tree.
- */
- private void prepopulateNamespaceMap()
- {
- Document doc = this.getDocumentUsedToPopulateTree();
- Element root = doc.getRootElement();
-
- // get opening tag of the root node
- String rootAsXML = root.asXML().substring(0, root.asXML().indexOf(">"));
-
- // split the opening tag into tokens (all attributes are separated by a space)
- String[] rootTokens = rootAsXML.split(" ");
-
- // for each attribute check if that's a namespace declaration
- for (String token : rootTokens) {
- if (token.startsWith("xmlns"))
- {
- String[] namespacePrefixAndURI = token.split("=");
-
- // a prefix is either given explicitly, or an empty one will be used
- String prefix = namespacePrefixAndURI[0].indexOf(":") == -1 ?
- "" :
- namespacePrefixAndURI[0].split(":")[1];
-
- // URI is the value of the XML attribute, so need to strip out surrounding quotes
- String URI = namespacePrefixAndURI[1].replaceAll("\"", "");
-
- // now add the details of the current namespace to the map
- this.addNamespaceToXPathMap(new Namespace(prefix, URI));
- }
- }
- }
-
-
- protected XPathActivityConfigurationPanel getParentConfigPanel() {
- return parentConfigPanel;
- }
-
- public XPathActivityXMLTreeSelectionHandler getXMLTreeSelectionHandler() {
- return xmlTreeSelectionHandler;
- }
-
- public Document getDocumentUsedToPopulateTree() {
- return documentUsedToPopulateTree;
- }
-
- public XPath getCurrentXPathExpression() {
- return currentXPathExpression;
- }
- protected void setCurrentXPathExpression(XPath xpathExpression) {
- this.currentXPathExpression = xpathExpression;
- }
-
-
- public Map<String,String> getCurrentXPathNamespaces() {
- return currentXPathNamespaces;
- }
-
-
-
- protected void removeAllSelectionListeners()
- {
- this.allSelectionListeners = this.getTreeSelectionListeners();
- for (TreeSelectionListener listener : this.allSelectionListeners) {
- this.removeTreeSelectionListener(listener);
- }
- }
-
- protected void restoreAllSelectionListeners()
- {
- for (TreeSelectionListener listener : this.allSelectionListeners) {
- this.addTreeSelectionListener(listener);
- }
- }
-
-
-
- /**
- * Creates an instance of the XML tree from provided XML data.
- *
- * @param xmlData XML document in the form of a <code>String</code> to
- * derive the tree from.
- * @param bIncludeAttributesIntoTree
- * @param bIncludeValuesIntoTree
- * @param bIncludeElementNamespacesIntoTree
- * @param parentConfigPanel
- * @return
- * @throws DocumentException if <code>xmlData</code> does not
- * contain a valid XML document.
- *
- */
- public static XPathActivityXMLTree createFromXMLData(String xmlData, boolean bIncludeAttributesIntoTree,
- boolean bIncludeValuesIntoTree, boolean bIncludeElementNamespacesIntoTree,
- XPathActivityConfigurationPanel parentConfigPanel) throws DocumentException
- {
- // ----- XML DOCUMENT PARSING -----
- // try to parse the XML document - the next line will throw an exception if
- // the document is not well-formed; proceed otherwise
- Document doc = DocumentHelper.parseText(xmlData);
- Element rootElement = doc.getRootElement();
-
-
- // ----- POPULATE XML TREE -----
- XPathActivityXMLTreeElementNode rootNode = new XPathActivityXMLTreeElementNode(rootElement);
- populate(rootNode, rootElement, bIncludeAttributesIntoTree);
-
- return (new XPathActivityXMLTree(rootNode, doc, bIncludeValuesIntoTree, bIncludeElementNamespacesIntoTree, parentConfigPanel));
- }
-
-
- /**
- * Worker method for populating the tree recursively from a list of Elements.
- *
- * @param node
- * @param element
- */
- private static void populate(DefaultMutableTreeNode node, Element element,
- boolean bIncludeAttributesIntoTree)
- {
- Iterator<Element> elementIterator = element.elements().iterator();
- while (elementIterator.hasNext()) {
- Element childElement = elementIterator.next();
- XPathActivityXMLTreeElementNode childNode = new XPathActivityXMLTreeElementNode(childElement);
- node.add(childNode);
-
- // recursively repeat for all children of the current child element
- populate(childNode, childElement, bIncludeAttributesIntoTree);
- }
-
-
- // add attributes of the element as its children, if necessary
- if (bIncludeAttributesIntoTree) {
- List<Attribute> attributes = element.attributes();
- for (Attribute attribute : attributes) {
- node.add(new XPathActivityXMLTreeAttributeNode(attribute));
- }
- }
- }
-
-
- // ---------------- RESPONDING TO REQUESTS TO CHANGE APPEARANCE OF EXISTING TREE -----------------
-
- /**
- * NB! May be inefficient, as this solution re-generates the whole tree from
- * stored XML document and replaces the root node of itself with a newly
- * generated root node (that will be populated with updated children,
- * according to the new values of options).
- *
- * However, this is a simple solution that will work for now.
- *
- * @param bIncludeAttributes
- * @param bIncludeValues
- * @param bIncludeNamespaces
- */
- public void refreshFromExistingDocument(boolean bIncludeAttributes, boolean bIncludeValues, boolean bIncludeNamespaces)
- {
- this.setEnabled(false);
- removeAllSelectionListeners();
-
- // store expansion and selection state of the XML tree
- // see documentation for restoreExpandedPaths() for more details
- //
- // stored paths to expanded nodes are quite reliable, as paths are recorded;
- // stored selected rows are less reliable, as only indices are kept -- however,
- // the tree is re-created from the same document, so ordering/number of nodes
- // cannot change (apart from attributes that may be added / removed - the attributes
- // appear after other child nodes of some node in the tree, therefore only their
- // selection could be affected)
- HashMap<String,ArrayList<String>> toExpand = new HashMap<String,ArrayList<String>>();
- ArrayList<Integer> toSelect = new ArrayList<Integer>();
- for( int i = 1; i < this.getRowCount(); i++) {
- if( this.isExpanded(i) ) {
- TreePath path = this.getPathForRow(i);
- String parentPath = path.getParentPath().toString();
- ArrayList<String> values = toExpand.get(parentPath);
- if(values == null) {
- values = new ArrayList<String>();
- }
- values.add(path.getLastPathComponent().toString());
- toExpand.put(parentPath, values);
- }
- if (this.isRowSelected(i)) {
- toSelect.add(i);
- }
- }
-
-
- // update presentation options
- this.treeRenderer.setIncludeElementValues(bIncludeValues);
- this.treeRenderer.setIncludeElementNamespaces(bIncludeNamespaces);
-
- // re-create the root node of the tree and replace the old one with it
- Element rootElement = this.documentUsedToPopulateTree.getRootElement();
- XPathActivityXMLTreeNode newRootNode = new XPathActivityXMLTreeElementNode(rootElement);
- populate(newRootNode, rootElement, bIncludeAttributes);
- ((DefaultTreeModel)this.getModel()).setRoot(newRootNode);
-
-
- // restore previous state of the tree from saved values
- restoreExpandedPaths(toExpand, this.getPathForRow(0));
- restoreSelectedPaths(toSelect);
-
- this.restoreAllSelectionListeners();
- this.setEnabled(true);
- }
-
-
- /**
- * This method can only reliably work when the tree is re-generated from the same
- * XML document, so that number / order of nodes would not change.
- *
- * @param toSelect List of indices of rows to re-select after tree was re-generated.
- */
- private void restoreSelectedPaths(ArrayList<Integer> toSelect)
- {
- if (toSelect == null || toSelect.isEmpty()) return;
-
- // something definitely needs to be selected, so include root element into selection
- this.addSelectionRow(0);
-
- // select all stored rows
- for (Integer value : toSelect) {
- this.addSelectionRow(value);
- }
- }
-
-
-
- /**
- * Taken from: <a href="http://java.itags.org/java-core-gui-apis/58504/">http://java.itags.org/java-core-gui-apis/58504/</a>
- *
- * This method recursively expands all previously stored paths.
- * Works under assumption that the name of the root node did not change.
- * Otherwise, it can handle changed structure of the tree.
- *
- * To achieve its goal, it cannot simply use stored TreePath from your the original tree,
- * since the paths are invalid after the tree is refreshed. Instead, a HashMap which links
- * a String representation of the parent tree path to all expanded child node names is used.
- *
- * @param toExpand Map which links a String representation of the parent tree path to all
- * expanded child node names is used.
- * @param rootPath Path to root node.
- */
- void restoreExpandedPaths(HashMap<String,ArrayList<String>> toExpand, TreePath rootPath)
- {
- ArrayList<String> values = toExpand.remove(rootPath.toString());
- if (values == null) return;
-
- int row = this.getRowForPath(rootPath);
- for (String value : values)
- {
- TreePath nextMatch = this.getNextMatch(value, row, Position.Bias.Forward);
- this.expandPath(nextMatch);
- if (toExpand.containsKey(nextMatch.toString())) {
- restoreExpandedPaths(toExpand, nextMatch);
- }
- }
- }
-
-
-
- // ---------------- TREE SELECTION MODEL + XPath GENERATION -----------------
-
-
- protected String generateXPathFromTreePath(TreePath path)
- {
- StringBuilder xpath = new StringBuilder();
-
- for (String leg : generateXPathFromTreePathAsLegList(path)) {
- xpath.append(leg);
- }
-
- return (xpath.toString());
- }
-
-
- protected List<String> generateXPathFromTreePathAsLegList(TreePath path)
- {
- List<String> pathLegs = new LinkedList<String>();
-
- TreePath parentPath = path;
- for (int i = 0; i < path.getPathCount(); i++)
- {
- XPathActivityXMLTreeNode lastXMLTreeNodeInThisPath = (XPathActivityXMLTreeNode)parentPath.getLastPathComponent();
- pathLegs.add(0, this.getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(lastXMLTreeNodeInThisPath));
-
- parentPath = parentPath.getParentPath();
- }
-
- return (pathLegs);
- }
-
-
- protected String getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(XPathActivityXMLTreeNode node)
- {
- QName qname = node.getNodeQName();
- String effectiveNamespacePrefix = addNamespaceToXPathMap(qname.getNamespace());
-
- return("/" +
- (node.isAttribute() ? "@" : "") +
- (effectiveNamespacePrefix.length() > 0 ? (effectiveNamespacePrefix + ":") : "") +
- qname.getName());
- }
-
-
-
- private String addNamespaceToXPathMap(Namespace namespace)
- {
- // EMTPY PREFIX
- if (namespace.getPrefix().length() == 0) {
- if (namespace.getURI().length() == 0) {
- // DEFAULT NAMESPACE with no URI - nothing to worry about
- return "";
- }
- else {
- // DEFAULT NAMESPACE WITH NO PREFIX, BUT URI IS KNOWN
- return (addNamespaceToXPathMap(new Namespace("default", namespace.getURI())));
- }
- }
-
- // NEW NON-EMPTY PREFIX
- if (!this.currentXPathNamespaces.containsKey(namespace.getPrefix())) {
- this.currentXPathNamespaces.put(namespace.getPrefix(), namespace.getURI());
- return (namespace.getPrefix());
- }
-
- // EXISTING NON-EMPTY PREFIX AND THE SAME URI - NO NEED TO ADD AGAIN
- else if (this.currentXPathNamespaces.get(namespace.getPrefix()).equals(namespace.getURI())) {
- return (namespace.getPrefix());
- }
-
- // EXISTING NON-EMPTY PREFIX, BUT DIFFERENT URI
- else {
- String repeatedPrefix = namespace.getPrefix();
-
- int i = 0;
- while (this.currentXPathNamespaces.containsKey(repeatedPrefix + i)) {
- // check if current alternative prefix wasn't yet applied to current URI
- if (this.currentXPathNamespaces.get(repeatedPrefix + i).equals(namespace.getURI())) {
- return (repeatedPrefix + i);
- }
- else {
- // still another URI for the same prefix, keep trying to increase the ID in the prefix
- i++;
- }
- }
-
- String modifiedPrefix = repeatedPrefix + i;
- this.currentXPathNamespaces.put(modifiedPrefix, namespace.getURI());
- return (modifiedPrefix);
- }
- }
-
-
- // ----------------------- Tree Cell Renderer --------------------------
-
- /**
- *
- * @author Sergejs Aleksejevs
- */
- private class XPathActivityXMLTreeRenderer extends DefaultTreeCellRenderer
- {
- private boolean bIncludeElementValues;
- private boolean bIncludeElementNamespaces;
-
- public XPathActivityXMLTreeRenderer(boolean bIncludeElementValues, boolean bIncludeElementNamespaces) {
- super();
- this.bIncludeElementValues = bIncludeElementValues;
- this.bIncludeElementNamespaces = bIncludeElementNamespaces;
- }
-
-
- public boolean getIncludeElementValues() {
- return bIncludeElementValues;
- }
- public void setIncludeElementValues(boolean bIncludeElementValues) {
- this.bIncludeElementValues = bIncludeElementValues;
- }
-
- public boolean getIncludeElementNamespaces() {
- return bIncludeElementNamespaces;
- }
- public void setIncludeElementNamespaces(boolean bIncludeElementNamespaces) {
- this.bIncludeElementNamespaces = bIncludeElementNamespaces;
- }
-
-
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean selected, boolean expanded, boolean leaf, int row,
- boolean hasFocus)
- {
- // obtain the default rendering, we'll then customize it
- Component defaultRendering = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
-
- // it is most likely that the default rendering will be a JLabel, check just to be safe
- if (defaultRendering instanceof JLabel)
- {
- JLabel defaultRenderedLabel = ((JLabel)defaultRendering);
-
- // ---------- CHOOSE APPROPRIATE ICON FOR THE NODE ------------
- if (row == 0) {
- // set the icon for the XML tree root node
- defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_ROOT_ICON));
- }
- else {
- // set the icon for the XML tree node
- if (value instanceof XPathActivityXMLTreeNode &&
- ((XPathActivityXMLTreeNode)value).isAttribute())
- {
- defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_ATTRIBUTE_ICON));
- }
- else {
- defaultRenderedLabel.setIcon(XPathActivityIcon.getIconById(XPathActivityIcon.XML_TREE_NODE_ICON));
- }
- }
-
-
- // ----------- CHOOSE THE DISPLAY TITLE FOR THE NODE ------------
- if (value instanceof XPathActivityXMLTreeNode) {
- defaultRenderedLabel.setText(((XPathActivityXMLTreeNode)value).getTreeNodeDisplayLabel(
- this.bIncludeElementValues, this.bIncludeElementNamespaces, true));
- }
- }
-
- return (defaultRendering);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
deleted file mode 100644
index d22623f..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeAttributeNode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import org.dom4j.Attribute;
-
-/**
- *
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityXMLTreeAttributeNode extends XPathActivityXMLTreeNode
-{
- private Attribute associatedAttribute;
-
- public XPathActivityXMLTreeAttributeNode(Attribute associatedAttribute) {
- super(associatedAttribute, true);
- this.associatedAttribute = associatedAttribute;
- }
-
- public Attribute getAssociatedAttribute() {
- return associatedAttribute;
- }
-
- public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bUseStyling)
- {
- StringBuilder label = new StringBuilder();
-
- // add qualified attribute name (possibly) with styling
- label.append((bUseStyling ? "<font color=\"purple\">" : "") +
- this.associatedAttribute.getQualifiedName() +
- (bUseStyling ? "</font>" : ""));
-
- // add attribute value
- if (bIncludeValue)
- {
- String attributeTextValue = this.associatedAttribute.getText();
-
- if (attributeTextValue != null && attributeTextValue.length() > 0) {
- label.append((bUseStyling ? "<font color=\"gray\"> - </font><font color=\"green\">" : "") +
- truncateElementTextValue(stripAllHTML(attributeTextValue)) +
- (bUseStyling ? "</font>" : ""));
- }
- }
-
- if (bUseStyling) {
- label.insert(0, "<html>");
- label.append("</html>");
- }
-
- return (label.toString());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
deleted file mode 100644
index a151753..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeElementNode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import org.dom4j.Element;
-import org.dom4j.Namespace;
-
-
-/**
- *
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityXMLTreeElementNode extends XPathActivityXMLTreeNode
-{
- private Element associatedElement;
-
- public XPathActivityXMLTreeElementNode(Element associatedElement) {
- super(associatedElement, false);
- this.associatedElement = associatedElement;
- }
-
- public Element getAssociatedElement() {
- return associatedElement;
- }
-
- public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bIncludeNamespace, boolean bUseStyling)
- {
- StringBuilder label = new StringBuilder();
-
- // add qualified element name
- label.append(this.associatedElement.getQualifiedName());
-
- // add element namespace
- if (bIncludeNamespace)
- {
- Namespace ns = this.associatedElement.getNamespace();
-
- label.append((bUseStyling ? "<font color=\"gray\">" : "") +
- " - xmlns" + (ns.getPrefix().length() > 0 ? (":" + ns.getPrefix()) : "") + "=\"" +
- this.associatedElement.getNamespaceURI() +
- (bUseStyling ? "\"</font>" : ""));
- }
-
- // add element value
- if (bIncludeValue)
- {
- String elementTextValue = this.associatedElement.getTextTrim();
-
- if (elementTextValue != null && elementTextValue.length() > 0) {
- label.append((bUseStyling ? "<font color=\"gray\"> - </font><font color=\"blue\">" : "") +
- truncateElementTextValue(stripAllHTML(elementTextValue)) +
- (bUseStyling ? "</font>" : ""));
- }
- }
-
- if (bUseStyling) {
- label.insert(0, "<html>");
- label.append("</html>");
- }
-
- return (label.toString());
- }
-
-}
\ No newline at end of file
[11/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
new file mode 100644
index 0000000..a51e783
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.view;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class RESTActivityMainContextViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public boolean canHandle(Object selection) {
+ return selection instanceof Activity
+ && ((Activity) selection).getType()
+ .equals(GenericRESTTemplateService.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity selection) {
+ return Arrays.<ContextualView> asList(new RESTActivityMainContextualView(selection,
+ editManager, fileManager, activityIconManager, colourManager,
+ serviceDescriptionRegistry, serviceRegistry));
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java
new file mode 100644
index 0000000..3bab024
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java
@@ -0,0 +1,239 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.rest.ui.view;
+
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import org.apache.taverna.activities.rest.RESTActivity;
+import org.apache.taverna.activities.rest.RESTActivity.HTTP_METHOD;
+import org.apache.taverna.activities.rest.RESTActivityConfigurationBean;
+import org.apache.taverna.activities.rest.ui.config.RESTActivityConfigureAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+@SuppressWarnings("serial")
+public class RESTActivityMainContextualView extends ContextualView {
+
+ private final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ private final Activity activity;
+
+ private JPanel jpMainPanel;
+ private JTextField tfHTTPMethod;
+ private JTextArea taURLSignature;
+ private JTextField tfAcceptHeader;
+ private JLabel jlContentType;
+ private JTextField tfContentTypeHeader;
+ private JLabel jlSendDataAs;
+ private JTextField tfSendDataAs;
+ private JLabel jlSendHTTPExpectRequestHeader;
+ private JTextField tfSendHTTPExpectRequestHeader;
+
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+ private final ColourManager colourManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private final ServiceRegistry serviceRegistry;
+
+ public RESTActivityMainContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry,
+ ServiceRegistry serviceRegistry) {
+ this.activity = activity;
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.colourManager = colourManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ this.serviceRegistry = serviceRegistry;
+ initView();
+ }
+
+ @Override
+ public JComponent getMainFrame() {
+ jpMainPanel = new JPanel(new GridBagLayout());
+ jpMainPanel
+ .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2,
+ 4, 2), BorderFactory.createLineBorder(
+ colourManager.getPreferredColour(RESTActivity.class.getCanonicalName()), 2)));
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.anchor = GridBagConstraints.WEST;
+ c.weighty = 0;
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.insets = new Insets(5, 5, 5, 5);
+ JLabel jlHTTPMethod = new JLabel("HTTP Method:");
+ jlHTTPMethod.setFont(jlHTTPMethod.getFont().deriveFont(Font.BOLD));
+ jpMainPanel.add(jlHTTPMethod, c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ tfHTTPMethod = new JTextField();
+ tfHTTPMethod.setEditable(false);
+ jpMainPanel.add(tfHTTPMethod, c);
+ c.weightx = 0;
+
+ c.gridx = 0;
+ c.gridy++;
+ JLabel jlURLSignature = new JLabel("URL Template:");
+ jlURLSignature.setFont(jlURLSignature.getFont().deriveFont(Font.BOLD));
+ jpMainPanel.add(jlURLSignature, c);
+
+ c.gridx++;
+ taURLSignature = new JTextArea(3, 30);
+ taURLSignature.setEditable(false);
+ taURLSignature.setLineWrap(true);
+ JScrollPane spURLSignature = new JScrollPane(taURLSignature);
+ jpMainPanel.add(spURLSignature, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ JLabel jlAcceptHeader = new JLabel("'Accept' header:");
+ jlAcceptHeader.setFont(jlAcceptHeader.getFont().deriveFont(Font.BOLD));
+ jpMainPanel.add(jlAcceptHeader, c);
+
+ c.gridx++;
+ tfAcceptHeader = new JTextField();
+ tfAcceptHeader.setEditable(false);
+ jpMainPanel.add(tfAcceptHeader, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ jlContentType = new JLabel("'Content-Type' header:");
+ jlContentType.setFont(jlContentType.getFont().deriveFont(Font.BOLD));
+ jlContentType.setVisible(false);
+ jpMainPanel.add(jlContentType, c);
+
+ c.gridx++;
+ tfContentTypeHeader = new JTextField();
+ tfContentTypeHeader.setEditable(false);
+ tfContentTypeHeader.setVisible(false);
+ jpMainPanel.add(tfContentTypeHeader, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ jlSendDataAs = new JLabel("Send data as:");
+ jlSendDataAs.setFont(jlSendDataAs.getFont().deriveFont(Font.BOLD));
+ jlSendDataAs.setVisible(false);
+ jpMainPanel.add(jlSendDataAs, c);
+
+ c.gridx++;
+ tfSendDataAs = new JTextField();
+ tfSendDataAs.setEditable(false);
+ tfSendDataAs.setVisible(false);
+ jpMainPanel.add(tfSendDataAs, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ jlSendHTTPExpectRequestHeader = new JLabel("Send HTTP 'Expect' header:");
+ jlSendHTTPExpectRequestHeader.setFont(jlSendHTTPExpectRequestHeader.getFont().deriveFont(
+ Font.BOLD));
+ jlSendHTTPExpectRequestHeader.setVisible(false);
+ jpMainPanel.add(jlSendHTTPExpectRequestHeader, c);
+
+ c.gridx++;
+ tfSendHTTPExpectRequestHeader = new JTextField();
+ tfSendHTTPExpectRequestHeader.setEditable(false);
+ tfSendHTTPExpectRequestHeader.setVisible(false);
+ jpMainPanel.add(tfSendHTTPExpectRequestHeader, c);
+
+ // populate the view with values
+ refreshView();
+
+ return jpMainPanel;
+ }
+
+ @Override
+ /**
+ * This is the title of the contextual view - shown in the list of other available
+ * views (even when this contextual view is collapsed).
+ */
+ public String getViewTitle() {
+ return "REST Service Details";
+ }
+
+ /**
+ * Typically called when the activity configuration has changed.
+ */
+ @Override
+ public void refreshView() {
+ Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
+ RESTActivityConfigurationBean configurationBean = new RESTActivityConfigurationBean(configuration.getJson());
+
+ // toggle visibility of the elements that do not always appear
+ HTTP_METHOD httpMethod = configurationBean.getHttpMethod();
+ jlContentType.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ tfContentTypeHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ jlSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ tfSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ jlSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ tfSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT);
+ jpMainPanel.revalidate();
+
+ tfHTTPMethod.setText("" + configurationBean.getHttpMethod());
+ taURLSignature.setText(configurationBean.getUrlSignature());
+ tfAcceptHeader.setText(configurationBean.getAcceptsHeaderValue());
+ tfContentTypeHeader.setText(configurationBean.getContentTypeForUpdates());
+ tfSendDataAs.setText("" + configurationBean.getOutgoingDataFormat());
+ tfSendHTTPExpectRequestHeader.setText("" + configurationBean.getSendHTTPExpectRequestHeader());
+ }
+
+ /**
+ * View position hint
+ */
+ @Override
+ public int getPreferredPosition() {
+ // want to be on top, as it's the main contextual view for this activity
+ return 100;
+ }
+
+ @Override
+ public Action getConfigureAction(final Frame owner) {
+ // "Configure" button appears because of this action being returned
+ return new RESTActivityConfigureAction(activity, owner, editManager, fileManager,
+ activityIconManager, serviceDescriptionRegistry, serviceRegistry);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index a7222c4..0000000
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index a1e5390..0000000
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.rest.ui.view.ConfigureRESTActivityMenuAction
-net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateAction
-net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateMenuAction
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 9440d43..0000000
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.rest.ui.servicedescription.RESTActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 5325bf1..0000000
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
- net.sf.taverna.t2.activities.rest.ui.view.RESTActivityMainContextViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..545e9d8
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..a12b9d2
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+org.apache.taverna.activities.rest.ui.view.ConfigureRESTActivityMenuAction
+org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateAction
+org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateMenuAction
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..8d73b41
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.rest.ui.servicedescription.RESTActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..a9a72e3
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+ org.apache.taverna.activities.rest.ui.view.RESTActivityMainContextViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
index 643d5be..8eab8f0 100644
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
@@ -6,23 +6,23 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="RESTActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="RESTActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="GenericRESTTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="GenericRESTTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="ConfigureRESTActivityMenuAction" auto-export="interfaces" />
<service ref="AddRESTTemplateAction" auto-export="interfaces" />
<service ref="AddRESTTemplateMenuAction" auto-export="interfaces" />
- <service ref="RESTActivityMainContextViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="RESTActivityMainContextViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
index 2b699e7..7df38dc 100644
--- a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
+++ b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
@@ -5,15 +5,15 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="RESTActivityIcon"
- class="net.sf.taverna.t2.activities.rest.ui.servicedescription.RESTActivityIcon">
+ class="org.apache.taverna.activities.rest.ui.servicedescription.RESTActivityIcon">
<property name="colourManager" ref="colourManager" />
</bean>
<bean id="GenericRESTTemplateService"
- class="net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService" />
+ class="org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService" />
<bean id="ConfigureRESTActivityMenuAction"
- class="net.sf.taverna.t2.activities.rest.ui.view.ConfigureRESTActivityMenuAction">
+ class="org.apache.taverna.activities.rest.ui.view.ConfigureRESTActivityMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -21,7 +21,7 @@
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
<bean id="AddRESTTemplateAction"
- class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateAction">
+ class="org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -29,7 +29,7 @@
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
<bean id="AddRESTTemplateMenuAction"
- class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateMenuAction">
+ class="org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -38,7 +38,7 @@
</bean>
<bean id="RESTActivityMainContextViewFactory"
- class="net.sf.taverna.t2.activities.rest.ui.view.RESTActivityMainContextViewFactory">
+ class="org.apache.taverna.activities.rest.ui.view.RESTActivityMainContextViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png
deleted file mode 100644
index 12cd1ae..0000000
Binary files a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt
deleted file mode 100644
index 4f0f0f4..0000000
--- a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-application/atom+xml
-application/http
-application/javascript
-application/json
-application/octet-stream
-application/ogg
-application/pdf
-application/postscript
-application/rdf+xml
-application/sparql-query
-application/sparql-results+xml
-application/vnd.taverna.scufl+xml
-application/vnd.taverna.t2flow+xml
-application/x-gzip
-application/x-rar-compressed
-application/x-shockwave-flash
-application/x-tar
-application/x-www-form-urlencoded
-application/xhtml+xml
-application/xml
-application/zip
-audio/mp4
-audio/mpeg
-audio/mpeg4-generic
-audio/ogg
-audio/vnd.wave
-audio/vorbis
-audio/webm
-audio/x-ms-wma
-image/gif
-image/jpeg
-image/png
-image/svg+xml
-image/tiff
-image/vnd.microsoft.icon
-message/http
-message/rfc822
-multipart/alternative
-multipart/byteranges
-multipart/digest
-multipart/encrypted
-multipart/form-data
-multipart/mixed
-multipart/related
-multipart/signed
-text/css
-text/csv
-text/html
-text/javascript
-text/n3
-text/plain
-text/tab-separated-values
-text/turtle
-text/uri-list
-text/vcard
-text/xml
-video/H264
-video/MPV
-video/mp4
-video/mpeg
-video/mpeg4-generic
-video/ogg
-video/quicktime
-video/webm
-video/x-ms-wmv
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png
deleted file mode 100644
index a4276c2..0000000
Binary files a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png
new file mode 100644
index 0000000..12cd1ae
Binary files /dev/null and b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt
new file mode 100644
index 0000000..4f0f0f4
--- /dev/null
+++ b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt
@@ -0,0 +1,65 @@
+application/atom+xml
+application/http
+application/javascript
+application/json
+application/octet-stream
+application/ogg
+application/pdf
+application/postscript
+application/rdf+xml
+application/sparql-query
+application/sparql-results+xml
+application/vnd.taverna.scufl+xml
+application/vnd.taverna.t2flow+xml
+application/x-gzip
+application/x-rar-compressed
+application/x-shockwave-flash
+application/x-tar
+application/x-www-form-urlencoded
+application/xhtml+xml
+application/xml
+application/zip
+audio/mp4
+audio/mpeg
+audio/mpeg4-generic
+audio/ogg
+audio/vnd.wave
+audio/vorbis
+audio/webm
+audio/x-ms-wma
+image/gif
+image/jpeg
+image/png
+image/svg+xml
+image/tiff
+image/vnd.microsoft.icon
+message/http
+message/rfc822
+multipart/alternative
+multipart/byteranges
+multipart/digest
+multipart/encrypted
+multipart/form-data
+multipart/mixed
+multipart/related
+multipart/signed
+text/css
+text/csv
+text/html
+text/javascript
+text/n3
+text/plain
+text/tab-separated-values
+text/turtle
+text/uri-list
+text/vcard
+text/xml
+video/H264
+video/MPV
+video/mp4
+video/mpeg
+video/mpeg4-generic
+video/ogg
+video/quicktime
+video/webm
+video/x-ms-wmv
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png
----------------------------------------------------------------------
diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png
new file mode 100644
index 0000000..a4276c2
Binary files /dev/null and b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
deleted file mode 100644
index 7ad1052..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportConfigView;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * The configuration action for a SpreadsheetImport activity.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class SpreadsheetImportActivityConfigurationAction extends ActivityConfigurationAction {
-
- private static final String CONFIGURE = "Configure";
-
- private final EditManager editManager;
-
- private final FileManager fileManager;
-
- private final ServiceRegistry serviceRegistry;
-
- public SpreadsheetImportActivityConfigurationAction(Activity activity,
- Frame owner, EditManager editManager, FileManager fileManager,
- ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.serviceRegistry = serviceRegistry;
- putValue(NAME, CONFIGURE);
- }
-
- public void actionPerformed(ActionEvent e) {
- final SpreadsheetImportConfigView spreadsheetConfigView = new SpreadsheetImportConfigView(
- getActivity(), serviceRegistry);
- final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
- spreadsheetConfigView, editManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
deleted file mode 100644
index 82f8436..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.il8n;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Access to a resource bundle containing UI text.
- *
- * @author David Withers
- */
-public class SpreadsheetImportUIText {
- private static final String BUNDLE_NAME = "net.sf.taverna.t2.activities.spreadsheet.iln8.ui-text";
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private SpreadsheetImportUIText() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
deleted file mode 100644
index 1304c31..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action to add a spreadsheet import activity + a wrapping processor to the workflow.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class SpreadsheetImportAddTemplateAction extends AbstractContextualMenuAction {
-
- private static final URI insertSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/insert");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public SpreadsheetImportAddTemplateAction() {
- super(insertSection, 700);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
- }
-
- @Override
- protected Action createAction() {
-
- AbstractAction action = new AbstractAction(
- SpreadsheetImportUIText.getString("SpreadsheetImportAddTemplateAction.addMenu"),
- activityIconManager.iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE)) {
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(serviceDescriptionRegistry
- .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false,
- editManager, menuManager, selectionManager, serviceRegistry);
- }
-
- };
-
- return action;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
deleted file mode 100644
index ecb0cf9..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.spreadsheet.menu;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * An action to add a spreadsheet import activity + a wrapping processor to the workflow.
- *
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class SpreadsheetImportAddTemplateMenuAction extends AbstractMenuAction {
-
- private static final URI ADD_SPREADSHEET_IMPORT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddSpreadsheetImport");
-
- private static final URI INSERT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
- private static String ADD_SPREADSHEET_IMPORT = SpreadsheetImportUIText
- .getString("SpreadsheetImportAddTemplateAction.addMenu");
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public SpreadsheetImportAddTemplateMenuAction() {
- super(INSERT, 700, ADD_SPREADSHEET_IMPORT_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddSpreadsheetImportMenuAction();
- }
-
- protected class AddSpreadsheetImportMenuAction extends AbstractAction implements
- DesignOnlyAction {
- AddSpreadsheetImportMenuAction() {
- super();
- putValue(SMALL_ICON,
- activityIconManager
- .iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE));
- putValue(NAME, ADD_SPREADSHEET_IMPORT);
- putValue(SHORT_DESCRIPTION, ADD_SPREADSHEET_IMPORT);
- putValue(
- Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.SHIFT_DOWN_MASK
- | InputEvent.ALT_DOWN_MASK));
-
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(serviceDescriptionRegistry
- .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false,
- editManager, menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
deleted file mode 100644
index 1bbaa05..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.menu;
-
-import javax.swing.Action;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-import net.sf.taverna.t2.activities.spreadsheet.actions.SpreadsheetImportActivityConfigurationAction;
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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;
-
-/**
- * Menu action for SpreadsheetImport activity configuration.
- *
- * @author David Withers
- */
-public class SpreadsheetImportConfigureMenuAction extends AbstractConfigureActivityMenuAction {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public SpreadsheetImportConfigureMenuAction() {
- super(SpreadsheetImportTemplateService.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- Action result = new SpreadsheetImportActivityConfigurationAction(findActivity(),
- getParentFrame(), editManager, fileManager, activityIconManager,
- serviceDescriptionRegistry, serviceRegistry);
- result.putValue(Action.NAME, SpreadsheetImportUIText
- .getString("SpreadsheetImportConfigureMenuAction.configureMenu"));
- addMenuDots(result);
- return result;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
deleted file mode 100644
index 1987364..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.servicedescriptions;
-
-import java.awt.Color;
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-/**
- * UI icon for the SpreadsheetImport Activity.
- *
- * @author David Withers
- */
-public class SpreadsheetImportActivityIcon implements ActivityIconSPI {
-
- public static final String SPREADSHEET_COLOUR_HTML = "#40e0d0";
- public static final Color SPREADSHEET_COLOUR = Color.decode(SPREADSHEET_COLOUR_HTML);
-
- private static Icon icon = null;
-
- @Override
- public int canProvideIconScore(URI activityType) {
- if (SpreadsheetImportTemplateService.ACTIVITY_TYPE.equals(activityType))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- @Override
- public Icon getIcon(URI activityType) {
- return getSpreadsheetImportIcon();
- }
-
- public static Icon getSpreadsheetImportIcon() {
- if (icon == null) {
- icon = new ImageIcon(
- SpreadsheetImportActivityIcon.class.getResource("/spreadsheet-import.png"));
- }
- return icon;
- }
-
- public void setColourManager(ColourManager colourManager) {
- colourManager.setPreferredColour(
- "http://ns.taverna.org.uk/2010/activity/spreadsheet-import",
- SPREADSHEET_COLOUR);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
deleted file mode 100644
index f03d852..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * Definition of the SpreadsheetImport spreadsheet import template service.
- *
- * @author David Withers
- */
-public class SpreadsheetImportTemplateService extends AbstractTemplateService {
-
- public static final URI ACTIVITY_TYPE = URI
- .create("http://ns.taverna.org.uk/2010/activity/spreadsheet-import");
-
- private static final String SERVICE_NAME = SpreadsheetImportUIText
- .getString("SpreadsheetImportTemplateService.serviceName");
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/spreadsheet");
-
- public String getName() {
- return SERVICE_NAME;
- }
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- ObjectNode json = (ObjectNode) configuration.getJson();
- json.put("columnRange", json.objectNode().put("start", 0).put("end", 1));
- json.put("rowRange", json.objectNode().put("start", 0).put("end", -1));
- json.put("emptyCellValue", "");
- json.put("allRows", true);
- json.put("excludeFirstRow", false);
- json.put("ignoreBlankRows", false);
- json.put("emptyCellPolicy", "EMPTY_STRING");
- json.put("outputFormat", "PORT_PER_COLUMN");
- json.put("csvDelimiter", ",");
- return configuration;
- }
-
- @Override
- public Icon getIcon() {
- return SpreadsheetImportActivityIcon.getSpreadsheetImportIcon();
- }
-
- @Override
- public String getDescription() {
- return SpreadsheetImportUIText
- .getString("SpreadsheetImportTemplateService.serviceDescription");
- }
-
- public static ServiceDescription getServiceDescription() {
- SpreadsheetImportTemplateService bts = new SpreadsheetImportTemplateService();
- return bts.templateService;
- }
-
- public String getId() {
- return providerId.toString();
- }
-
- @Override
- public ServiceDescriptionProvider newInstance() {
- return new SpreadsheetImportTemplateService();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
deleted file mode 100644
index 81e5381..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 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.spreadsheet.views;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.table.AbstractTableModel;
-
-import org.apache.taverna.activities.spreadsheet.SpreadsheetUtils;
-import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText;
-
-/**
- * TableModel for mapping column labels to port names.
- * <p>
- * The default mapping is for the port name to be the same as the column label. The
- * columnToPortMapping only contains entries for port names that are not the same as the column
- * label.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class SpreadsheetImportConfigTableModel extends AbstractTableModel {
-
- private Map<String, String> columnToPortMapping;
-
- private int fromColumn, toColumn;
-
- /**
- * Constructs a TableModel that maps column labels to port names for the specified range of
- * columns.
- *
- * @param fromColumn
- * the start of the column range
- * @param toColumn
- * the end of the column range
- * @param columnToPortMapping
- * existing column to port mappings (can be null)
- */
- public SpreadsheetImportConfigTableModel(String fromColumn, String toColumn,
- Map<String, String> columnToPortMapping) {
- if (columnToPortMapping == null) {
- this.columnToPortMapping = new HashMap<String, String>();
- } else {
- this.columnToPortMapping = new HashMap<String, String>(columnToPortMapping);
- }
- this.fromColumn = SpreadsheetUtils.getColumnIndex(fromColumn);
- this.toColumn = SpreadsheetUtils.getColumnIndex(toColumn);
- }
-
- /**
- * Sets the start of the column range.
- *
- * @param fromColumn
- * the start of the column range
- */
- public void setFromColumn(int fromColumn) {
- if (this.fromColumn != fromColumn) {
- this.fromColumn = fromColumn;
- fireTableStructureChanged();
- }
- }
-
- /**
- * Sets the end of the column range.
- *
- * @param toColumn
- * the end of the column range
- */
- public void setToColumn(int toColumn) {
- if (this.toColumn != toColumn) {
- this.toColumn = toColumn;
- fireTableStructureChanged();
- }
- }
-
- /**
- * Returns the port name for the given column label.
- * <p>
- * If the columnLabel is the columnToPortMapping the value is returned; otherwise the
- * columnLabel is returned.
- *
- * @param columnLabel
- * the column to find the port name for
- * @return the port name for the given column label
- */
- public String getPortName(String columnLabel) {
- String portName;
- if (columnToPortMapping.containsKey(columnLabel)) {
- portName = columnToPortMapping.get(columnLabel);
- } else {
- portName = columnLabel;
- }
- return portName;
- }
-
- /**
- * Sets the port name for the column label.
- * <p>
- * If the port name is not the same as the column label the port name is added the
- * columnToPortMapping.
- *
- * @param columnLabel
- * @param portName
- */
- public void setPortName(String columnLabel, String portName) {
- if (columnLabel.equals(portName)) {
- columnToPortMapping.remove(columnLabel);
- } else {
- columnToPortMapping.put(columnLabel, portName);
- }
- }
-
- /**
- * Returns the map of column labels to port names.
- * <p>
- * The map only contains entries for port names that are not the same as their corresponding
- * column label.
- *
- * @return the map of column labels to port names
- */
- public Map<String, String> getColumnToPortMapping() {
- return columnToPortMapping;
- }
-
- // TableModel methods
-
- @Override
- public Class<?> getColumnClass(int columnIndex) {
- return String.class;
- }
-
- public int getColumnCount() {
- return 2;
- }
-
- @Override
- public String getColumnName(int columnIndex) {
- if (columnIndex == 0) {
- return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.column");
- } else {
- return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.portName");
- }
- }
-
- public int getRowCount() {
- return toColumn - fromColumn + 1;
- }
-
- public Object getValueAt(int rowIndex, int columnIndex) {
- String columnLabel = SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn);
- if (columnIndex == 0) {
- return columnLabel;
- } else {
- return getPortName(columnLabel);
- }
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return columnIndex == 1;
- }
-
- @Override
- public void setValueAt(Object value, int rowIndex, int columnIndex) {
- if (columnIndex == 1) {
- setPortName(SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn), value.toString());
- }
- }
-
-}
[15/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker
index e46e219..e7c6dfc 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.biojava.bio.seq.DNATools;
import org.biojava.bio.seq.RNATools;
import org.biojava.bio.symbol.SymbolList;
@@ -24,7 +24,7 @@ rna_seq = symL.seqString();
<element class="string">uk.org.mygrid.resources:biojava:1.4pre1</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -33,16 +33,16 @@ rna_seq = symL.seqString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>rna_seq</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker
index 9ed72e4..b1e35cd 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>BufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
@@ -57,7 +57,7 @@ if (displayResults) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -66,8 +66,8 @@ if (displayResults) {
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -76,8 +76,8 @@ if (displayResults) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -86,16 +86,16 @@ if (displayResults) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>results</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker
index 410ceb0..19aa4d9 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="properties" to="properties" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="properties" to="properties" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.net.URLEncoder;
Properties sysProps = System.getProperties();
@@ -21,13 +21,13 @@ properties = sb.toString();
<dependencies />
<inputs />
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>properties</name>
<depth>0</depth>
<mimeTypes>
<string>'text/xml'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByExtTask
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByExtTask b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByExtTask
index 910d0d6..d5fd02b 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByExtTask
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByExtTask
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>class FileExtFilter implements FileFilter {
public FileExtFilter(String ext) {
@@ -39,7 +39,7 @@ for (int i = 0; i < fileObjList.length; i++) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -48,8 +48,8 @@ for (int i = 0; i < fileObjList.length; i++) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -58,16 +58,16 @@ for (int i = 0; i < fileObjList.length; i++) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>filelist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask
index 06906b6..4e57939 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>class FileRegexFilter implements FileFilter {
public FileRegexFilter(String regex) {
@@ -37,7 +37,7 @@ for (int i = 0; i < fileObjList.length; i++) {
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -46,8 +46,8 @@ for (int i = 0; i < fileObjList.length; i++) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -56,16 +56,16 @@ for (int i = 0; i < fileObjList.length; i++) {
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>1</granularDepth>
<name>filelist</name>
<depth>1</depth>
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.LocalCommand
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.LocalCommand b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.LocalCommand
index c0adc09..7d242b2 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.LocalCommand
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.LocalCommand
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if (command == void || command.equals("")) {
throw new RuntimeException("The 'command' port cannot be null.");
}
@@ -46,7 +46,7 @@ result = sb.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -55,8 +55,8 @@ result = sb.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -65,16 +65,16 @@ result = sb.toString();
<mimeTypes>
<string>l('text/plain')</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>result</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileReader
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileReader b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileReader
index 6e9adb4..bd0f5e9 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileReader
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileReader
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>BufferedReader getReader (String fileUrl, String encoding) throws IOException {
InputStreamReader reader;
try {
@@ -42,7 +42,7 @@ filecontents = sb.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -51,8 +51,8 @@ filecontents = sb.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -61,16 +61,16 @@ filecontents = sb.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>filecontents</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileWriter
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileWriter b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileWriter
index 88ac962..4c6bb96 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileWriter
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.io.TextFileWriter
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>
BufferedWriter out;
if (encoding == void) {
@@ -14,7 +14,7 @@ outputFile = filecontents;
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -23,8 +23,8 @@ outputFile = filecontents;
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -33,8 +33,8 @@ outputFile = filecontents;
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -43,15 +43,15 @@ outputFile = filecontents;
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputFile</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker
index b6263cf..90b9f1e 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="password" to="password" /><map from="userid" to="userid" /><map from="params" to="params" /><map from="url" to="url" /><map from="provideXml" to="provideXml" /><map from="driver" to="driver" /><map from="sql" to="sql" /></inputMap><outputMap><map from="resultList" to="resultList" /><map from="xmlresults" to="xmlresults" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap><map from="password" to="password" /><map from="userid" to="userid" /><map from="params" to="params" /><map from="url" to="url" /><map from="provideXml" to="provideXml" /><map from="driver" to="driver" /><map from="sql" to="sql" /></inputMap><outputMap><map from="resultList" to="resultList" /><map from="xmlresults" to="xmlresults" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>
import java.sql.Driver;
@@ -128,7 +128,7 @@ finally {
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -146,9 +146,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -166,9 +166,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -186,9 +186,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -206,9 +206,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -226,9 +226,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -246,9 +246,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -266,13 +266,13 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>2</granularDepth>
@@ -286,9 +286,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
@@ -302,8 +302,8 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker
index fa0748c..3743ac7 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap><map from="password" to="password" /><map from="userid" to="userid" /><map from="params" to="params" /><map from="url" to="url" /><map from="provideXml" to="provideXml" /><map from="driver" to="driver" /><map from="sql" to="sql" /></inputMap><outputMap><map from="resultList" to="resultList" /><map from="xmlresults" to="xmlresults" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap><map from="password" to="password" /><map from="userid" to="userid" /><map from="params" to="params" /><map from="url" to="url" /><map from="provideXml" to="provideXml" /><map from="driver" to="driver" /><map from="sql" to="sql" /></inputMap><outputMap><map from="resultList" to="resultList" /><map from="xmlresults" to="xmlresults" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.sql.Driver;
import java.sql.DriverManager;
@@ -82,7 +82,7 @@ finally {
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -100,9 +100,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -120,9 +120,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -140,9 +140,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -160,11 +160,11 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -182,9 +182,9 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
@@ -202,13 +202,13 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
@@ -222,8 +222,8 @@ finally {
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker
index 8b7a680..dc748b0 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker
index 80f791a..da37aaa 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker
index 2ce601b..282b23d 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker
index aad694a..7f466c4 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker
index c07b04e..208ffcb 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker
index bf85c2b..94559e8 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker
index c82209f..5c5e006 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker
index b6f9337..9c50643 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -21,7 +21,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -30,16 +30,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker
index 71fef3c..f04b568 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((id == void) || (id == null) || id.equals("")) {
throw new RunTimeException("port id must have a non-empty value");
}
@@ -24,7 +24,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -33,8 +33,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -43,8 +43,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -53,16 +53,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker
index 37c440c..6b4f061 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="outputText" to="outputText" /></outputMap><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>if ((term == void) || (term == null) || term.equals("")) {
throw new RunTimeException("port term must have a non-empty value");
}
@@ -30,7 +30,7 @@ outputText = writer.toString();
</script>
<dependencies />
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -39,8 +39,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -49,8 +49,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -59,8 +59,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -69,8 +69,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -79,8 +79,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -89,8 +89,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -99,8 +99,8 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -109,16 +109,16 @@ outputText = writer.toString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>outputText</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.BrowseUrl
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.BrowseUrl b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.BrowseUrl
index a2317c5..2ff8903 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.BrowseUrl
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.BrowseUrl
@@ -1,6 +1,6 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>url</name>
<depth>0</depth>
<mimeTypes>
@@ -9,7 +9,7 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs />
<classLoaderSharing>workflow</classLoaderSharing>
@@ -28,4 +28,4 @@ uri = new URI(url);
Desktop.getDesktop().browse(uri);</script>
<dependencies />
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.ExtractHeader
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.ExtractHeader b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.ExtractHeader
index d3149d6..36bb7de 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.ExtractHeader
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.net.ExtractHeader
@@ -1,6 +1,6 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>headers</name>
<depth>1</depth>
<mimeTypes>
@@ -9,8 +9,8 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<name>header_key</name>
<depth>0</depth>
<mimeTypes>
@@ -19,15 +19,15 @@
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<name>header_value</name>
<depth>0</depth>
<mimeTypes />
<granularDepth>0</granularDepth>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
<classLoaderSharing>workflow</classLoaderSharing>
<localDependencies />
@@ -52,4 +52,4 @@ for (String h : headers) {
}
}</script>
<dependencies />
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity>
\ No newline at end of file
[03/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
deleted file mode 100644
index d1e98f7..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeNode.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.dom4j.QName;
-
-
-/**
- *
- * @author Sergejs Aleksejevs
- */
-public abstract class XPathActivityXMLTreeNode extends DefaultMutableTreeNode
-{
- protected static final int DISPLAY_LABEL_MAX_LENGTH = 200;
-
- private final boolean isAttribute;
-
- public XPathActivityXMLTreeNode(Object userObject, boolean isAttribute)
- {
- super(userObject);
- this.isAttribute = isAttribute;
- }
-
- public boolean isAttribute() {
- return (isAttribute);
- }
-
-
- public QName getNodeQName() {
- if (this.isAttribute()) {
- return (((XPathActivityXMLTreeAttributeNode)this).getAssociatedAttribute().getQName());
- }
- else {
- return (((XPathActivityXMLTreeElementNode)this).getAssociatedElement().getQName());
- }
- }
-
-
- public String getTreeNodeDisplayLabel(boolean bIncludeValue, boolean bIncludeElementNamespace, boolean bUseStyling)
- {
- if (this.isAttribute()) {
- return (((XPathActivityXMLTreeAttributeNode)this).getTreeNodeDisplayLabel(bIncludeValue, bUseStyling));
- }
- else {
- return (((XPathActivityXMLTreeElementNode)this).getTreeNodeDisplayLabel(bIncludeValue, bIncludeElementNamespace, bUseStyling));
- }
- }
-
-
- protected String truncateElementTextValue(String textValue)
- {
- if (textValue != null && textValue.length() > DISPLAY_LABEL_MAX_LENGTH) {
- textValue = textValue.substring(0, DISPLAY_LABEL_MAX_LENGTH) + "(...)";
- }
- return (textValue);
- }
-
-
- /**
- * Tiny helper to strip out all HTML tags. This will not leave any HTML tags
- * at all (so that the content can be displayed in DialogTextArea - and the
- * like - components. This helps to present HTML content inside JAVA easier.
- */
- public static String stripAllHTML(String source) {
- // don't do anything if not string is provided
- if (source == null)
- return ("");
-
- // need to preserve at least all line breaks
- // (ending and starting paragraph also make a line break)
- source = source.replaceAll("</p>[\r\n]*<p>", "<br>");
- source = source.replaceAll("\\<br/?\\>", "\n\n");
-
- // strip all HTML
- source = source.replaceAll("\\<.*?\\>", ""); // any HTML tags
- source = source.replaceAll("&\\w{1,4};", ""); // this is for things like " ", ">", etc
-
- return (source);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
deleted file mode 100644
index 389bf1a..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/config/xmltree/XPathActivityXMLTreeSelectionHandler.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.config.xmltree;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.activities.xpath.ui.config.XPathActivityConfigurationPanel;
-
-import org.dom4j.DocumentHelper;
-
-
-/**
- *
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityXMLTreeSelectionHandler implements TreeSelectionListener
-{
- private final XPathActivityXMLTree theTree;
- private final XPathActivityConfigurationPanel parentConfigPanel;
-
-
- public XPathActivityXMLTreeSelectionHandler(XPathActivityConfigurationPanel parentConfigPanel,
- XPathActivityXMLTree tree)
- {
- this.parentConfigPanel = parentConfigPanel;
- this.theTree = tree;
- }
-
-
- public void valueChanged(TreeSelectionEvent e)
- {
- // get the newly made selection
- TreePath newSelectedPath = e.getNewLeadSelectionPath();
-
- // NB! Safety check - sometimes the container of the XML tree will remove all selections,
- // in such case this listener is not supposed to perform any action -> terminate
- if (newSelectedPath == null) return;
-
-
- // --- XPath GENERATION ---
-
- // get the XPath expression for the new selection + taking into consideration all previous ones
- List<String> wildcardedXPath = generateWildcardedXPathExpression(newSelectedPath);
-
- // assemble the xpath expression as one string
- StringBuilder xpath = new StringBuilder();
- for (String leg : wildcardedXPath) {
- xpath.append(leg);
- }
- theTree.setCurrentXPathExpression(DocumentHelper.createXPath(xpath.toString()));
- theTree.getCurrentXPathExpression().setNamespaceURIs(theTree.getCurrentXPathNamespaces());
-
-
- // --- UPDATE CONFIG PANEL ---
- // (with new values for XPath expression and namespace mappings)
-
- // inform the parent activity configuration panel to update the XPath expression in the UI
- /* We do not update the XPath expression after changes in selection in the XML tree - we
- * now have a button to explicitly do that.
- * theTree.getParentConfigPanel().updateXPathEditingPanelValues();
- */
-
- // --- SELECTION ---
- selectAllNodesThatMatchTheCurrentXPath(wildcardedXPath, newSelectedPath);
- }
-
-
- /**
- * Selects all nodes that match the <code>wildcardedXPath</code> expression.
- *
- * Keyboard focus is set to remain on the "deepest" (e.g. furthest from root)
- * element of the <code>lastSelectedPath</code>.
- *
- * @param wildcardedXPath List of strings, where each string contains one "leg" of the XPath expression
- * (e.g. a string starting with a "/" and containing the name of one node of the tree).
- *
- * @param lastSelectedPath The path that was last selected in the tree (normally,
- * because of this selection {@link XPathActivityXMLTreeSelectionHandler#valueChanged(TreeSelectionEvent)}
- * was executed and this method was started as a part of that.
- */
- public void selectAllNodesThatMatchTheCurrentXPath(List<String> wildcardedXPath, TreePath lastSelectedPath)
- {
- // first of all - calculate the number of nodes that match this XPath
- // expression in the XML tree
- int numberOfMatchingNodes = parentConfigPanel.runXPath(false);
-
-
- // store all tree selection listeners in order to temporarily remove them;
- // this is necessary as selection modifications will be made here -- don't
- // want any listeners to respond to these new events
- theTree.removeAllSelectionListeners();
-
-
- // remove all previous selections - safest way to get the new ones correctly
- theTree.clearSelection();
-
-
- if (numberOfMatchingNodes <= XPathActivityConfigurationPanel.MAX_NUMBER_OF_MATCHING_NODES_TO_HIGHLIGHT_IN_THE_TREE)
- {
- // find all nodes that match the XPath expression
- List<XPathActivityXMLTreeNode> matchingNodes = new ArrayList<XPathActivityXMLTreeNode>();
- findAllNodesThatMatchWildcardedXPath(
- (XPathActivityXMLTreeNode)theTree.getModel().getRoot(),
- wildcardedXPath.subList(1, wildcardedXPath.size()),
- matchingNodes);
-
- // obtain and select TreePaths for each of the matching nodes
- for (XPathActivityXMLTreeNode matchingNode : matchingNodes) {
- TreeNode[] pathAsObjects = ((DefaultTreeModel)theTree.getModel()).getPathToRoot(matchingNode);
- TreePath path = new TreePath(pathAsObjects);
- selectTreePathAndAllItsAncestors(path);
- }
- }
- else {
- JOptionPane.showMessageDialog(parentConfigPanel,
- "Current XPath expression matches " + numberOfMatchingNodes + " nodes in the XML tree.\n" +
- "The XPath Activity is unable to highlight all these nodes in the tree due to\n" +
- "performance reasons.\n\n" +
- "The XPath Activity will still work correctly - both during the workflow execution\n" +
- "and if 'Run XPath' button is clicked to run this expression against the example XML.",
- "XPath Activity", JOptionPane.INFORMATION_MESSAGE);
- }
-
-
- // make sure the keyboard focus stays on the actual node that was clicked on -
- // no direct way to do this, so simply de-select and re-select again
- if (lastSelectedPath != null) {
- theTree.removeSelectionPath(lastSelectedPath);
- theTree.addSelectionPath(lastSelectedPath);
- }
-
- // restore all previously stored selection listeners
- theTree.restoreAllSelectionListeners();
- }
-
-
-
- /**
- * This cannot work for XPath expressions that were modified manually -
- * only works for the type generated by the click in the XML tree.
- *
- * @param nodeToStartAt
- * @param xpathLegs From <code>nodeToStartAt</code>.
- * @param matchingNodes
- */
- private void findAllNodesThatMatchWildcardedXPath(XPathActivityXMLTreeNode nodeToStartAt,
- List<String> xpathLegs, List<XPathActivityXMLTreeNode> matchingNodes)
- {
- // some of the input data is missing, just return...
- if (nodeToStartAt == null || xpathLegs == null || matchingNodes == null) {
- return;
- }
-
- // no XPath expression to match against the 'nodeToStartAt', therefore
- // we've "found" the macthing node: 'nodeToStartAt'
- if (xpathLegs.size() == 0) {
- matchingNodes.add(nodeToStartAt);
- return;
- }
-
- // standard case - there is something to match, proceed as normal
- Enumeration<XPathActivityXMLTreeNode> startNodeChildren = nodeToStartAt.children();
- while (startNodeChildren.hasMoreElements()) {
- XPathActivityXMLTreeNode child = startNodeChildren.nextElement();
-
- if (xpathLegs.get(0).equals("/*") ||
- xpathLegs.get(0).equals(this.theTree.getXMLTreeNodeEffectiveQualifiedNameAsXPathLeg(child)))
- {
- // this node matches current section of the XPath expression
- if (xpathLegs.size() == 1) {
- // no more sections in the XPath leg list to match, so this child
- // node is the one we were looking for - add to the result
- matchingNodes.add(child);
- }
- else {
- // ...or process its children recursively
- findAllNodesThatMatchWildcardedXPath(child, xpathLegs.subList(1, xpathLegs.size()), matchingNodes);
- }
- }
- }
- }
-
-
- private List<String> generateWildcardedXPathExpression(TreePath newSelectedPath)
- {
- // look through previous selection to find paths of the same length, as the newly selected one
- List<TreePath> pathsOfSameLength = new ArrayList<TreePath>();
- TreePath[] previouslySelectedPaths = theTree.getSelectionPaths();
- for (TreePath path : previouslySelectedPaths) {
- if (path.getPathCount() == newSelectedPath.getPathCount()) {
- pathsOfSameLength.add(path);
- }
- }
-
- // if there were found any paths of the same length, we have a "wildcard" situation
- List<String> wildcardXPathLegs = theTree.generateXPathFromTreePathAsLegList(newSelectedPath);
-
- if (pathsOfSameLength.size() > 0)
- {
- // it's okay to use just the first path - TODO: explain that this is because of previous comparisons
- List<String> firstMatchingLengthPathLegs = theTree.generateXPathFromTreePathAsLegList(pathsOfSameLength.get(0));
-
- int pathLength = wildcardXPathLegs.size();
-
- // only use wildcards if the last segments of both paths are identical
- if (wildcardXPathLegs.get(pathLength - 1).equals(firstMatchingLengthPathLegs.get(pathLength - 1)))
- {
- // continue all the way to the last segment, but don't touch it
- for (int i = 0; i < wildcardXPathLegs.size() - 1; i++)
- {
- if (!wildcardXPathLegs.get(i).equals(firstMatchingLengthPathLegs.get(i))) {
- // set wildcard
- // TODO - make wildcard a constant
- // TODO - may need to make the wildcard to have a namespace? (e.g. "/default:*" instead of simply "/*")
- wildcardXPathLegs.set(i, "/*"); // definitely an element, not an attribute (as not the last segment in the path)
- }
- }
- }
- }
-
- return (wildcardXPathLegs);
- }
-
-
-
- private void selectTreePathAndAllItsAncestors(TreePath path)
- {
- // select all ancestors of that path
- TreePath pathToSelect = path;
- for (int i = 0; i < path.getPathCount(); i++)
- {
- pathToSelect = pathToSelect.getParentPath();
- theTree.addSelectionPath(pathToSelect);
- }
-
- // select the specified path itself
- //
- // NB! important to do this after the ancestors, so that the supplied
- // path is the one that retains the keyboard focus after this method terminates
- theTree.addSelectionPath(path);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
deleted file mode 100644
index caa15da..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/ConfigureXPathActivityMenuAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.contextualview;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.xpath.ui.config.XPathActivityConfigureAction;
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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;
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * This action is responsible for enabling the contextual menu entry on processors that perform
- * XPathActivity'ies.
- * NB! As a side-effect this also enables the pop-up with for configuration of the processor when it
- * is added to the workflow from the Service Panel.
- *
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class ConfigureXPathActivityMenuAction extends AbstractConfigureActivityMenuAction {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public ConfigureXPathActivityMenuAction() {
- super(XPathTemplateService.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- XPathActivityConfigureAction configAction = new XPathActivityConfigureAction(
- findActivity(), getParentFrame(), editManager, fileManager, activityIconManager,
- serviceDescriptionRegistry, serviceRegistry);
- configAction.putValue(Action.NAME, "Configure XPath service");
- addMenuDots(configAction);
- return configAction;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
deleted file mode 100644
index a86a1ff..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextViewFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.contextualview;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityMainContextViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ServiceRegistry serviceRegistry;
-
- public boolean canHandle(Object selection) {
- return selection instanceof Activity
- && ((Activity) selection).getType()
- .equals(XPathTemplateService.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity selection) {
- return Arrays.<ContextualView> asList(new XPathActivityMainContextualView(selection,
- editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
- serviceRegistry));
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
deleted file mode 100644
index 54eee43..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/contextualview/XPathActivityMainContextualView.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.contextualview;
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-import javax.swing.Action;
-import javax.swing.BorderFactory;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.table.DefaultTableModel;
-
-import net.sf.taverna.t2.activities.xpath.ui.config.XPathActivityConfigureAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- *
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class XPathActivityMainContextualView extends ContextualView {
-
- private final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- private XPathActivityMainContextualView thisContextualView;
-
- private final Activity activity;
-
- private JPanel jpMainPanel;
- private JTextField tfXPathExpression;
-
- private DefaultTableModel xpathNamespaceMappingsTableModel;
- private JTable jtXPathNamespaceMappings;
- private JScrollPane spXPathNamespaceMappings;
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ActivityIconManager activityIconManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
- private final ServiceRegistry serviceRegistry;
-
- public XPathActivityMainContextualView(Activity activity, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- this.serviceRegistry = serviceRegistry;
- this.thisContextualView = this;
- this.activity = activity;
- initView();
- }
-
- @Override
- public JComponent getMainFrame() {
- jpMainPanel = new JPanel(new GridBagLayout());
- jpMainPanel.setBorder(BorderFactory.createCompoundBorder(
- BorderFactory.createEmptyBorder(4, 2, 4, 2), BorderFactory.createEmptyBorder()));
-
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.HORIZONTAL;
- c.anchor = GridBagConstraints.WEST;
- c.weighty = 0;
-
- // --- XPath Expression ---
-
- c.gridx = 0;
- c.gridy = 0;
- c.insets = new Insets(5, 5, 5, 5);
- JLabel jlXPathExpression = new JLabel("XPath Expression:");
- jlXPathExpression.setFont(jlXPathExpression.getFont().deriveFont(Font.BOLD));
- jpMainPanel.add(jlXPathExpression, c);
-
- c.gridx++;
- c.weightx = 1.0;
- tfXPathExpression = new JTextField();
- tfXPathExpression.setEditable(false);
- jpMainPanel.add(tfXPathExpression, c);
-
- // --- Label to Show/Hide Mapping Table ---
-
- final JLabel jlShowHideNamespaceMappings = new JLabel("Show namespace mappings...");
- jlShowHideNamespaceMappings.setForeground(Color.BLUE);
- jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR));
- jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- spXPathNamespaceMappings.setVisible(!spXPathNamespaceMappings.isVisible());
- jlShowHideNamespaceMappings.setText((spXPathNamespaceMappings.isVisible() ? "Hide"
- : "Show") + " namespace mappings...");
- thisContextualView.revalidate();
- }
- });
-
- c.gridx = 0;
- c.gridy++;
- c.gridwidth = 2;
- c.weightx = 1.0;
- c.weighty = 0;
- c.fill = GridBagConstraints.HORIZONTAL;
- jpMainPanel.add(jlShowHideNamespaceMappings, c);
-
- // --- Namespace Mapping Table ---
-
- xpathNamespaceMappingsTableModel = new DefaultTableModel() {
- /**
- * No cells should be editable
- */
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return (false);
- }
- };
- xpathNamespaceMappingsTableModel.addColumn("Namespace Prefix");
- xpathNamespaceMappingsTableModel.addColumn("Namespace URI");
-
- jtXPathNamespaceMappings = new JTable();
- jtXPathNamespaceMappings.setModel(xpathNamespaceMappingsTableModel);
- jtXPathNamespaceMappings.setPreferredScrollableViewportSize(new Dimension(200, 90));
- // TODO - next line is to be enabled when Taverna is migrated to Java
- // 1.6; for now it's fine to run without this
- // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure
- // that when the dedicated area is larger than the table, the latter is
- // stretched vertically to fill the empty space
-
- jtXPathNamespaceMappings.getColumnModel().getColumn(0).setPreferredWidth(20); // set
- // relative
- // sizes of
- // columns
- jtXPathNamespaceMappings.getColumnModel().getColumn(1).setPreferredWidth(300);
-
- c.gridy++;
- spXPathNamespaceMappings = new JScrollPane(jtXPathNamespaceMappings);
- spXPathNamespaceMappings.setVisible(false);
- jpMainPanel.add(spXPathNamespaceMappings, c);
-
- // populate the view with values
- refreshView();
-
- return jpMainPanel;
- }
-
- @Override
- /**
- * This is the title of the contextual view - shown in the list of other available
- * views (even when this contextual view is collapsed).
- */
- public String getViewTitle() {
- return "XPath Service Details";
- }
-
- /**
- * Typically called when the activity configuration has changed.
- */
- @Override
- public void refreshView() {
- Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
- JsonNode json = configuration.getJson();
-
- // Set XPath Expression
- tfXPathExpression.setText(json.get("xpathExpression").asText());
-
- // Populate Namespace Mappings
- xpathNamespaceMappingsTableModel.getDataVector().removeAllElements();
- if (json.has("xpathNamespaceMap")) {
- for (JsonNode mapping : json.get("xpathNamespaceMap")) {
- xpathNamespaceMappingsTableModel.addRow(new Object[] {
- mapping.get("prefix").asText(), mapping.get("uri").asText() });
- }
- }
- }
-
- /**
- * View position hint
- */
- @Override
- public int getPreferredPosition() {
- // want to be on top, as it's the main contextual view for this activity
- return 100;
- }
-
- @Override
- public Action getConfigureAction(final Frame owner) {
- // "Configure" button appears because of this action being returned
- return new XPathActivityConfigureAction(activity, owner, editManager, fileManager,
- activityIconManager, serviceDescriptionRegistry, serviceRegistry);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateAction.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateAction.java
deleted file mode 100644
index e3ee445..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.xpath.ui.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action to add a REST activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class AddXPathTemplateAction extends AbstractContextualMenuAction {
-
- private static final String ADD_XPATH = "XPath";
-
- private static final URI insertSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/insert");
-
- private EditManager editManager;
-
- private MenuManager menuManager;
-
- private SelectionManager selectionManager;
-
- private ActivityIconManager activityIconManager;
-
- private ServiceRegistry serviceRegistry;
-
- public AddXPathTemplateAction() {
- super(insertSection, 1000);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
- }
-
- @Override
- protected Action createAction() {
-
- return new AddXPathAction();
- }
-
- protected class AddXPathAction extends AbstractAction {
- AddXPathAction() {
- super(ADD_XPATH, activityIconManager
- .iconForActivity(XPathTemplateService.ACTIVITY_TYPE));
- }
-
- public void actionPerformed(ActionEvent e) {
-
- WorkflowView.importServiceDescription(XPathTemplateService.getServiceDescription(),
- false, editManager, menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
deleted file mode 100644
index c2ec7ca..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/menu/AddXPathTemplateMenuAction.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.xpath.ui.menu;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.activities.xpath.ui.servicedescription.XPathTemplateService;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * An action to add a REST activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class AddXPathTemplateMenuAction extends AbstractMenuAction {
-
- private static final String ADD_XPATH = "XPath";
-
- private static final URI INSERT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
- private static final URI ADD_XPATH_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddXPath");
-
- private EditManager editManager;
-
- private MenuManager menuManager;
-
- private SelectionManager selectionManager;
-
- private ActivityIconManager activityIconManager;
-
- private ServiceRegistry serviceRegistry;
-
- public AddXPathTemplateMenuAction() {
- super(INSERT, 1000, ADD_XPATH_URI);
- }
-
- @Override
- protected Action createAction() {
- return new AddXPathMenuAction();
- }
-
- protected class AddXPathMenuAction extends AbstractAction implements DesignOnlyAction {
- AddXPathMenuAction() {
- super();
- putValue(SMALL_ICON,
- activityIconManager.iconForActivity(XPathTemplateService.ACTIVITY_TYPE));
- putValue(NAME, ADD_XPATH);
- putValue(SHORT_DESCRIPTION, "XPath service");
- putValue(
- Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.SHIFT_DOWN_MASK
- | InputEvent.ALT_DOWN_MASK));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(XPathTemplateService.getServiceDescription(),
- false, editManager, menuManager, selectionManager, serviceRegistry);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathActivityIcon.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathActivityIcon.java
deleted file mode 100644
index 2251efb..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathActivityIcon.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.servicedescription;
-
-import java.awt.Color;
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-/**
- * @author Sergejs Aleksejevs
- */
-public class XPathActivityIcon implements ActivityIconSPI {
- private static final Color PROCESSOR_COLOUR = Color.decode("#E6FF5E");
-
- // --- LOCATIONS OF ICONS USED IN THE XPath ACTIVITY ---
-
- private static final String FAMFAMFAM_SILK_PATH = "famfamfam_silk/";
- private static final String FOLDS_PATH = "folds/";
-
- public static final String XPATH_ACTIVITY_ICON = FAMFAMFAM_SILK_PATH + "page_white_code.png";
- public static final String XPATH_ACTIVITY_CONFIGURATION_PARSE_XML_ICON = "arrow_right.png";
-
- public static final String XML_TREE_ROOT_ICON = FAMFAMFAM_SILK_PATH + "page_white_code.png";
- public static final String XML_TREE_NODE_ICON = FAMFAMFAM_SILK_PATH + "tag.png";
- public static final String XML_TREE_ATTRIBUTE_ICON = "xpath_attribute.png";
-
- public static final String XML_TREE_EXPAND_ALL_ICON = FAMFAMFAM_SILK_PATH
- + "text_linespacing.png";
- public static final String XML_TREE_COLLAPSE_ALL_ICON = FAMFAMFAM_SILK_PATH
- + "text_linespacing (collapse).png";
-
- public static final String XPATH_STATUS_OK_ICON = FAMFAMFAM_SILK_PATH + "accept.png";
- public static final String XPATH_STATUS_ERROR_ICON = FAMFAMFAM_SILK_PATH + "exclamation.png";
- public static final String XPATH_STATUS_UNKNOWN_ICON = FAMFAMFAM_SILK_PATH + "help.png";
-
- public static final String FOLD_ICON = FOLDS_PATH + "fold.png";
- public static final String UNFOLD_ICON = FOLDS_PATH + "unfold.png";
-
- // ------
-
- private static ImageIcon icon;
-
- public int canProvideIconScore(URI activityType) {
- if (XPathTemplateService.ACTIVITY_TYPE.equals(activityType))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getXPathActivityIcon();
- }
-
- public static Icon getXPathActivityIcon() {
- if (icon == null) {
- synchronized (XPathActivityIcon.class) {
- if (icon == null) {
- try {
- icon = new ImageIcon(
- XPathActivityIcon.class.getResource(XPATH_ACTIVITY_ICON));
- } catch (NullPointerException e) {
- /* icon wasn't found - do nothing, but no icon will be available */
- }
- }
- }
- }
- return (icon);
- }
-
- public static Icon getIconById(String iconID) {
- try {
- return (new ImageIcon(XPathActivityIcon.class.getResource(iconID)));
- } catch (NullPointerException e) {
- // requested icon wasn't found - just return null
- return (null);
- }
- }
-
- public void setColourManager(ColourManager colourManager) {
- colourManager.setPreferredColour(XPathTemplateService.ACTIVITY_TYPE.toString(), PROCESSOR_COLOUR);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathTemplateService.java b/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathTemplateService.java
deleted file mode 100644
index a1ebafc..0000000
--- a/taverna-xpath-activity-ui/src/main/java/net/sf/taverna/t2/activities/xpath/ui/servicedescription/XPathTemplateService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package net.sf.taverna.t2.activities.xpath.ui.servicedescription;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-/**
- * @author Sergejs Aleksejevs
- * @author David Withers
- */
-public class XPathTemplateService extends AbstractTemplateService {
-
- public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xpath");
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- ObjectNode json = (ObjectNode) configuration.getJson();
- json.put("xpathExpression", "/");
- return configuration;
- }
-
- @Override
- public Icon getIcon() {
- return XPathActivityIcon.getXPathActivityIcon();
- }
-
- public String getName() {
- return "XPath";
- }
-
- public String getDescription() {
- return "Service for point-and-click creation of XPath expressions for XML data";
- }
-
- public static ServiceDescription getServiceDescription() {
- XPathTemplateService gts = new XPathTemplateService();
- return gts.templateService;
- }
-
- public String getId() {
- return "http://www.taverna.org.uk/2010/services/xpath";
- }
-
- @Override
- public XPathTemplateService newInstance() {
- return new XPathTemplateService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/TwoFieldQueryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/TwoFieldQueryPanel.java b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/TwoFieldQueryPanel.java
new file mode 100644
index 0000000..a63e465
--- /dev/null
+++ b/taverna-xpath-activity-ui/src/main/java/org/apache/taverna/activities/xpath/ui/config/TwoFieldQueryPanel.java
@@ -0,0 +1,110 @@
+package org.apache.taverna.activities.xpath.ui.config;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+/**
+ * Auxiliary class that creates a JPanel with two labels and two text fields.
+ *
+ * It can be used to be placed into a dialog made by JOptionPane to get two
+ * input values, not just one.
+ *
+ * @author Sergejs Aleksejevs
+ */
+public class TwoFieldQueryPanel extends JPanel {
+ private JTextField tfFirstValue;
+ private JTextField tfSecondValue;
+
+ public TwoFieldQueryPanel(String firstFieldName, String secondFieldName) {
+ this(null, firstFieldName, null, secondFieldName, null);
+ }
+
+ public TwoFieldQueryPanel(String message, String firstFieldName,
+ String secondFieldName) {
+ this(message, firstFieldName, null, secondFieldName, null);
+ }
+
+ public TwoFieldQueryPanel(String firstFieldName,
+ String firstFieldDefaultValue, String secondFieldName,
+ String secondFieldDefaultValue) {
+ this(null, firstFieldName, firstFieldDefaultValue, secondFieldName,
+ secondFieldDefaultValue);
+ }
+
+ public TwoFieldQueryPanel(String message, String firstFieldName,
+ String firstFieldDefaultValue, String secondFieldName,
+ String secondFieldDefaultValue) {
+ super();
+ this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ this.setLayout(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ c.gridx = 0;
+ c.gridy = 0;
+ c.weightx = 0;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.anchor = GridBagConstraints.WEST;
+ c.insets = new Insets(3, 5, 3, 5);
+
+ if (message != null && message.length() > 0) {
+ c.gridwidth = 2;
+ c.insets = new Insets(5, 5, 15, 5);
+ this.add(new JLabel(message), c);
+
+ c.gridwidth = 1;
+ c.gridx = 0;
+ c.gridy++;
+ c.insets = new Insets(3, 5, 3, 5);
+ }
+
+ this.add(new JLabel(firstFieldName), c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ tfFirstValue = new JTextField(20);
+ if (firstFieldDefaultValue != null) {
+ tfFirstValue.setText(firstFieldDefaultValue);
+ }
+ tfFirstValue.selectAll();
+ tfFirstValue.requestFocusInWindow();
+ this.add(tfFirstValue, c);
+
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 0;
+ this.add(new JLabel(secondFieldName), c);
+
+ c.gridx++;
+ c.weightx = 1.0;
+ tfSecondValue = new JTextField(20);
+ if (secondFieldDefaultValue != null) {
+ tfSecondValue.setText(secondFieldDefaultValue);
+ }
+ tfSecondValue.selectAll();
+ this.add(tfSecondValue, c);
+ }
+
+ /**
+ * @return Trimmed value from the first text field. Guaranteed to be
+ * non-null.
+ */
+ public String getFirstValue() {
+ return (tfFirstValue.getText().trim());
+ }
+
+ /**
+ * @return Trimmed value from the second text field. Guaranteed to be
+ * non-null.
+ */
+ public String getSecondValue() {
+ return (tfSecondValue.getText().trim());
+ }
+
+}
[07/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceDescription.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
deleted file mode 100644
index faa3f8c..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*********************************************************************
- * Copyright (C) 2007-2009 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.wsdl.servicedescriptions;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.security.credentialmanager.CMException;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class WSDLServiceDescription extends ServiceDescription {
-
- public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/wsdl");
- public static final URI INPUT_SPLITTER_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
- public static final URI OUTPUT_SPLITTER_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
-
- private static final String WSDL = "WSDL @ ";
-
- private String use;
- private URI uri;
- private String style;
- private String operation;
- private final CredentialManager credentialManager;
-
- private static Logger logger = Logger.getLogger(WSDLServiceDescription.class);
-
- public WSDLServiceDescription(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
- public String getUse() {
- return use;
- }
-
- public void setUse(String use) {
- this.use = use;
- }
-
- public URI getURI() {
- return uri;
- }
-
- public void setURI(URI url) {
- this.uri = url;
- }
-
- public String getStyle() {
- return style;
- }
-
- public void setStyle(String style) {
- this.style = style;
- }
-
- public String getType() {
- return "WSDL";
- }
-
- @Override
- public String toString() {
- return operation;
- }
-
- public String getOperation() {
- return operation;
- }
-
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
- public Icon getIcon() {
- return WSDLActivityIcon.getWSDLIcon();
- }
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_TYPE;
- }
-
- @Override
- public Configuration getActivityConfiguration() {
- Configuration configuration = new Configuration();
- configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
- ObjectNode json = (ObjectNode) configuration.getJson();
- ObjectNode operation = json.objectNode();
- json.put("operation", operation);
- operation.put("wsdl", getURI().toString());
- operation.put("name", getOperation());
- return configuration;
- }
-
- public String getName() {
- return getOperation();
- }
-
- public List<? extends Comparable<?>> getPath() {
- return Collections.singletonList(WSDL + getURI());
- }
-
- protected List<Object> getIdentifyingData() {
- return Arrays.<Object> asList(getURI(), getOperation());
- }
-
- @Override
- public boolean isTemplateService() {
- return needsSecurity();
- }
-
- protected boolean needsSecurity() {
- if (credentialManager == null) {
- // We don't know if it needs security or not
- return false;
- }
- // A match is a good indicator that security configuration is needed
- try {
- return credentialManager.hasUsernamePasswordForService(getURI());
- } catch (CMException e) {
- logger.warn("Could not check if credential manager has username/password for " + getURI(), e);
- return false;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProvider.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
deleted file mode 100644
index daf0cad..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.servicedescriptions;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.wsdl.Operation;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import net.sf.taverna.t2.activities.wsdl.WSDLActivityHealthChecker;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.AbstractConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.events.RemovedProviderEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-import net.sf.taverna.wsdl.parser.WSDLParser;
-
-import org.apache.log4j.Logger;
-import org.xml.sax.SAXException;
-
-public class WSDLServiceProvider extends
- AbstractConfigurableServiceProvider<WSDLServiceProviderConfig> implements
- CustomizedConfigurePanelProvider<WSDLServiceProviderConfig> {
-
- private static Logger logger = Logger.getLogger(WSDLServiceProvider.class);
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/wsdl");
-
- private CredentialManager credentialManager;
-
- public static class FlushWSDLCacheOnRemovalObserver implements
- Observer<ServiceDescriptionRegistryEvent> {
- public void notify(
- Observable<ServiceDescriptionRegistryEvent> registry,
- ServiceDescriptionRegistryEvent event) throws Exception {
- if (!(event instanceof RemovedProviderEvent)) {
- return;
- }
- RemovedProviderEvent removedProviderEvent = (RemovedProviderEvent) event;
- if (!(removedProviderEvent.getProvider() instanceof WSDLServiceProvider)) {
- return;
- }
- WSDLServiceProvider serviceProvider = (WSDLServiceProvider) removedProviderEvent
- .getProvider();
- URI wsdlLocation = serviceProvider.getConfiguration().getURI();
- WSDLParser.flushCache(wsdlLocation.toASCIIString());
- logger.info("Flushed cache for WSDL " + wsdlLocation);
- }
- }
-
- private static final String WSDL_SERVICE = "WSDL service";
-
- private static FlushWSDLCacheOnRemovalObserver flushObserver = new FlushWSDLCacheOnRemovalObserver();
-
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
- public WSDLServiceProvider() {
- super(new WSDLServiceProviderConfig("http://somehost/service?wsdl"));
- }
-
- public String getName() {
- return WSDL_SERVICE;
- }
-
- public List<WSDLServiceProviderConfig> getDefaultConfigurations() {
-
- List<WSDLServiceProviderConfig> defaults = new ArrayList<WSDLServiceProviderConfig>();
-
- // If defaults have failed to load from a configuration file then load them here.
- if (!serviceDescriptionRegistry.isDefaultSystemConfigurableProvidersLoaded()){
- // 2009-12-16: 503 server error
- defaults.add(new WSDLServiceProviderConfig(
- "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl"));
- defaults.add(new WSDLServiceProviderConfig(
- "http://soap.bind.ca/wsdl/bind.wsdl"));
- defaults.add(new WSDLServiceProviderConfig(
- "http://www.ebi.ac.uk/ws/services/urn:Dbfetch?wsdl"));
- } // else return an empty list
-
- return defaults;
- }
-
- public void findServiceDescriptionsAsync(
- FindServiceDescriptionsCallBack callBack) {
-
- URI wsdl = serviceProviderConfig.getURI();
-
- callBack.status("Parsing wsdl:" + wsdl);
- WSDLParser parser = null;
- try {
- parser = new WSDLParser(wsdl.toASCIIString());
- List<Operation> operations = parser.getOperations();
- callBack.status("Found " + operations.size() + " WSDL operations:"
- + wsdl);
- List<WSDLServiceDescription> items = new ArrayList<WSDLServiceDescription>();
- for (Operation op : operations) {
- WSDLServiceDescription item = new WSDLServiceDescription(credentialManager);
- try {
- String name = op.getName();
- item.setOperation(name);
- String use = parser.getUse(name);
- String style = parser.getStyle();
- if (!WSDLActivityHealthChecker.checkStyleAndUse(style, use)) {
- logger.warn("Unsupported style and use combination " + style + "/" + use + " for operation " + name + " from " + wsdl);
- continue;
- }
- item.setUse(use);
- item.setStyle(style);
- item.setURI(wsdl);
- item.setDescription(parser.getOperationDocumentation(name));
- items.add(item);
- } catch (UnknownOperationException e) {
- String message = "Encountered an unexpected operation name:"
- + item.getOperation();
- callBack.fail(message, e);
- }
- }
- callBack.partialResults(items);
- callBack.finished();
- } catch (ParserConfigurationException e) {
- String message = "Error configuring the WSDL parser";
- callBack.fail(message, e);
- } catch (WSDLException e) {
- String message = "There was an error with the wsdl: " + wsdl;
- callBack.fail(message, e);
- } catch (IOException e) {
- String message = "There was an IO error parsing the wsdl: " + wsdl
- + " Possible reason: the wsdl location was incorrect.";
- callBack.fail(message, e);
- } catch (SAXException e) {
- String message = "There was an error with the XML in the wsdl: "
- + wsdl;
- callBack.fail(message, e);
- } catch (IllegalArgumentException e) { // a problem with the wsdl url
- String message = "There was an error with the wsdl: " + wsdl + " "
- + "Possible reason: the wsdl location was incorrect.";
- callBack.fail(message, e);
- } catch (Exception e) { // anything else we did not expect
- String message = "There was an error with the wsdl: " + wsdl;
- callBack.fail(message, e);
- }
- }
-
- @Override
- public String toString() {
- return getName() + " " + getConfiguration().getURI();
- }
-
- public Icon getIcon() {
- return WSDLActivityIcon.getWSDLIcon();
- }
-
- @Override
- protected List<? extends Object> getIdentifyingData() {
- List<String> result;
- result = Arrays.asList(getConfiguration().getURI().toString());
- return result;
- }
-
- /**
- * Will be set by ServiceDescriptionRegistryImpl
- *
- * @param registry Registry this provider has been added to
- */
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- synchronized (flushObserver) {
- // Add the (static common) observer if the registry does not have it
- if (!serviceDescriptionRegistry.getObservers().contains(flushObserver)) {
- serviceDescriptionRegistry.addObserver(flushObserver);
- }
- }
- }
-
- @SuppressWarnings("serial")
- public void createCustomizedConfigurePanel(final CustomizedConfigureCallBack<WSDLServiceProviderConfig> callBack) {
-
- AddWSDLServiceDialog addWSDLServiceDialog = new AddWSDLServiceDialog() {
- @Override
- protected void addRegistry(String wsdlURL) {
-
- WSDLServiceProviderConfig providerConfig = new WSDLServiceProviderConfig(wsdlURL);
- callBack.newProviderConfiguration(providerConfig);
- }
- };
- addWSDLServiceDialog.setVisible(true);
- }
-
- public String getId() {
- return providerId.toString();
- }
-
- public void setCredentialManager(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
deleted file mode 100644
index 9a63c03..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.servicedescriptions;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
-import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
-
-public class WSDLServiceProviderConfig extends PropertyAnnotated {
- private URI uri;
-
- public WSDLServiceProviderConfig() {
- }
-
- public WSDLServiceProviderConfig(String uri) {
- this.uri = URI.create(uri);
- }
-
- @PropertyAnnotation(displayName = "WSDL location", preferred = true)
- public URI getURI() {
- return uri;
- }
-
- public void setURI(URI uri) {
- this.uri = uri;
- }
-
- @Override
- public String toString() {
- return getURI().toASCIIString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
deleted file mode 100644
index cc92f3b..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
+++ /dev/null
@@ -1,63 +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.wsdl.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- *
- */
-public class XMLInputSplitterActivityIcon implements ActivityIconSPI{
-
- private static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
-
- private static Icon icon = null;
-
- public int canProvideIconScore(URI activityType) {
- if (activityType.equals(ACTIVITY_TYPE))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getXMLOutputSplitterIcon();
- }
-
- public static Icon getXMLOutputSplitterIcon() {
- if (icon == null) {
- icon = new ImageIcon(XMLOutputSplitterActivityIcon.class.getResource("/xml-splitter.png"));
- }
- return icon;
- }
-
-}
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
deleted file mode 100644
index 73c9bcb..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
+++ /dev/null
@@ -1,64 +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.wsdl.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- *
- */
-public class XMLOutputSplitterActivityIcon implements ActivityIconSPI{
-
- private static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
-
- private static Icon icon = null;
-
- public int canProvideIconScore(URI activityType) {
- if (activityType.equals(ACTIVITY_TYPE))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getXMLOutputSplitterIcon();
- }
-
- public static Icon getXMLOutputSplitterIcon() {
- if (icon == null) {
- icon = new ImageIcon(XMLOutputSplitterActivityIcon.class.getResource("/xml-splitter.png"));
- }
- return icon;
- }
-
-}
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/AbstractXMLSplitterActionView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/AbstractXMLSplitterActionView.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/AbstractXMLSplitterActionView.java
deleted file mode 100644
index 0ca95e5..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/AbstractXMLSplitterActionView.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.views;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import net.sf.taverna.t2.activities.wsdl.actions.AbstractAddXMLSplitterAction;
-import net.sf.taverna.t2.activities.wsdl.actions.AddXMLInputSplitterAction;
-import net.sf.taverna.t2.activities.wsdl.actions.AddXMLOutputSplitterAction;
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-
-import org.apache.log4j.Logger;
-import org.jdom.JDOMException;
-import org.xml.sax.SAXException;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.port.DepthPort;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-
-@SuppressWarnings("serial")
-public abstract class AbstractXMLSplitterActionView extends HTMLBasedActivityContextualView {
-
- private static Logger logger = Logger.getLogger(AbstractXMLSplitterActionView.class);
- protected final EditManager editManager;
- protected final SelectionManager selectionManager;
- protected AbstractAddXMLSplitterAction splitterAction;
-
- public AbstractXMLSplitterActionView(Activity activity, EditManager editManager,
- SelectionManager selectionManager, ColourManager colourManager) {
- super(activity, colourManager);
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
- splitterAction = new AddXMLOutputSplitterAction(getActivity(),
- null, editManager, selectionManager);
- } else if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
- splitterAction = new AddXMLInputSplitterAction(getActivity(),
- null, editManager, selectionManager);
- }
- super.initView();
- }
-
- @Override
- public void initView() {
- }
-
- protected void addOutputSplitter(final JComponent mainFrame, JPanel flowPanel) {
- if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
- try {
- Map<String, TypeDescriptor> descriptors = splitterAction.getTypeDescriptors();
- if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
- flowPanel.add(new JButton(splitterAction));
- }
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- logger.warn("Could not find type descriptors for " + getActivity(), e);
- }
- }
- }
-
- protected void addInputSplitter(final JComponent mainFrame, JPanel flowPanel) {
- if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
- try {
- Map<String, TypeDescriptor> descriptors = splitterAction.getTypeDescriptors();
- if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
- splitterAction.setOwner(mainFrame);
- flowPanel.add(new JButton(splitterAction));
- }
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- logger.warn("Could not find type descriptors for " + getActivity(), e);
- }
- }
- }
-
- protected String describePorts() {
- StringBuilder html = new StringBuilder();
-
- if (!getActivity().getInputPorts().isEmpty()) {
- html.append("<tr><th colspan='2' align='left'>Inputs</th></tr>");
- for (InputActivityPort port : getActivity().getInputPorts()) {
- TypeDescriptor descriptor = null;
- if (getActivity().getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
- try {
- descriptor = splitterAction.getTypeDescriptors().get(port.getName());
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- logger.warn("Could not find type descriptors for " + getActivity(), e);
- }
- }
- if (descriptor == null) {
- html.append(describePort(port));
- } else {
- html.append(describePort(port, descriptor));
- }
-
- }
- }
-
- if (!getActivity().getOutputPorts().isEmpty()) {
- html.append("<tr><th colspan='2' align='left'>Outputs</th></tr>");
- for (OutputActivityPort port : getActivity().getOutputPorts()) {
- TypeDescriptor descriptor = null;
- if (getActivity().getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
- try {
- descriptor = splitterAction.getTypeDescriptors().get(port.getName());
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- logger.warn("Could not find type descriptors for " + getActivity(), e);
- }
- }
- if (descriptor == null) {
- html.append(describePort(port));
- } else {
- html.append(describePort(port, descriptor));
- }
- }
- }
-
- return html.toString();
- }
-
- private String describePort(DepthPort port, TypeDescriptor descriptor) {
- String html = "<tr><td>" + port.getName() + "</td><td>";
- if (descriptor != null && descriptor.isOptional()) {
- html += "<em>optional</em><br>";
- }
- html+="Depth:"+port.getDepth()+"<br>";
- if (descriptor != null ) {
- html+="<code>"+descriptor.getQname().toString()+"</code><br>";
-// if (descriptor.getDocumentation() != null && !descriptor.getDocumentation().isEmpty()){
-// html += "<p>"+descriptor.getDocumentation()+"</p>";
-// }
- }
-
- html+="</td></tr>";
- return html;
- }
-
- private String describePort(DepthPort port) {
- String html = "<tr><td>" + port.getName() + "</td><td>";
- html += "Depth:" + port.getDepth() + "<br>";
- html += "</td></tr>";
- return html;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityConfigurationView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityConfigurationView.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityConfigurationView.java
deleted file mode 100644
index 4f728d9..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityConfigurationView.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.views;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.net.URI;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.SwingConstants;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.plaf.basic.BasicComboBoxRenderer;
-
-import net.sf.taverna.t2.activities.wsdl.security.SecurityProfiles;
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-/**
- * Configuration dialog for WSDL activity.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class WSDLActivityConfigurationView extends ActivityConfigurationPanel implements ItemListener {
-
- private CredentialManager credentialManager;
- private CredentialManagerUI credManagerUI;
-
- private ButtonGroup buttonGroup;
- private JRadioButton noSecurityRadioButton;
- private JLabel noSecurityLabel;
- private JRadioButton httpSecurityAuthNRadioButton;
- private JLabel httpSecurityAuthNLabel;
- private JRadioButton wsSecurityAuthNRadioButton;
- private JLabel wsSecurityAuthNLabel;
-
- // Password types
- private final String PLAINTEXT_PASSWORD = "Plaintext password";
- private final String DIGEST_PASSWORD = "Digest password";
- private String[] passwordTypes = new String[] { PLAINTEXT_PASSWORD, DIGEST_PASSWORD };
- private String[] tooltips = new String[] {
- "Password will be sent in plaintext (which is OK if service is using HTTPS)",
- "Password will be digested (cryptographically hashed) before sending" };
- private JComboBox<String> passwordTypeComboBox;
- private JCheckBox addTimestampCheckBox;
- private JButton setHttpUsernamePasswordButton;
- private JButton setWsdlUsernamePasswordButton;
-
- // private Logger logger = Logger.getLogger(WSDLActivityConfigurationView.class);
-
- public WSDLActivityConfigurationView(Activity activity, CredentialManager credentialManager) {
- super(activity);
- this.credentialManager = credentialManager;
- initialise();
- }
-
- @Override
- protected void initialise() {
- super.initialise();
-
- int gridy = 0;
-
- // title panel
- JPanel titlePanel = new JPanel(new BorderLayout());
- titlePanel.setBackground(Color.WHITE);
- JLabel titleLabel = new JLabel("Security configuration");
- titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
- titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
- DialogTextArea titleMessage = new DialogTextArea(
- "Select a security profile for the service");
- titleMessage.setMargin(new Insets(5, 20, 10, 10));
- titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
- titleMessage.setEditable(false);
- titleMessage.setFocusable(false);
- titlePanel.setBorder(new EmptyBorder(10, 10, 0, 10));
- titlePanel.add(titleLabel, BorderLayout.NORTH);
- titlePanel.add(titleMessage, BorderLayout.CENTER);
- addDivider(titlePanel, SwingConstants.BOTTOM, true);
-
- // Main panel
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
-
- // Create the radio buttons
- noSecurityRadioButton = new JRadioButton("None");
- noSecurityRadioButton.addItemListener(this);
-
- wsSecurityAuthNRadioButton = new JRadioButton(
- "WS-Security username and password authentication");
- wsSecurityAuthNRadioButton.addItemListener(this);
-
- httpSecurityAuthNRadioButton = new JRadioButton("HTTP username and password authentication");
- httpSecurityAuthNRadioButton.addItemListener(this);
-
- // Group the radio buttons
- buttonGroup = new ButtonGroup();
- buttonGroup.add(noSecurityRadioButton);
- buttonGroup.add(wsSecurityAuthNRadioButton);
- buttonGroup.add(httpSecurityAuthNRadioButton);
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.weightx = 1.0;
- gbc.weighty = 0.0;
-
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 0);
- mainPanel.add(noSecurityRadioButton, gbc);
-
- noSecurityLabel = new JLabel("Service requires no security");
- noSecurityLabel.setFont(noSecurityLabel.getFont().deriveFont(11f));
- // addDivider(noSecurityLabel, SwingConstants.BOTTOM, false);
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(0, 40, 10, 10);
- mainPanel.add(noSecurityLabel, gbc);
-
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 0);
- mainPanel.add(httpSecurityAuthNRadioButton, gbc);
-
- ActionListener usernamePasswordListener = new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- // Get Credential Manager UI to get the username and password for the service
- if (credManagerUI == null) {
- credManagerUI = new CredentialManagerUI(credentialManager);
- }
- credManagerUI.newPasswordForService(URI.create(getJson().get("operation")
- .get("wsdl").textValue()));
- }
- };
-
- httpSecurityAuthNLabel = new JLabel(
- "Service requires HTTP username and password in order to authenticate the user");
- httpSecurityAuthNLabel.setFont(httpSecurityAuthNLabel.getFont().deriveFont(11f));
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(0, 40, 10, 10);
- mainPanel.add(httpSecurityAuthNLabel, gbc);
-
- // Set username and password button;
- setHttpUsernamePasswordButton = new JButton("Set username and password");
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.EAST;
- gbc.insets = new Insets(0, 40, 10, 10);
- gbc.weightx = 1.0;
- gbc.weighty = 1.0; // add any vertical space to this component
- mainPanel.add(setHttpUsernamePasswordButton, gbc);
- setHttpUsernamePasswordButton.addActionListener(usernamePasswordListener);
-
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 0);
- mainPanel.add(wsSecurityAuthNRadioButton, gbc);
-
- wsSecurityAuthNLabel = new JLabel(
- "Service requires WS-Security username and password in order to authenticate the user");
- wsSecurityAuthNLabel.setFont(wsSecurityAuthNLabel.getFont().deriveFont(11f));
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(0, 40, 0, 0);
- mainPanel.add(wsSecurityAuthNLabel, gbc);
-
- // Password type list
- passwordTypeComboBox = new JComboBox<>(passwordTypes);
- passwordTypeComboBox.setRenderer(new ComboBoxTooltipRenderer());
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(10, 40, 0, 0);
- mainPanel.add(passwordTypeComboBox, gbc);
-
- // 'Add timestamp' checkbox
- addTimestampCheckBox = new JCheckBox("Add a timestamp to SOAP message");
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 40, 10, 10);
- mainPanel.add(addTimestampCheckBox, gbc);
-
- // Set username and password button;
- setWsdlUsernamePasswordButton = new JButton("Set username and password");
- gbc.gridx = 0;
- gbc.gridy = gridy++;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.EAST;
- gbc.insets = new Insets(0, 40, 10, 10);
- gbc.weightx = 1.0;
- gbc.weighty = 1.0; // add any vertical space to this component
- mainPanel.add(setWsdlUsernamePasswordButton, gbc);
- setWsdlUsernamePasswordButton.addActionListener(usernamePasswordListener);
-
- addDivider(mainPanel, SwingConstants.BOTTOM, true);
-
- // Enable/disable controls based on what is the current security profiles
- if (!getJson().has("securityProfile")) {
- noSecurityRadioButton.setSelected(true);
- } else {
- URI securityProfile = URI.create(getJson().get("securityProfile").textValue());
- if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
- wsSecurityAuthNRadioButton.setSelected(true);
- }
- if (securityProfile.equals(SecurityProfiles.HTTP_BASIC_AUTHN)
- || securityProfile.equals(SecurityProfiles.HTTP_DIGEST_AUTHN)) {
- httpSecurityAuthNRadioButton.setSelected(true);
- }
- if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
- passwordTypeComboBox.setSelectedItem(PLAINTEXT_PASSWORD);
- } else if (securityProfile
- .equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) {
- passwordTypeComboBox.setSelectedItem(DIGEST_PASSWORD);
- }
- if (securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)
- || securityProfile
- .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) {
- addTimestampCheckBox.setSelected(true);
- } else {
- addTimestampCheckBox.setSelected(false);
- }
- }
-
- // Put everything together
- JPanel layoutPanel = new JPanel(new BorderLayout());
- layoutPanel.add(titlePanel, BorderLayout.NORTH);
- layoutPanel.add(mainPanel, BorderLayout.CENTER);
- layoutPanel.setPreferredSize(new Dimension(550, 400));
-
- add(layoutPanel);
- }
-
- @Override
- public boolean checkValues() {
- return true;
- }
-
- @Override
- public void noteConfiguration() {
-
- if (noSecurityRadioButton.isSelected()) {
- getJson().remove("securityProfile"); // no security required
- } else if (httpSecurityAuthNRadioButton.isSelected()) {
- getJson().put("securityProfile", SecurityProfiles.HTTP_BASIC_AUTHN.toString());
- } else if (wsSecurityAuthNRadioButton.isSelected()) { // plaintext password
- if (passwordTypeComboBox.getSelectedItem().equals(PLAINTEXT_PASSWORD)) {
- if (addTimestampCheckBox.isSelected()) {
- getJson().put(
- "securityProfile",
- SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD
- .toString());
- } else {
- getJson().put("securityProfile",
- SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD.toString());
- }
- } else { // digest password
- if (addTimestampCheckBox.isSelected()) {
- getJson().put(
- "securityProfile",
- SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD
- .toString());
- } else {
- getJson().put("securityProfile",
- SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD.toString());
- }
- }
- }
- }
-
- /**
- * Disable/enable items on the panel based on this radio button
- * has been selected.
- */
- public void itemStateChanged(ItemEvent e) {
-
- Object source = e.getItemSelectable();
- if (source == noSecurityRadioButton) {
- httpSecurityAuthNLabel.setEnabled(false);
- wsSecurityAuthNLabel.setEnabled(false);
- passwordTypeComboBox.setEnabled(false);
- setHttpUsernamePasswordButton.setEnabled(false);
- setWsdlUsernamePasswordButton.setEnabled(false);
- addTimestampCheckBox.setEnabled(false);
-
- noSecurityLabel.setEnabled(true);
- } else if (source == httpSecurityAuthNRadioButton) {
- noSecurityLabel.setEnabled(false);
- httpSecurityAuthNLabel.setEnabled(true);
- wsSecurityAuthNLabel.setEnabled(false);
- passwordTypeComboBox.setEnabled(false);
- setHttpUsernamePasswordButton.setEnabled(true);
- setWsdlUsernamePasswordButton.setEnabled(false);
- addTimestampCheckBox.setEnabled(false);
- } else if (source == wsSecurityAuthNRadioButton) {
- noSecurityLabel.setEnabled(false);
- httpSecurityAuthNLabel.setEnabled(false);
- wsSecurityAuthNLabel.setEnabled(true);
- passwordTypeComboBox.setEnabled(true);
- setHttpUsernamePasswordButton.setEnabled(false);
- setWsdlUsernamePasswordButton.setEnabled(true);
- addTimestampCheckBox.setEnabled(true);
- }
- }
-
- /**
- * A renderer for JComboBox that will display a tooltip for
- * the selected item.
- */
- class ComboBoxTooltipRenderer extends BasicComboBoxRenderer {
- public Component getListCellRendererComponent(JList list, Object value, int index,
- boolean isSelected, boolean cellHasFocus) {
- if (isSelected) {
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
- if (-1 < index) {
- list.setToolTipText(tooltips[index]);
- }
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
- }
- setFont(list.getFont());
- setText((value == null) ? "" : value.toString());
- return this;
- }
- }
-
- /**
- * Adds a light gray or etched border to the top or bottom of a JComponent.
- *
- * @author David Withers
- * @param component
- */
- protected void addDivider(JComponent component, final int position, final boolean etched) {
- component.setBorder(new Border() {
- private final Color borderColor = new Color(.6f, .6f, .6f);
-
- public Insets getBorderInsets(Component c) {
- if (position == SwingConstants.TOP) {
- return new Insets(5, 0, 0, 0);
- } else {
- return new Insets(0, 0, 5, 0);
- }
- }
-
- public boolean isBorderOpaque() {
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- if (position == SwingConstants.TOP) {
- if (etched) {
- g.setColor(borderColor);
- g.drawLine(x, y, x + width, y);
- g.setColor(Color.WHITE);
- g.drawLine(x, y + 1, x + width, y + 1);
- } else {
- g.setColor(Color.LIGHT_GRAY);
- g.drawLine(x, y, x + width, y);
- }
- } else {
- if (etched) {
- g.setColor(borderColor);
- g.drawLine(x, y + height - 2, x + width, y + height - 2);
- g.setColor(Color.WHITE);
- g.drawLine(x, y + height - 1, x + width, y + height - 1);
- } else {
- g.setColor(Color.LIGHT_GRAY);
- g.drawLine(x, y + height - 1, x + width, y + height - 1);
- }
- }
- }
-
- });
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityContextualView.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityContextualView.java
deleted file mode 100644
index ac129ec..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityContextualView.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.views;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.activities.wsdl.actions.WSDLActivityConfigureAction;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-@SuppressWarnings("serial")
-public class WSDLActivityContextualView extends AbstractXMLSplitterActionView {
-
- private final ActivityIconManager activityIconManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
- private final CredentialManager credentialManager;
- private final FileManager fileManager;
-
- public WSDLActivityContextualView(Activity activity, EditManager editManager, FileManager fileManager,
- SelectionManager selectionManager, ActivityIconManager activityIconManager,
- ColourManager colourManager, CredentialManager credentialManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry) {
- super(activity, editManager, selectionManager, colourManager);
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.credentialManager = credentialManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- /**
- * Gets the component from the {@link HTMLBasedActivityContextualView} and adds buttons to it
- * allowing XML splitters to be added
- */
- @Override
- public JComponent getMainFrame() {
- final JComponent mainFrame = super.getMainFrame();
- JPanel flowPanel = new JPanel(new FlowLayout());
-
- addInputSplitter(mainFrame, flowPanel);
- addOutputSplitter(mainFrame, flowPanel);
-
- mainFrame.add(flowPanel, BorderLayout.SOUTH);
- return mainFrame;
- }
-
- @Override
- public String getViewTitle() {
- return "WSDL-based service";
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- JsonNode operation = getConfigBean().getJson().get("operation");
- String summary = "<tr><td>WSDL</td><td>" + operation.get("wsdl").textValue();
- summary += "</td></tr><tr><td>Operation</td><td>" + operation.get("name").textValue()
- + "</td></tr>";
- boolean securityConfigured = getConfigBean().getJson().has("securityProfile");
- summary += "<tr><td>Secure</td><td>" + securityConfigured + "</td></tr>";
- summary += "</tr>";
- summary += describePorts();
- return summary;
- }
-
- @Override
- public Action getConfigureAction(Frame owner) {
- return new WSDLActivityConfigureAction(getActivity(), owner, editManager, fileManager,
- activityIconManager, serviceDescriptionRegistry, credentialManager);
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityViewFactory.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityViewFactory.java
deleted file mode 100644
index b3fb8ed..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityViewFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-public class WSDLActivityViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
- private SelectionManager selectionManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private CredentialManager credentialManager;
- private FileManager fileManager;
-
- public boolean canHandle(Object object) {
- return object instanceof Activity
- && ((Activity) object).getType().equals(WSDLServiceDescription.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays
- .asList(new ContextualView[] { new WSDLActivityContextualView(activity,
- editManager, fileManager, selectionManager, activityIconManager, colourManager,
- credentialManager, serviceDescriptionRegistry) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setCredentialManager(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterContextualView.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterContextualView.java
deleted file mode 100644
index 228edd4..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterContextualView.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.views;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public class XMLSplitterContextualView extends AbstractXMLSplitterActionView {
-
- public XMLSplitterContextualView(Activity activity,
- EditManager editManager, SelectionManager selectionManager, ColourManager colourManager) {
- super(activity, editManager, selectionManager, colourManager);
- }
-
- static Logger logger = Logger.getLogger(XMLSplitterContextualView.class);
-
- /**
- * Gets the component from the {@link HTMLBasedActivityContextualView} and adds buttons to it
- * allowing XML splitters to be added
- */
- @Override
- public JComponent getMainFrame() {
- final JComponent mainFrame = super.getMainFrame();
- JPanel flowPanel = new JPanel(new FlowLayout());
-
- addInputSplitter(mainFrame, flowPanel);
- addOutputSplitter(mainFrame, flowPanel);
- mainFrame.add(flowPanel, BorderLayout.SOUTH);
- return mainFrame;
- }
-
- @Override
- public String getViewTitle() {
- return "XML splitter";
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- return describePorts();
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterViewFactory.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterViewFactory.java
deleted file mode 100644
index d0d5f8f..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterViewFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLInputSplitterActivity;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLOutputSplitterActivity;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-public class XMLSplitterViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private SelectionManager selectionManager;
- private ColourManager colourManager;
-
- public boolean canHandle(Object object) {
-
- return object instanceof Activity
- && (((Activity) object).getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)
- || ((Activity) object).getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE));
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays.asList(new ContextualView[] { new XMLSplitterContextualView(activity,
- editManager, selectionManager, colourManager) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AbstractAddXMLSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
new file mode 100644
index 0000000..fd5b494
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
@@ -0,0 +1,155 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.AbstractAction;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.wsdl.parser.ArrayTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+
+import org.apache.log4j.Logger;
+import org.jdom.JDOMException;
+import org.xml.sax.SAXException;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * Abstract superclass of {@link AddXMLOutputSplitterAction} and
+ * {@link AddXMLInputSplitterAction}.
+ * <p>
+ * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
+ * that is selected is added as an input/output splitter to the currently open
+ * dataflow using the {@link AddXMLSplitterEdit}
+ *
+ * @author Ian Dunlop
+ * @author Stian Soiland-Reyes
+ * @author Stuart Owen
+ *
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractAddXMLSplitterAction extends AbstractAction {
+
+ private static Logger logger = Logger.getLogger(AddXMLOutputSplitterAction.class);
+
+ protected Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ protected JComponent owner;
+ protected final Activity activity;
+ protected final EditManager editManager;
+ protected final SelectionManager selectionManager;
+
+ public AbstractAddXMLSplitterAction(Activity activity,
+ JComponent owner, EditManager editManager, SelectionManager selectionManager) {
+ this.activity = activity;
+ this.owner = owner;
+ this.editManager = editManager;
+ this.selectionManager = selectionManager;
+ }
+
+ public void actionPerformed(ActionEvent ev) {
+ List<String> possibilities;
+ Map<String, TypeDescriptor> typeDescriptors;
+ try {
+ typeDescriptors = getTypeDescriptors();
+ } catch (UnknownOperationException ex) {
+ logger.error("Can't find operation for activity "
+ + activity, ex);
+ return;
+ } catch (IOException | ParserConfigurationException | WSDLException | SAXException | JDOMException ex) {
+ logger.error("Can't read definition for activity "
+ + activity, ex);
+ return;
+ }
+
+ typeDescriptors = filterDescriptors(typeDescriptors);
+
+ possibilities = new ArrayList<String>(typeDescriptors.keySet());
+ if (possibilities.isEmpty()) {
+ logger.warn("No type descriptors found for activity " + activity);
+ return;
+ }
+ Collections.sort(possibilities);
+
+ String portName = (String) JOptionPane.showInputDialog(owner,
+ "Select the port to add the splitter to",
+ "Add output XML splitter", JOptionPane.PLAIN_MESSAGE, null,
+ possibilities.toArray(), possibilities.get(0));
+
+ Workflow workflow = selectionManager.getSelectedWorkflow();
+ Profile profile = selectionManager.getSelectedProfile();
+ TypeDescriptor typeDescriptorForPort = typeDescriptors
+ .get(portName);
+
+ if (typeDescriptorForPort instanceof ArrayTypeDescriptor
+ || typeDescriptorForPort instanceof ComplexTypeDescriptor) {
+ AddXMLSplitterEdit edit = new AddXMLSplitterEdit(workflow, profile,
+ activity, typeDescriptorForPort, portName, isInput());
+ try {
+ editManager.doDataflowEdit(workflow.getParent(), edit);
+ } catch (EditException ex) {
+ logger.error("Could not perform edit to add " + portName, ex);
+ }
+ } else {
+ logger.warn("Unknown typedescriptor for " + portName);
+ }
+ }
+
+ public static Map<String, TypeDescriptor> filterDescriptors(
+ Map<String, TypeDescriptor> descriptors) {
+ Map<String, TypeDescriptor> filtered = new HashMap<String, TypeDescriptor>();
+ for (Entry<String, TypeDescriptor> entry : descriptors.entrySet()) {
+ TypeDescriptor descriptor = entry.getValue();
+ if (descriptor.getMimeType().contains("'text/xml'")) {
+ filtered.put(entry.getKey(), descriptor);
+ }
+ }
+ return filtered;
+ }
+
+ protected abstract boolean isInput();
+
+ public abstract Map<String, TypeDescriptor> getTypeDescriptors()
+ throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException;
+
+ public void setOwner(JComponent owner) {
+ this.owner = owner;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLInputSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLInputSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLInputSplitterAction.java
new file mode 100644
index 0000000..784edae
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLInputSplitterAction.java
@@ -0,0 +1,102 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.wsdl.parser.ArrayTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.xml.sax.SAXException;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
+ * that is selected is added as an input splitter to the currently open dataflow
+ * using the {@link AddXMLSplitterEdit}
+ *
+ * @author Ian Dunlop
+ * @author Stian Soiland-Reyes
+ */
+@SuppressWarnings("serial")
+public class AddXMLInputSplitterAction extends AbstractAddXMLSplitterAction {
+
+ public AddXMLInputSplitterAction(Activity activity, JComponent owner, EditManager editManager,
+ SelectionManager selectionManager) {
+ super(activity, owner, editManager, selectionManager);
+ putValue(NAME, "Add input XML splitter");
+ }
+
+ @Override
+ public Map<String, TypeDescriptor> getTypeDescriptors() throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException {
+ Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>();
+ Configuration configuration = scufl2Tools.configurationFor(activity, selectionManager.getSelectedProfile());
+ if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
+ String wsdlLocation = configuration.getJson().get("operation").get("wsdl").textValue();
+ String operationName = configuration.getJson().get("operation").get("name").textValue();
+ List<TypeDescriptor> inputDescriptors = new WSDLParser(wsdlLocation)
+ .getOperationInputParameters(operationName);
+ for (TypeDescriptor descriptor : inputDescriptors) {
+ descriptors.put(descriptor.getName(), descriptor);
+ }
+ } else if (activity.getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
+ String wrappedType = configuration.getJson().get("wrappedType").textValue();
+ Element element = new SAXBuilder().build(new StringReader(wrappedType)).getRootElement();
+ TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
+ if (typeDescriptor instanceof ComplexTypeDescriptor) {
+ for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) {
+ descriptors.put(desc.getName(), desc);
+ }
+ }
+ else if (typeDescriptor instanceof ArrayTypeDescriptor) {
+ TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType();
+ descriptors.put(typeDescriptor.getName(), desc);
+ }
+ }
+ return descriptors;
+ }
+
+ @Override
+ protected boolean isInput() {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLOutputSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLOutputSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLOutputSplitterAction.java
new file mode 100644
index 0000000..f94a485
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/org/apache/taverna/activities/wsdl/actions/AddXMLOutputSplitterAction.java
@@ -0,0 +1,103 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.wsdl.actions;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.wsdl.WSDLException;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.xml.sax.SAXException;
+
+import org.apache.taverna.activities.wsdl.servicedescriptions.WSDLServiceDescription;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.wsdl.parser.ArrayTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+import org.apache.taverna.wsdl.parser.TypeDescriptor;
+import org.apache.taverna.wsdl.parser.UnknownOperationException;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import org.apache.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
+ * that is selected is added as an output splitter to the currently open
+ * dataflow using the {@link AddXMLSplitterEdit}
+ *
+ * @author Ian Dunlop
+ * @author Stian Soiland-Reyes
+ */
+@SuppressWarnings("serial")
+public class AddXMLOutputSplitterAction extends AbstractAddXMLSplitterAction {
+
+ public AddXMLOutputSplitterAction(Activity activity, JComponent owner, EditManager editManager,
+ SelectionManager selectionManager) {
+ super(activity, owner, editManager, selectionManager);
+ putValue(NAME, "Add output XML splitter");
+
+ }
+
+ @Override
+ public Map<String, TypeDescriptor> getTypeDescriptors() throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException {
+ Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>();
+ Configuration configuration = scufl2Tools.configurationFor(activity, selectionManager.getSelectedProfile());
+ if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
+ String wsdlLocation = configuration.getJson().get("operation").get("wsdl").textValue();
+ String operationName = configuration.getJson().get("operation").get("name").textValue();
+ List<TypeDescriptor> inputDescriptors = new WSDLParser(wsdlLocation)
+ .getOperationOutputParameters(operationName);
+ for (TypeDescriptor descriptor : inputDescriptors) {
+ descriptors.put(descriptor.getName(), descriptor);
+ }
+ } else if (activity.getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
+ String wrappedType = configuration.getJson().get("wrappedType").textValue();
+ Element element = new SAXBuilder().build(new StringReader(wrappedType)).getRootElement();
+ TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
+ if (typeDescriptor instanceof ComplexTypeDescriptor) {
+ for (TypeDescriptor desc : ((ComplexTypeDescriptor) typeDescriptor)
+ .getElements()) {
+ descriptors.put(desc.getName(), desc);
+ }
+ }
+ else if (typeDescriptor instanceof ArrayTypeDescriptor) {
+ TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType();
+ descriptors.put(typeDescriptor.getName(), desc);
+ }
+ }
+ return descriptors;
+ }
+
+ @Override
+ protected boolean isInput() {
+ return false;
+ }
+
+}
[09/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigView.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigView.java
new file mode 100644
index 0000000..41810bf
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportConfigView.java
@@ -0,0 +1,1081 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.views;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.Stack;
+
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableColumn;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.PlainDocument;
+
+import org.apache.taverna.activities.spreadsheet.Range;
+import org.apache.taverna.activities.spreadsheet.SpreadsheetUtils;
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.lang.ui.icons.Icons;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Configuration panel for the spreadsheet import activity.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class SpreadsheetImportConfigView extends ActivityConfigurationPanel {
+
+ private static final String INCONSISTENT_ROW_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.INCONSISTENT_ROW_MESSAGE");
+
+ private static final String INCONSISTENT_COLUMN_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.INCONSISTENT_COLUMN_MESSAGE");
+
+ private static final String FROM_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.FROM_COLUMN_ERROR_MESSAGE");
+
+ private static final String TO_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.TO_COLUMN_ERROR_MESSAGE");
+
+ private static final String FROM_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.FROM_ROW_ERROR_MESSAGE");
+
+ private static final String TO_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.TO_ROW_ERROR_MESSAGE");
+
+ private static final String DEFAULT_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.DEFAULT_MESSAGE");
+
+ private static final String EMPTY_FROM_ROW_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.EMPTY_FROM_ROW_ERROR_MESSAGE");
+
+ private static final String EMPTY_FROM_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.EMPTY_FROM_COLUMN_ERROR_MESSAGE");
+
+ private static final String EMPTY_TO_COLUMN_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.EMPTY_TO_COLUMN_ERROR_MESSAGE");
+
+ private static final String DUPLICATE_PORT_NAME_ERROR_MESSAGE = SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.DUPLICATE_PORT_NAME_ERROR_MESSAGE");
+
+ private static Logger logger = Logger.getLogger(SpreadsheetImportConfigView.class);
+
+ private JPanel titlePanel, contentPanel, buttonPanel, page1, page2;
+
+ private JLabel titleLabel, titleIcon, rowLabel, columnLabel;
+
+ private JLabel emptyCellLabel, outputFormatLabel, outputFormatDelimiterLabel, columnMappingLabel;
+
+ private DialogTextArea titleMessage;
+
+ private JTextField columnFromValue, columnToValue, rowFromValue, rowToValue;
+
+ private JTextField emptyCellUserDefinedValue, outputFormatDelimiter;
+
+ private JCheckBox rowSelectAllOption, rowExcludeFirstOption, rowIgnoreBlankRows;
+
+ private ButtonGroup emptyCellButtonGroup, outputFormatButtonGroup;
+
+ private JRadioButton emptyCellEmptyStringOption, emptyCellUserDefinedOption,
+ emptyCellErrorValueOption;
+
+ private JRadioButton outputFormatMultiplePort, outputFormatSinglePort;
+
+ private JTable columnMappingTable;
+
+ private SpreadsheetImportConfigTableModel columnMappingTableModel;
+
+ private JButton nextButton, backButton;
+
+ private CardLayout cardLayout = new CardLayout();
+
+ private Stack<String> warningMessages = new Stack<String>();
+
+ private Stack<String> errorMessages = new Stack<String>();
+
+ private ObjectNode newConfiguration;
+
+ private final ServiceRegistry serviceRegistry;
+
+ /**
+ * Constructs a configuration view for an SpreadsheetImport Activity.
+ *
+ * @param activity
+ */
+ public SpreadsheetImportConfigView(Activity activity, ServiceRegistry serviceRegistry) {
+ super(activity);
+ this.serviceRegistry = serviceRegistry;
+ initialise();
+ }
+
+ @Override
+ protected void initialise() {
+ super.initialise();
+ newConfiguration = getJson().deepCopy();
+
+ // title
+ titlePanel = new JPanel(new BorderLayout());
+ titlePanel.setBackground(Color.WHITE);
+ addDivider(titlePanel, SwingConstants.BOTTOM, true);
+
+ titleLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.panelTitle"));
+ titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
+ titleIcon = new JLabel("");
+ titleMessage = new DialogTextArea(DEFAULT_MESSAGE);
+ titleMessage.setMargin(new Insets(5, 10, 10, 10));
+ // titleMessage.setMinimumSize(new Dimension(0, 30));
+ titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
+ titleMessage.setEditable(false);
+ titleMessage.setFocusable(false);
+ // titleMessage.setFont(titleLabel.getFont().deriveFont(Font.PLAIN,
+ // 12f));
+
+ // column range
+ columnLabel = new JLabel(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.columnSectionLabel"));
+
+ JsonNode columnRange = newConfiguration.get("columnRange");
+ columnFromValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("start").intValue()), 4);
+ columnFromValue.setMinimumSize(columnFromValue.getPreferredSize());
+ columnToValue = new JTextField(new UpperCaseDocument(), SpreadsheetUtils.getColumnLabel(columnRange.get("end").intValue()), 4);
+ columnToValue.setMinimumSize(columnToValue.getPreferredSize());
+
+ columnFromValue.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ checkValue(columnFromValue.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ checkValue(columnFromValue.getText());
+ }
+
+ private void checkValue(String text) {
+ if (text.trim().equals("")) {
+ addErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
+ } else if (text.trim().matches("[A-Za-z]+")) {
+ String fromColumn = columnFromValue.getText().toUpperCase();
+ String toColumn = columnToValue.getText().toUpperCase();
+ int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn);
+ int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn);
+ if (checkColumnRange(fromColumnIndex, toColumnIndex)) {
+ columnMappingTableModel.setFromColumn(fromColumnIndex);
+ columnMappingTableModel.setToColumn(toColumnIndex);
+ newConfiguration.set("columnRange", newConfiguration.objectNode().put("start", fromColumnIndex).put("end", toColumnIndex));
+ validatePortNames();
+ }
+ removeErrorMessage(FROM_COLUMN_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
+ } else {
+ addErrorMessage(FROM_COLUMN_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_FROM_COLUMN_ERROR_MESSAGE);
+ }
+ }
+
+ });
+
+ columnToValue.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ checkValue(columnToValue.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ checkValue(columnToValue.getText());
+ }
+
+ private void checkValue(String text) {
+ if (text.trim().equals("")) {
+ addErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
+ } else if (text.trim().matches("[A-Za-z]+")) {
+ String fromColumn = columnFromValue.getText().toUpperCase();
+ String toColumn = columnToValue.getText().toUpperCase();
+ int fromColumnIndex = SpreadsheetUtils.getColumnIndex(fromColumn);
+ int toColumnIndex = SpreadsheetUtils.getColumnIndex(toColumn);
+ if (checkColumnRange(fromColumnIndex, toColumnIndex)) {
+ columnMappingTableModel.setFromColumn(fromColumnIndex);
+ columnMappingTableModel.setToColumn(toColumnIndex);
+ newConfiguration.set("columnRange", newConfiguration.objectNode().put("start", fromColumnIndex).put("end", toColumnIndex));
+ validatePortNames();
+ }
+ removeErrorMessage(TO_COLUMN_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
+
+ } else {
+ addErrorMessage(TO_COLUMN_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_TO_COLUMN_ERROR_MESSAGE);
+ }
+ }
+ });
+
+ // row range
+ rowLabel = new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.rowSectionLabel"));
+ addDivider(rowLabel, SwingConstants.TOP, false);
+
+ rowSelectAllOption = new JCheckBox(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.selectAllRowsOption"));
+ rowExcludeFirstOption = new JCheckBox(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.excludeHeaderRowOption"));
+ rowIgnoreBlankRows = new JCheckBox(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.ignoreBlankRowsOption"));
+ rowSelectAllOption.setFocusable(false);
+ rowExcludeFirstOption.setFocusable(false);
+
+ JsonNode rowRange = newConfiguration.get("rowRange");
+ rowFromValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("start").intValue() + 1), 4);
+ if (rowRange.get("end").intValue() == -1) {
+ rowToValue = new JTextField(new NumericDocument(), "", 4);
+ } else {
+ rowToValue = new JTextField(new NumericDocument(), String.valueOf(rowRange.get("end").intValue() + 1), 4);
+ }
+ rowFromValue.setMinimumSize(rowFromValue.getPreferredSize());
+ rowToValue.setMinimumSize(rowToValue.getPreferredSize());
+
+ if (newConfiguration.get("allRows").booleanValue()) {
+ rowSelectAllOption.setSelected(true);
+ rowFromValue.setEditable(false);
+ rowFromValue.setEnabled(false);
+ rowToValue.setEditable(false);
+ rowToValue.setEnabled(false);
+ } else {
+ rowExcludeFirstOption.setEnabled(false);
+ }
+ rowExcludeFirstOption.setSelected(newConfiguration.get("excludeFirstRow").booleanValue());
+ rowIgnoreBlankRows.setSelected(newConfiguration.get("ignoreBlankRows").booleanValue());
+
+ rowFromValue.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ checkValue(rowFromValue.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ checkValue(rowFromValue.getText());
+ }
+
+ private void checkValue(String text) {
+ if (text.trim().equals("")) {
+ addErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
+ } else if (text.trim().matches("[1-9][0-9]*")) {
+ checkRowRange(rowFromValue.getText(), rowToValue.getText());
+ int fromRow = Integer.parseInt(rowFromValue.getText());
+ ((ObjectNode) newConfiguration.get("rowRange")).put("start", fromRow - 1);
+ removeErrorMessage(FROM_ROW_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
+ } else {
+ addErrorMessage(FROM_ROW_ERROR_MESSAGE);
+ removeErrorMessage(EMPTY_FROM_ROW_ERROR_MESSAGE);
+ }
+ }
+ });
+
+ rowToValue.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ checkValue(rowToValue.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ checkValue(rowToValue.getText());
+ }
+
+ private void checkValue(String text) {
+ if (text.trim().equals("")) {
+ ((ObjectNode) newConfiguration.get("rowRange")).put("end", -1);
+ removeErrorMessage(TO_ROW_ERROR_MESSAGE);
+ removeErrorMessage(INCONSISTENT_ROW_MESSAGE);
+ } else if (text.trim().matches("[0-9]+")) {
+ checkRowRange(rowFromValue.getText(), rowToValue.getText());
+ int toRow = Integer.parseInt(rowToValue.getText());
+ ((ObjectNode) newConfiguration.get("rowRange")).put("end", toRow - 1);
+ removeErrorMessage(TO_ROW_ERROR_MESSAGE);
+ } else {
+ addErrorMessage(TO_ROW_ERROR_MESSAGE);
+ }
+ }
+ });
+
+ rowSelectAllOption.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ newConfiguration.put("allRows", true);
+ rowExcludeFirstOption.setEnabled(true);
+ if (rowExcludeFirstOption.isSelected()) {
+ rowFromValue.setText("2");
+ } else {
+ rowFromValue.setText("1");
+ }
+ rowToValue.setText("");
+ rowFromValue.setEditable(false);
+ rowFromValue.setEnabled(false);
+ rowToValue.setEditable(false);
+ rowToValue.setEnabled(false);
+ } else {
+ newConfiguration.put("allRows", false);
+ rowExcludeFirstOption.setEnabled(false);
+ rowFromValue.setEditable(true);
+ rowFromValue.setEnabled(true);
+ rowToValue.setEditable(true);
+ rowToValue.setEnabled(true);
+ }
+ }
+ });
+
+ rowExcludeFirstOption.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ newConfiguration.put("excludeFirstRow", true);
+ rowFromValue.setText("2");
+ ((ObjectNode) newConfiguration.get("rowRange")).put("start", 1);
+ } else {
+ newConfiguration.put("excludeFirstRow", false);
+ rowFromValue.setText("1");
+ ((ObjectNode) newConfiguration.get("rowRange")).put("start", 0);
+ }
+ }
+ });
+
+ rowIgnoreBlankRows.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ newConfiguration.put("ignoreBlankRows", e.getStateChange() == ItemEvent.SELECTED);
+ }
+ });
+
+ // empty cells
+ emptyCellLabel = new JLabel(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.emptyCellSectionLabel"));
+ addDivider(emptyCellLabel, SwingConstants.TOP, false);
+
+ emptyCellButtonGroup = new ButtonGroup();
+ emptyCellEmptyStringOption = new JRadioButton(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.emptyStringOption"));
+ emptyCellUserDefinedOption = new JRadioButton(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.userDefinedOption"));
+ emptyCellErrorValueOption = new JRadioButton(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.generateErrorOption"));
+ emptyCellEmptyStringOption.setFocusable(false);
+ emptyCellUserDefinedOption.setFocusable(false);
+ emptyCellErrorValueOption.setFocusable(false);
+
+ emptyCellUserDefinedValue = new JTextField(newConfiguration.get("emptyCellValue").textValue());
+
+ emptyCellButtonGroup.add(emptyCellEmptyStringOption);
+ emptyCellButtonGroup.add(emptyCellUserDefinedOption);
+ emptyCellButtonGroup.add(emptyCellErrorValueOption);
+
+ if (newConfiguration.get("emptyCellPolicy").textValue().equals("GENERATE_ERROR")) {
+ emptyCellErrorValueOption.setSelected(true);
+ emptyCellUserDefinedValue.setEnabled(false);
+ emptyCellUserDefinedValue.setEditable(false);
+ } else if (newConfiguration.get("emptyCellPolicy").textValue().equals("EMPTY_STRING")) {
+ emptyCellEmptyStringOption.setSelected(true);
+ emptyCellUserDefinedValue.setEnabled(false);
+ emptyCellUserDefinedValue.setEditable(false);
+ } else {
+ emptyCellUserDefinedOption.setSelected(true);
+ emptyCellUserDefinedValue.setText(newConfiguration.get("emptyCellValue").textValue());
+ emptyCellUserDefinedValue.setEnabled(true);
+ emptyCellUserDefinedValue.setEditable(true);
+ }
+
+ emptyCellEmptyStringOption.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ newConfiguration.put("emptyCellPolicy", "EMPTY_STRING");
+ emptyCellUserDefinedValue.setEnabled(false);
+ emptyCellUserDefinedValue.setEditable(false);
+ }
+ });
+ emptyCellUserDefinedOption.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ newConfiguration.put("emptyCellPolicy", "USER_DEFINED");
+ emptyCellUserDefinedValue.setEnabled(true);
+ emptyCellUserDefinedValue.setEditable(true);
+ emptyCellUserDefinedValue.requestFocusInWindow();
+ }
+ });
+ emptyCellErrorValueOption.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ newConfiguration.put("emptyCellPolicy", "GENERATE_ERROR");
+ emptyCellUserDefinedValue.setEnabled(false);
+ emptyCellUserDefinedValue.setEditable(false);
+ }
+ });
+
+ emptyCellUserDefinedValue.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ newConfiguration.put("emptyCellValue", emptyCellUserDefinedValue.getText());
+ }
+ });
+
+ // column mappings
+ columnMappingLabel = new JLabel(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.columnMappingSectionLabel"));
+ addDivider(columnMappingLabel, SwingConstants.TOP, false);
+
+ Map<String, String> columnToPortMapping = new HashMap<>();
+ if (newConfiguration.has("columnNames")) {
+ for (JsonNode columnName : newConfiguration.get("columnNames")) {
+ columnToPortMapping.put(columnName.get("column").textValue(), columnName.get("port").textValue());
+ }
+ }
+ columnMappingTableModel = new SpreadsheetImportConfigTableModel(columnFromValue.getText(),
+ columnToValue.getText(), columnToPortMapping);
+
+ columnMappingTable = new JTable();
+ columnMappingTable.setRowSelectionAllowed(false);
+ columnMappingTable.getTableHeader().setReorderingAllowed(false);
+ columnMappingTable.setGridColor(Color.LIGHT_GRAY);
+ // columnMappingTable.setFocusable(false);
+
+ columnMappingTable.setColumnModel(new DefaultTableColumnModel() {
+ public TableColumn getColumn(int columnIndex) {
+ TableColumn column = super.getColumn(columnIndex);
+ if (columnIndex == 0) {
+ column.setMaxWidth(100);
+ }
+ return column;
+ }
+ });
+
+ TableCellEditor defaultEditor = columnMappingTable.getDefaultEditor(String.class);
+ if (defaultEditor instanceof DefaultCellEditor) {
+ DefaultCellEditor defaultCellEditor = (DefaultCellEditor) defaultEditor;
+ defaultCellEditor.setClickCountToStart(1);
+ Component editorComponent = defaultCellEditor.getComponent();
+ if (editorComponent instanceof JTextComponent) {
+ final JTextComponent textField = (JTextComponent) editorComponent;
+ textField.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ updateModel(textField.getText());
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ updateModel(textField.getText());
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ updateModel(textField.getText());
+ }
+
+ private void updateModel(String text) {
+ int row = columnMappingTable.getEditingRow();
+ int column = columnMappingTable.getEditingColumn();
+ columnMappingTableModel.setValueAt(text, row, column);
+
+ ArrayNode columnNames = newConfiguration.arrayNode();
+ Map<String, String> columnToPortMapping = columnMappingTableModel.getColumnToPortMapping();
+ for (Entry<String,String> entry : columnToPortMapping.entrySet()) {
+ columnNames.add(newConfiguration.objectNode().put("column", entry.getKey()).put("port", entry.getValue()));
+ }
+ newConfiguration.put("columnNames", columnNames);
+ validatePortNames();
+ }
+
+ });
+ }
+ }
+
+ columnMappingTable.setModel(columnMappingTableModel);
+
+ // output format
+ outputFormatLabel = new JLabel(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.outputFormatSectionLabel"));
+
+ outputFormatMultiplePort = new JRadioButton(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.multiplePortOption"));
+ outputFormatSinglePort = new JRadioButton(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.singlePortOption"));
+ outputFormatMultiplePort.setFocusable(false);
+ outputFormatSinglePort.setFocusable(false);
+
+ outputFormatDelimiterLabel = new JLabel(SpreadsheetImportUIText
+ .getString("SpreadsheetImportConfigView.userDefinedCsvDelimiter"));
+ outputFormatDelimiter = new JTextField(newConfiguration.get("csvDelimiter").textValue(), 5);
+
+ outputFormatButtonGroup = new ButtonGroup();
+ outputFormatButtonGroup.add(outputFormatMultiplePort);
+ outputFormatButtonGroup.add(outputFormatSinglePort);
+
+ if (newConfiguration.get("outputFormat").textValue().equals("PORT_PER_COLUMN")) {
+ outputFormatMultiplePort.setSelected(true);
+ outputFormatDelimiterLabel.setEnabled(false);
+ outputFormatDelimiter.setEnabled(false);
+ } else {
+ outputFormatSinglePort.setSelected(true);
+ columnMappingLabel.setEnabled(false);
+ enableTable(columnMappingTable, false);
+ }
+
+ outputFormatMultiplePort.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ outputFormatDelimiterLabel.setEnabled(false);
+ outputFormatDelimiter.setEnabled(false);
+ columnMappingLabel.setEnabled(true);
+ enableTable(columnMappingTable, true);
+ newConfiguration.put("outputFormat", "PORT_PER_COLUMN");
+ }
+ });
+ outputFormatSinglePort.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ outputFormatDelimiterLabel.setEnabled(true);
+ outputFormatDelimiter.setEnabled(true);
+ columnMappingLabel.setEnabled(false);
+ enableTable(columnMappingTable, false);
+ newConfiguration.put("outputFormat", "SINGLE_PORT");
+ }
+
+ });
+ outputFormatDelimiter.getDocument().addDocumentListener(new DocumentListener() {
+ public void changedUpdate(DocumentEvent e) {
+ handleUpdate();
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ handleUpdate();
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ handleUpdate();
+ }
+
+ private void handleUpdate() {
+ String text = null;
+ try {
+ text = StringEscapeUtils.unescapeJava(outputFormatDelimiter.getText());
+ } catch (RuntimeException re) {}
+ if (text == null || text.length() == 0) {
+ newConfiguration.put("csvDelimiter", ",");
+ } else {
+ newConfiguration.put("csvDelimiter", text.substring(0, 1));
+ }
+ }
+
+ });
+
+ // buttons
+ nextButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.nextButton"));
+ nextButton.setFocusable(false);
+ nextButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ backButton.setVisible(true);
+ nextButton.setVisible(false);
+ cardLayout.last(contentPanel);
+ }
+ });
+
+ backButton = new JButton(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.backButton"));
+ backButton.setFocusable(false);
+ backButton.setVisible(false);
+ backButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ nextButton.setVisible(true);
+ backButton.setVisible(false);
+ cardLayout.first(contentPanel);
+ }
+ });
+
+ buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+ addDivider(buttonPanel, SwingConstants.TOP, true);
+
+ removeAll();
+ layoutPanel();
+ }
+
+ @Override
+ public void noteConfiguration() {
+ setJson(newConfiguration);
+ configureInputPorts(serviceRegistry);
+ configureOutputPorts(serviceRegistry);
+ }
+
+ @Override
+ public boolean checkValues() {
+ return errorMessages.isEmpty();
+ }
+
+ private void layoutPanel() {
+ setPreferredSize(new Dimension(450, 400));
+ setLayout(new BorderLayout());
+
+ page1 = new JPanel(new GridBagLayout());
+ page2 = new JPanel(new GridBagLayout());
+
+ contentPanel = new JPanel(cardLayout);
+ contentPanel.add(page1, "page1");
+ contentPanel.add(page2, "page2");
+ add(contentPanel, BorderLayout.CENTER);
+
+ // title
+ titlePanel.setBorder(new CompoundBorder(titlePanel.getBorder(), new EmptyBorder(10, 10, 0, 10)));
+ add(titlePanel, BorderLayout.NORTH);
+ titlePanel.add(titleLabel, BorderLayout.NORTH);
+ titlePanel.add(titleIcon, BorderLayout.WEST);
+ titlePanel.add(titleMessage, BorderLayout.CENTER);
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.gridx = 0;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+
+ // column range
+ c.insets = new Insets(10, 10, 0, 10);
+ page1.add(columnLabel, c);
+
+ c.insets = new Insets(10, 25, 0, 0);
+ c.gridwidth = 1;
+ c.weightx = 0;
+ page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
+ c.insets = new Insets(10, 0, 0, 0);
+ c.gridx = 1;
+ page1.add(columnFromValue, c);
+ c.gridx = 2;
+ page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
+ c.gridx = 3;
+ page1.add(columnToValue, c);
+
+ c.gridx = 0;
+ c.weightx = 1;
+ c.insets = new Insets(10, 10, 0, 10);
+ c.gridwidth = GridBagConstraints.REMAINDER;
+
+ // row range
+ page1.add(rowLabel, c);
+
+ c.insets = new Insets(10, 25, 0, 0);
+ c.gridwidth = 1;
+ c.gridx = 0;
+ c.weightx = 0;
+ page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
+ c.insets = new Insets(10, 0, 0, 0);
+ c.gridx = 1;
+ page1.add(rowFromValue, c);
+ c.gridx = 2;
+ page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
+ c.gridx = 3;
+ page1.add(rowToValue, c);
+ c.gridx = 4;
+ page1.add(rowSelectAllOption, c);
+ c.gridx = 5;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ c.insets = new Insets(10, 0, 0, 10);
+ page1.add(rowExcludeFirstOption, c);
+ c.insets = new Insets(10, 25, 0, 0);
+ c.gridx = 0;
+ page1.add(rowIgnoreBlankRows, c);
+
+ c.gridx = 0;
+
+ // empty cells
+ c.insets = new Insets(10, 10, 10, 10);
+ page1.add(emptyCellLabel, c);
+
+ c.insets = new Insets(0, 25, 0, 10);
+ page1.add(emptyCellEmptyStringOption, c);
+ JPanel userDefinedPanel = new JPanel(new BorderLayout());
+ userDefinedPanel.add(emptyCellUserDefinedOption, BorderLayout.WEST);
+ userDefinedPanel.add(emptyCellUserDefinedValue, BorderLayout.CENTER);
+ page1.add(userDefinedPanel, c);
+ c.weighty = 1;
+ c.anchor = GridBagConstraints.NORTHWEST;
+ page1.add(emptyCellErrorValueOption, c);
+
+ // output format
+ c.insets = new Insets(10, 10, 10, 10);
+ c.weighty = 0;
+ c.weightx = 1;
+ page2.add(outputFormatLabel, c);
+
+ c.insets = new Insets(0, 25, 0, 10);
+ page2.add(outputFormatMultiplePort, c);
+ page2.add(outputFormatSinglePort, c);
+
+ c.insets = new Insets(0, 50, 0, 10);
+ JPanel outputFormatDelimiterPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ outputFormatDelimiterPanel.add(outputFormatDelimiterLabel);
+ outputFormatDelimiterPanel.add(outputFormatDelimiter);
+ page2.add(outputFormatDelimiterPanel, c);
+
+ // column mapping
+ c.insets = new Insets(10, 10, 0, 10);
+ page2.add(columnMappingLabel, c);
+
+ c.insets = new Insets(10, 10, 10, 10);
+ c.fill = GridBagConstraints.BOTH;
+ c.weighty = 1;
+ page2.add(new JScrollPane(columnMappingTable), c);
+
+ buttonPanel.add(backButton);
+ buttonPanel.add(nextButton);
+ add(buttonPanel, BorderLayout.SOUTH);
+ }
+
+ /**
+ * Displays the message with no icon.
+ *
+ * @param message
+ * the message to display
+ */
+ public void setMessage(String message) {
+ titleIcon.setIcon(null);
+ titleMessage.setText(message);
+ }
+
+ /**
+ * Adds the message to the top of the warning message stack. If the message is already in the
+ * stack it is moved to the top. If there are no error messages the message is displayed.
+ *
+ * @param message
+ * the warning message to add
+ */
+ public void addWarningMessage(String message) {
+ if (warningMessages.contains(message)) {
+ warningMessages.remove(message);
+ }
+ warningMessages.push(message);
+ if (errorMessages.isEmpty()) {
+ setWarningMessage(message);
+ }
+ }
+
+ /**
+ * Removes the message from the warning message stack. If there are no error messages the next
+ * warning message is displayed. If there are no warning messages the default message is
+ * displayed.
+ *
+ * @param message
+ * the warning message to remove
+ */
+ public void removeWarningMessage(String message) {
+ warningMessages.remove(message);
+ if (errorMessages.isEmpty()) {
+ if (warningMessages.isEmpty()) {
+ setMessage(DEFAULT_MESSAGE);
+ } else {
+ setWarningMessage(warningMessages.peek());
+ }
+ }
+ }
+
+ /**
+ * Displays the message and a warning icon.
+ *
+ * @param message
+ * the warning message to display
+ */
+ public void setWarningMessage(String message) {
+ titleIcon.setIcon(Icons.warningIcon);
+ titleMessage.setText(message);
+ }
+
+ /**
+ * Adds the message to the top of the error message stack. If the message is already in the
+ * stack it is moved to the top. The message is then displayed.
+ *
+ * @param message
+ * the error message to add
+ */
+ public void addErrorMessage(String message) {
+ if (errorMessages.contains(message)) {
+ errorMessages.remove(message);
+ }
+ errorMessages.push(message);
+ setErrorMessage(message);
+ }
+
+ /**
+ * Removes the message from the error message stack and displays the next error message. If
+ * there are no error messages the next warning message is displayed. If there are no warning
+ * messages the default message is displayed.
+ *
+ * @param message
+ * the error message to remove
+ */
+ public void removeErrorMessage(String message) {
+ errorMessages.remove(message);
+ if (errorMessages.isEmpty()) {
+ if (warningMessages.isEmpty()) {
+ setMessage(DEFAULT_MESSAGE);
+ } else {
+ setWarningMessage(warningMessages.peek());
+ }
+ } else {
+ setErrorMessage(errorMessages.peek());
+ }
+ }
+
+ /**
+ * Displays the message and an error icon.
+ *
+ * @param message
+ * the error message to display
+ */
+ public void setErrorMessage(String message) {
+ titleIcon.setIcon(Icons.severeIcon);
+ titleMessage.setText(message);
+ }
+
+ protected boolean validatePortNames() {
+ boolean isValid = true;
+ Range columnRange = SpreadsheetUtils.getRange(newConfiguration.get("columnRange"));
+ Map<String, String> mapping = new HashMap<>();
+ if (newConfiguration.has("columnNames")) {
+ for (JsonNode columnName : newConfiguration.get("columnNames")) {
+ mapping.put(columnName.get("column").textValue(), columnName.get("port").textValue());
+ }
+ }
+ Set<String> usedNames = new HashSet<String>();
+ for (Entry<String, String> entry : mapping.entrySet()) {
+ if (columnRange.contains(SpreadsheetUtils.getColumnIndex(entry.getKey()))) {
+ String portName = entry.getValue();
+ if (!usedNames.add(portName)) {
+ isValid = false;
+ break;
+ }
+ if (portName.matches("[A-Z]+")) {
+ if (!mapping.containsKey(portName)) {
+ int columnIndex = SpreadsheetUtils.getColumnIndex(portName);
+ if (columnRange.contains(columnIndex)) {
+ isValid = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (isValid) {
+ removeErrorMessage(DUPLICATE_PORT_NAME_ERROR_MESSAGE);
+ } else {
+ addErrorMessage(DUPLICATE_PORT_NAME_ERROR_MESSAGE);
+ }
+ return isValid;
+ }
+
+ protected boolean checkRowRange(String from, String to) {
+ boolean result = false;
+ try {
+ int fromRow = Integer.parseInt(from);
+ int toRow = Integer.parseInt(to);
+ if (toRow < fromRow) {
+ addErrorMessage(INCONSISTENT_ROW_MESSAGE);
+ } else {
+ removeErrorMessage(INCONSISTENT_ROW_MESSAGE);
+ result = true;
+ }
+ } catch (NumberFormatException e) {
+ logger.warn("Problem checking row range", e);
+ }
+ return result;
+ }
+
+ protected boolean checkColumnRange(int fromColumn, int toColumn) {
+ boolean result = false;
+ if (toColumn < fromColumn) {
+ addErrorMessage(INCONSISTENT_COLUMN_MESSAGE);
+ } else {
+ removeErrorMessage(INCONSISTENT_COLUMN_MESSAGE);
+ result = true;
+ }
+ return result;
+ }
+
+ /**
+ * Adds a light gray or etched border to the top or bottom of a JComponent.
+ *
+ * @param component
+ */
+ protected void addDivider(JComponent component, final int position, final boolean etched) {
+ component.setBorder(new Border() {
+ private final Color borderColor = new Color(.6f, .6f, .6f);
+
+ public Insets getBorderInsets(Component c) {
+ if (position == SwingConstants.TOP) {
+ return new Insets(5, 0, 0, 0);
+ } else {
+ return new Insets(0, 0, 5, 0);
+ }
+ }
+
+ public boolean isBorderOpaque() {
+ return false;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ if (position == SwingConstants.TOP) {
+ if (etched) {
+ g.setColor(borderColor);
+ g.drawLine(x, y, x + width, y);
+ g.setColor(Color.WHITE);
+ g.drawLine(x, y + 1, x + width, y + 1);
+ } else {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(x, y, x + width, y);
+ }
+ } else {
+ if (etched) {
+ g.setColor(borderColor);
+ g.drawLine(x, y + height - 2, x + width, y + height - 2);
+ g.setColor(Color.WHITE);
+ g.drawLine(x, y + height - 1, x + width, y + height - 1);
+ } else {
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(x, y + height - 1, x + width, y + height - 1);
+ }
+ }
+ }
+
+ });
+ }
+
+ private void enableTable(JTable table, boolean enabled) {
+ table.setEnabled(enabled);
+ Component editor = table.getEditorComponent();
+ if (editor != null) {
+ editor.setEnabled(enabled);
+ }
+ if (enabled) {
+ table.setForeground(Color.BLACK);
+ table.getTableHeader().setForeground(Color.BLACK);
+ } else {
+ table.setForeground(Color.LIGHT_GRAY);
+ table.getTableHeader().setForeground(Color.LIGHT_GRAY);
+ }
+ }
+
+ static class UpperCaseDocument extends PlainDocument {
+ @Override
+ public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
+ if (text.matches("[A-Za-z]+")) {
+ text = text.toUpperCase();
+ super.replace(offset, length, text, attrs);
+ }
+ }
+ }
+
+ static class NumericDocument extends PlainDocument {
+ @Override
+ public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
+ if (text.length() == 0 || text.matches("[0-9]+")) {
+ text = text.toUpperCase();
+ super.replace(offset, length, text, attrs);
+ }
+ }
+ }
+
+ /**
+ * Main method for testing the panel.
+ *
+ * @param args
+ * @throws ActivityConfigurationException
+ */
+// public static void main(String[] args) throws ActivityConfigurationException {
+// final JFrame frame = new JFrame();
+// SpreadsheetImportActivity activity = new SpreadsheetImportActivity();
+// activity.configure(new SpreadsheetImportConfiguration());
+// final SpreadsheetImportConfigView config = new SpreadsheetImportConfigView(activity);
+// config.setOkAction(new AbstractAction("Finish") {
+// public void actionPerformed(ActionEvent arg0) {
+// Range columnRange = config.getConfiguration().getColumnRange();
+// String fromColumn = SpreadsheetUtils.getColumnLabel(columnRange.getStart());
+// String toColumn = SpreadsheetUtils.getColumnLabel(columnRange.getEnd());
+// System.out.printf("%s (%s) - %s (%s)", fromColumn, columnRange.getStart(),
+// toColumn, columnRange.getEnd());
+// frame.setVisible(false);
+// frame.dispose();
+// }
+// });
+// config.setCancelAction(new AbstractAction("Cancel") {
+// public void actionPerformed(ActionEvent arg0) {
+// frame.setVisible(false);
+// frame.dispose();
+// }
+// });
+// frame.add(config);
+// frame.pack();
+// frame.setVisible(true);
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualView.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualView.java
new file mode 100644
index 0000000..b7f3121
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualView.java
@@ -0,0 +1,120 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.views;
+
+import java.awt.Frame;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.spreadsheet.actions.SpreadsheetImportActivityConfigurationAction;
+import org.apache.taverna.activities.spreadsheet.il8n.SpreadsheetImportUIText;
+import org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+/**
+ * A simple non editable HTML table view over a {@link SpreadsheetImportActivity}. Clicking on the
+ * configure button shows the editable {@link SpreadsheetImportConfigView}
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportContextualView extends HTMLBasedActivityContextualView {
+
+ private static final long serialVersionUID = 1L;
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private final ServiceRegistry serviceRegistry;
+
+ public SpreadsheetImportContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ActivityIconManager activityIconManager,
+ ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ StringBuilder html = new StringBuilder();
+ html.append("<tr><th>");
+ html.append(SpreadsheetImportUIText
+ .getString("SpreadsheetImportContextualView.inputPortName"));
+ html.append("</th><th>");
+ html.append(SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.depth"));
+ html.append("</th></tr>");
+ for (InputActivityPort port : getActivity().getInputPorts()) {
+ html.append("<tr><td>");
+ html.append(port.getName());
+ html.append("</td><td>");
+ html.append(port.getDepth());
+ html.append("</td></tr>");
+ }
+ html.append("<tr><th>");
+ html.append(SpreadsheetImportUIText
+ .getString("SpreadsheetImportContextualView.outputPortName"));
+ html.append("</th><th>");
+ html.append(SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.depth"));
+ html.append("</th></tr>");
+ for (OutputActivityPort port : getActivity().getOutputPorts()) {
+ html.append("<tr><td>");
+ html.append(port.getName());
+ html.append("</td><td>");
+ html.append(port.getDepth());
+ html.append("</td></tr>");
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getViewTitle() {
+ return SpreadsheetImportUIText.getString("SpreadsheetImportContextualView.activityName");
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new SpreadsheetImportActivityConfigurationAction(
+ getActivity(), owner, editManager, fileManager,
+ activityIconManager, serviceDescriptionRegistry, serviceRegistry);
+ }
+
+ @Override
+ public String getBackgroundColour() {
+ return SpreadsheetImportActivityIcon.SPREADSHEET_COLOUR_HTML;
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
new file mode 100644
index 0000000..517dfd2
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/org/apache/taverna/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.activities.spreadsheet.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Factory for creating contextual a view of the SpreadsheetImport Activity
+ *
+ * @author David Withers
+ */
+public class SpreadsheetImportContextualViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ServiceRegistry serviceRegistry;
+
+ public boolean canHandle(Object object) {
+ return object instanceof Activity
+ && ((Activity) object).getType().equals(
+ SpreadsheetImportTemplateService.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays.asList(new ContextualView[] { new SpreadsheetImportContextualView(activity,
+ editManager, fileManager, activityIconManager, colourManager,
+ serviceDescriptionRegistry, serviceRegistry) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index b1628b6..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 6720b04..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 2dd012f..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 4b9dd11..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportContextualViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..f136255
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..88b067a
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction
+org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction
+org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..c00719e
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..f108c98
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.spreadsheet.views.SpreadsheetImportContextualViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
index 72ffb77..ad6df6d 100644
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
@@ -6,23 +6,23 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="SpreadsheetImportActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="SpreadsheetImportActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="SpreadsheetImportTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="SpreadsheetImportTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="SpreadsheetImportAddTemplateAction" auto-export="interfaces" />
<service ref="SpreadsheetImportConfigureMenuAction" auto-export="interfaces" />
<service ref="SpreadsheetImportAddTemplateMenuAction" auto-export="interfaces" />
- <service ref="SpreadsheetImportContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="SpreadsheetImportContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+ <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
index 7fdba26..b622605 100644
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
@@ -3,13 +3,13 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="SpreadsheetImportActivityIcon" class="net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon">
+ <bean id="SpreadsheetImportActivityIcon" class="org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon">
<property name="colourManager" ref="colourManager" />
</bean>
- <bean id="SpreadsheetImportTemplateService" class="net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService" />
+ <bean id="SpreadsheetImportTemplateService" class="org.apache.taverna.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService" />
- <bean id="SpreadsheetImportAddTemplateAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction">
+ <bean id="SpreadsheetImportAddTemplateAction" class="org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -17,7 +17,7 @@
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
- <bean id="SpreadsheetImportAddTemplateMenuAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction">
+ <bean id="SpreadsheetImportAddTemplateMenuAction" class="org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction">
<property name="editManager" ref="editManager" />
<property name="menuManager" ref="menuManager" />
<property name="selectionManager" ref="selectionManager" />
@@ -25,7 +25,7 @@
<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
- <bean id="SpreadsheetImportConfigureMenuAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction">
+ <bean id="SpreadsheetImportConfigureMenuAction" class="org.apache.taverna.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -33,7 +33,7 @@
<property name="serviceRegistry" ref="serviceRegistry" />
</bean>
- <bean id="SpreadsheetImportContextualViewFactory" class="net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportContextualViewFactory">
+ <bean id="SpreadsheetImportContextualViewFactory" class="org.apache.taverna.activities.spreadsheet.views.SpreadsheetImportContextualViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties b/taverna-spreadsheet-import-activity-ui/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
deleted file mode 100644
index 2a4480f..0000000
--- a/taverna-spreadsheet-import-activity-ui/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-SpreadsheetImportActivityConfigurationAction.canceButton=Cancel
-SpreadsheetImportActivityConfigurationAction.dialogTitle=Spreadsheet Import Configuration
-SpreadsheetImportActivityConfigurationAction.okButton=Finish
-SpreadsheetImportAddTemplateAction.addMenu=Spreadsheet import
-SpreadsheetImportConfigureMenuAction.configureMenu=Configure Spreadsheet Import
-SpreadsheetImportConfigTableModel.column=Column
-SpreadsheetImportConfigTableModel.portName=Port Name
-SpreadsheetImportConfigView.nextButton=Next
-SpreadsheetImportConfigView.backButton=Back
-SpreadsheetImportConfigView.columnMappingSectionLabel=Column to Port Name Mapping
-SpreadsheetImportConfigView.outputFormatSectionLabel=Output Format
-SpreadsheetImportConfigView.columnSectionLabel=Columns
-SpreadsheetImportConfigView.DEFAULT_MESSAGE=Select the data range
-SpreadsheetImportConfigView.DUPLICATE_PORT_NAME_ERROR_MESSAGE=Duplicate activity port name
-SpreadsheetImportConfigView.EMPTY_FROM_COLUMN_ERROR_MESSAGE='From' column must be specified
-SpreadsheetImportConfigView.EMPTY_FROM_ROW_ERROR_MESSAGE='From' row must be specified
-SpreadsheetImportConfigView.EMPTY_TO_COLUMN_ERROR_MESSAGE='To' column must be specified
-SpreadsheetImportConfigView.emptyCellSectionLabel=Empty cells
-SpreadsheetImportConfigView.emptyStringOption=Use an empty string
-SpreadsheetImportConfigView.excludeHeaderRowOption=Exclude header row
-SpreadsheetImportConfigView.from=From
-SpreadsheetImportConfigView.FROM_COLUMN_ERROR_MESSAGE='From' column can only contain characters A-Z
-SpreadsheetImportConfigView.FROM_ROW_ERROR_MESSAGE='From' row must be a number greater than 0
-SpreadsheetImportConfigView.generateErrorOption=Generate an error value
-SpreadsheetImportConfigView.ignoreBlankRowsOption=Ignore blank rows
-SpreadsheetImportConfigView.multiplePortOption=Multiple outputs (one per spreadsheet column)
-SpreadsheetImportConfigView.singlePortOption=A single CSV formatted output
-SpreadsheetImportConfigView.userDefinedCsvDelimiter=Use this value delimiter character:
-SpreadsheetImportConfigView.INCONSISTENT_COLUMN_MESSAGE='To' column must not be less than 'from' column
-SpreadsheetImportConfigView.INCONSISTENT_ROW_MESSAGE='To'row must not be less than 'from' row
-SpreadsheetImportConfigView.panelTitle=Configure spreadsheet file import
-SpreadsheetImportConfigView.rowSectionLabel=Rows
-SpreadsheetImportConfigView.selectAllRowsOption=All rows
-SpreadsheetImportConfigView.to=to
-SpreadsheetImportConfigView.TO_COLUMN_ERROR_MESSAGE='To' column can only contain characters A-Z
-SpreadsheetImportConfigView.TO_ROW_ERROR_MESSAGE='To' row must be a number greater than 0
-SpreadsheetImportConfigView.userDefinedOption=Use this value:
-SpreadsheetImportContextualView.activityName=Spreadsheet Import Activity
-SpreadsheetImportContextualView.depth=Depth
-SpreadsheetImportContextualView.inputPortName=Input Port Name
-SpreadsheetImportContextualView.outputPortName=Output Port Name
-SpreadsheetImportTemplateService.serviceDescription=A service that imports data from spreadsheets
-SpreadsheetImportTemplateService.serviceName=SpreadsheetImport
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/resources/org/apache/taverna/activities/spreadsheet/iln8/ui-text.properties
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/src/main/resources/org/apache/taverna/activities/spreadsheet/iln8/ui-text.properties b/taverna-spreadsheet-import-activity-ui/src/main/resources/org/apache/taverna/activities/spreadsheet/iln8/ui-text.properties
new file mode 100644
index 0000000..2a4480f
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/resources/org/apache/taverna/activities/spreadsheet/iln8/ui-text.properties
@@ -0,0 +1,43 @@
+SpreadsheetImportActivityConfigurationAction.canceButton=Cancel
+SpreadsheetImportActivityConfigurationAction.dialogTitle=Spreadsheet Import Configuration
+SpreadsheetImportActivityConfigurationAction.okButton=Finish
+SpreadsheetImportAddTemplateAction.addMenu=Spreadsheet import
+SpreadsheetImportConfigureMenuAction.configureMenu=Configure Spreadsheet Import
+SpreadsheetImportConfigTableModel.column=Column
+SpreadsheetImportConfigTableModel.portName=Port Name
+SpreadsheetImportConfigView.nextButton=Next
+SpreadsheetImportConfigView.backButton=Back
+SpreadsheetImportConfigView.columnMappingSectionLabel=Column to Port Name Mapping
+SpreadsheetImportConfigView.outputFormatSectionLabel=Output Format
+SpreadsheetImportConfigView.columnSectionLabel=Columns
+SpreadsheetImportConfigView.DEFAULT_MESSAGE=Select the data range
+SpreadsheetImportConfigView.DUPLICATE_PORT_NAME_ERROR_MESSAGE=Duplicate activity port name
+SpreadsheetImportConfigView.EMPTY_FROM_COLUMN_ERROR_MESSAGE='From' column must be specified
+SpreadsheetImportConfigView.EMPTY_FROM_ROW_ERROR_MESSAGE='From' row must be specified
+SpreadsheetImportConfigView.EMPTY_TO_COLUMN_ERROR_MESSAGE='To' column must be specified
+SpreadsheetImportConfigView.emptyCellSectionLabel=Empty cells
+SpreadsheetImportConfigView.emptyStringOption=Use an empty string
+SpreadsheetImportConfigView.excludeHeaderRowOption=Exclude header row
+SpreadsheetImportConfigView.from=From
+SpreadsheetImportConfigView.FROM_COLUMN_ERROR_MESSAGE='From' column can only contain characters A-Z
+SpreadsheetImportConfigView.FROM_ROW_ERROR_MESSAGE='From' row must be a number greater than 0
+SpreadsheetImportConfigView.generateErrorOption=Generate an error value
+SpreadsheetImportConfigView.ignoreBlankRowsOption=Ignore blank rows
+SpreadsheetImportConfigView.multiplePortOption=Multiple outputs (one per spreadsheet column)
+SpreadsheetImportConfigView.singlePortOption=A single CSV formatted output
+SpreadsheetImportConfigView.userDefinedCsvDelimiter=Use this value delimiter character:
+SpreadsheetImportConfigView.INCONSISTENT_COLUMN_MESSAGE='To' column must not be less than 'from' column
+SpreadsheetImportConfigView.INCONSISTENT_ROW_MESSAGE='To'row must not be less than 'from' row
+SpreadsheetImportConfigView.panelTitle=Configure spreadsheet file import
+SpreadsheetImportConfigView.rowSectionLabel=Rows
+SpreadsheetImportConfigView.selectAllRowsOption=All rows
+SpreadsheetImportConfigView.to=to
+SpreadsheetImportConfigView.TO_COLUMN_ERROR_MESSAGE='To' column can only contain characters A-Z
+SpreadsheetImportConfigView.TO_ROW_ERROR_MESSAGE='To' row must be a number greater than 0
+SpreadsheetImportConfigView.userDefinedOption=Use this value:
+SpreadsheetImportContextualView.activityName=Spreadsheet Import Activity
+SpreadsheetImportContextualView.depth=Depth
+SpreadsheetImportContextualView.inputPortName=Input Port Name
+SpreadsheetImportContextualView.outputPortName=Output Port Name
+SpreadsheetImportTemplateService.serviceDescription=A service that imports data from spreadsheets
+SpreadsheetImportTemplateService.serviceName=SpreadsheetImport
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/pom.xml b/taverna-wsdl-activity-ui/pom.xml
index f3f7baa..916c8eb 100644
--- a/taverna-wsdl-activity-ui/pom.xml
+++ b/taverna-wsdl-activity-ui/pom.xml
@@ -1,75 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.workbench.commonactivities</groupId>
- <artifactId>taverna-workbench-commonactivities</artifactId>
- <version>3.1.0-incubating-SNAPSHOT</version>
- </parent>
- <groupId>org.apache.taverna.ui-activities</groupId>
- <artifactId>taverna-wsdl-activity-ui</artifactId>
- <packaging>bundle</packaging>
- <name>Taverna 2 WSDL Activity UI</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <!-- Use the java version instead of xmlcommons for javax.* packages -->
- <Import-Package>javax.xml.namespace;version="0.0.0",javax.xml.parsers;version="0.0.0",org.w3c.dom;version="0.0.0",org.xml.sax;version="0.0.0",*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.taverna.workbench.commonactivities</groupId>
+ <artifactId>taverna-workbench-commonactivities</artifactId>
+ <version>3.1.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.taverna.ui-activities</groupId>
+ <artifactId>taverna-wsdl-activity-ui</artifactId>
+ <packaging>bundle</packaging>
+ <name>Taverna 2 WSDL Activity UI</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <!-- Use the java version instead of xmlcommons for javax.* packages -->
+ <Import-Package>javax.xml.namespace;version="0.0.0",javax.xml.parsers;version="0.0.0",org.w3c.dom;version="0.0.0",org.xml.sax;version="0.0.0",*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.taverna.engine</groupId>
+ <artifactId>taverna-credential-manager</artifactId>
+ <version>${taverna.engine.version}</version>
+ </dependency>
<!--
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-icons-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-palette-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.activities</groupId>
- <artifactId>wsdl-activity</artifactId>
- <version>${t2.activities.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-components</groupId>
- <artifactId>credential-manager-ui</artifactId>
- <version>${t2.ui.components.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>contextual-views-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>activity-tools</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.lang</groupId>
- <artifactId>ui</artifactId>
- <version>${t2.lang.version}</version>
- </dependency>
--->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-wsdl-generic</artifactId>
+ <version>${taverna.commonactivities.version}</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.taverna.commonactivities</groupId>
+ <artifactId>taverna-wsdl-activity</artifactId>
+ <version>${taverna.commonactivities.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-activity-palette-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-edits-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-selection-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-menu-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-activity-icons-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-helper-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-ui</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-credential-manager-ui</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-configuration-ui-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-contextual-views-api</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taverna.workbench</groupId>
+ <artifactId>taverna-activity-tools</artifactId>
+ <version>${taverna.workbench.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
<repositories>
<repository>
<releases />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AbstractAddXMLSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
deleted file mode 100644
index d92dab9..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AbstractAddXMLSplitterAction.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.actions;
-/*******************************************************************************
- * Copyright (C) 2008 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
- ******************************************************************************/
-
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.swing.AbstractAction;
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.wsdl.parser.ArrayTypeDescriptor;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-
-import org.apache.log4j.Logger;
-import org.jdom.JDOMException;
-import org.xml.sax.SAXException;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.profiles.Profile;
-
-/**
- * Abstract superclass of {@link AddXMLOutputSplitterAction} and
- * {@link AddXMLInputSplitterAction}.
- * <p>
- * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
- * that is selected is added as an input/output splitter to the currently open
- * dataflow using the {@link AddXMLSplitterEdit}
- *
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- * @author Stuart Owen
- *
- */
-@SuppressWarnings("serial")
-public abstract class AbstractAddXMLSplitterAction extends AbstractAction {
-
- private static Logger logger = Logger.getLogger(AddXMLOutputSplitterAction.class);
-
- protected Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- protected JComponent owner;
- protected final Activity activity;
- protected final EditManager editManager;
- protected final SelectionManager selectionManager;
-
- public AbstractAddXMLSplitterAction(Activity activity,
- JComponent owner, EditManager editManager, SelectionManager selectionManager) {
- this.activity = activity;
- this.owner = owner;
- this.editManager = editManager;
- this.selectionManager = selectionManager;
- }
-
- public void actionPerformed(ActionEvent ev) {
- List<String> possibilities;
- Map<String, TypeDescriptor> typeDescriptors;
- try {
- typeDescriptors = getTypeDescriptors();
- } catch (UnknownOperationException ex) {
- logger.error("Can't find operation for activity "
- + activity, ex);
- return;
- } catch (IOException | ParserConfigurationException | WSDLException | SAXException | JDOMException ex) {
- logger.error("Can't read definition for activity "
- + activity, ex);
- return;
- }
-
- typeDescriptors = filterDescriptors(typeDescriptors);
-
- possibilities = new ArrayList<String>(typeDescriptors.keySet());
- if (possibilities.isEmpty()) {
- logger.warn("No type descriptors found for activity " + activity);
- return;
- }
- Collections.sort(possibilities);
-
- String portName = (String) JOptionPane.showInputDialog(owner,
- "Select the port to add the splitter to",
- "Add output XML splitter", JOptionPane.PLAIN_MESSAGE, null,
- possibilities.toArray(), possibilities.get(0));
-
- Workflow workflow = selectionManager.getSelectedWorkflow();
- Profile profile = selectionManager.getSelectedProfile();
- TypeDescriptor typeDescriptorForPort = typeDescriptors
- .get(portName);
-
- if (typeDescriptorForPort instanceof ArrayTypeDescriptor
- || typeDescriptorForPort instanceof ComplexTypeDescriptor) {
- AddXMLSplitterEdit edit = new AddXMLSplitterEdit(workflow, profile,
- activity, typeDescriptorForPort, portName, isInput());
- try {
- editManager.doDataflowEdit(workflow.getParent(), edit);
- } catch (EditException ex) {
- logger.error("Could not perform edit to add " + portName, ex);
- }
- } else {
- logger.warn("Unknown typedescriptor for " + portName);
- }
- }
-
- public static Map<String, TypeDescriptor> filterDescriptors(
- Map<String, TypeDescriptor> descriptors) {
- Map<String, TypeDescriptor> filtered = new HashMap<String, TypeDescriptor>();
- for (Entry<String, TypeDescriptor> entry : descriptors.entrySet()) {
- TypeDescriptor descriptor = entry.getValue();
- if (descriptor.getMimeType().contains("'text/xml'")) {
- filtered.put(entry.getKey(), descriptor);
- }
- }
- return filtered;
- }
-
- protected abstract boolean isInput();
-
- public abstract Map<String, TypeDescriptor> getTypeDescriptors()
- throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException;
-
- public void setOwner(JComponent owner) {
- this.owner = owner;
- }
-}
\ No newline at end of file
[16/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
deleted file mode 100644
index ddcc4d6..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package net.sf.taverna.t2.activities.localworker.servicedescriptions;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-
-import org.apache.log4j.Logger;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class LocalworkerServiceProvider implements ServiceDescriptionProvider {
-
- private static final String LOCALWORKER_NAMES = "/localworker_names";
-
- private static final String LOCALWORKER_SERVICE = "Local service";
-
- private static Logger logger = Logger.getLogger(Logger.class);
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/localworker");
-
- /** Used to deserialize the Activities stored on disk */
- private ObjectMapper objectMapper = new ObjectMapper();
-
- private static Map<String, String> localWorkerToScript = new HashMap<String, String>();
-
- static {
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.ByteArrayToString",
- "Byte Array To String");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.DecodeBase64",
- "Decode Base 64 to byte Array");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EchoList", "Echo List");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings",
- "Create Lots Of Strings");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EncodeBase64",
- "Encode Byte Array to Base 64");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks",
- "Get image URLs from HTTP document");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.FilterStringList",
- "Filter List of Strings by regex");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.FlattenList",
- "Flatten List");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.PadNumber",
- "Pad numeral with leading 0s");
- localWorkerToScript.put(
- "org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList",
- "Filter list of strings extracting match to a regex");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SendEmail",
- "Send an Email");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SliceList",
- "Extract Elements from a List");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SplitByRegex",
- "Split string into string list by regular expression");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringConcat",
- "Concatenate two strings");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringListMerge",
- "Merge String List to a String");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetDifference",
- "String List Difference");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetIntersection",
- "String List Intersection");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetUnion",
- "String List Union");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates",
- "Remove String Duplicates");
- localWorkerToScript.put(
- "org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor",
- "Always Fails");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.TestSometimesFails",
- "Sometimes Fails");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.WebImageFetcher",
- "Get Image From URL");
- localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.WebPageFetcher",
- "Get Web Page from URL");
-
- // xml:XPathText
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker",
- "XPath From Text");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.xml.XSLTWorker",
- "Transform XML");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters",
- "Transform XML with parameters");
-
- // biojava
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker",
- "Read Gen Bank File");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker",
- "Reverse Complement DNA");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker",
- "Read Swiss Prot File");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker",
- "Transcribe DNA");
-
- // io
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.TextFileReader",
- "Read Text File");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.TextFileWriter",
- "Write Text File");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.LocalCommand",
- "Execute Command Line App");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.FileListByExtTask",
- "List Files by Extension");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask",
- "List Files By Regex");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.DataRangeTask",
- "Select Data Range From File");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker",
- "Concatenate Files");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker",
- "Get Environment Variables as XML");
-
- // ui
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.AskWorker", "Ask");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.SelectWorker", "Select");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.ChooseWorker", "Choose");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.TellWorker", "Tell");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.WarnWorker", "Warn");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker",
- "Select File");
- // ncbi
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker",
- "Get Nucleotide FASTA");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker",
- "Get Nucleotide GBSeq XML");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker",
- "Get Nucleotide INSDSeq XML");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker",
- "Get Nucleotide TinySeq XML");
-
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker",
- "Get Protein FASTA");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker",
- "Get Protein INSDSeq XML");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker",
- "Get Protein GBSeq XML");
- localWorkerToScript.put(
- "net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker",
- "Get Protein TinySeq XML");
-
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker",
- "Search PubMed XML");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker",
- "Get PubMed XML By PMID");
-
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker",
- "Execute SQL Query");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker",
- "Execute SQL Update");
-
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.net.BrowseUrl",
- "Open web browser at a URL");
- localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.net.ExtractHeader",
- "Extract HTTP Header");
- }
-
- public String getName() {
- return LOCALWORKER_SERVICE;
- }
-
- /**
- * Use the {@link net.sf.taverna.t2.activities.localworker.translator.LocalworkerTranslator} to
- * get a {@link Map} of all the local workers. Use the keys in this map
- * to load all the serialized activities from disk by using
- * <code> getClass().getResourceAsStream("/" + className) </code> to get
- * them and then the {@link ActivityXMLDeserializer} to get the actual {@link Activity}. Create
- * the {@link LocalworkerActivityItem} by
- * populating them with the correct ports and depths. Sets the category to
- * match the T1 version so that a query by category will split the local
- * workers in to the correct place.
- */
- public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
-
- List<ServiceDescription> items = new ArrayList<ServiceDescription>();
-
- InputStream inputStream = getClass().getResourceAsStream(LOCALWORKER_NAMES);
- if (inputStream == null) {
- logger.error("Could not find resource " + LOCALWORKER_NAMES);
- return;
- }
- BufferedReader inputReader = new BufferedReader(new InputStreamReader(inputStream));
- String line = "";
- String category = null;
- try {
- while ((line = inputReader.readLine()) != null) {
- if (line.startsWith("category")) {
- String[] split = line.split(":");
- category = split[1];
- } else {
- LocalworkerServiceDescription createItem;
- try {
- createItem = createItem(line);
- } catch (ItemCreationException e) {
- logger.warn("Could not create item for: " + line, e);
- continue;
- }
- createItem.setCategory(category);
- createItem.setProvider("myGrid");
- items.add(createItem);
- }
- }
- } catch (IOException e1) {
- logger.warn("Could not read local worker definitions from " + LOCALWORKER_NAMES);
- }
- callBack.partialResults(items);
- callBack.finished();
-
- }
-
- @Override
- public ServiceDescriptionProvider newInstance() {
- return new LocalworkerServiceProvider();
- }
-
- @SuppressWarnings("serial")
- public class ItemCreationException extends Exception {
-
- public ItemCreationException() {
- super();
- }
-
- public ItemCreationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ItemCreationException(String message) {
- super(message);
- }
-
- public ItemCreationException(Throwable cause) {
- super(cause);
- }
-
- }
-
- /**
- * Loads the deserialised local worker from disk and creates a {@link LocalworkerActivityItem}
- * with the correct ports and script from it
- *
- * @param line
- * @return a LocalWorker with the appropriate Input/Output ports and script
- * @throws ItemCreationException
- */
- private LocalworkerServiceDescription createItem(String line) throws ItemCreationException {
- // get the file from disk
- String resource = "/" + line + ".json";
- InputStream resourceAsStream = getClass().getResourceAsStream(resource);
- if (resourceAsStream == null) {
- throw new ItemCreationException("Could not find resource " + resource);
- }
-
- JsonNode json;
- try {
- json = objectMapper.readTree(resourceAsStream);
- } catch (IOException e) {
- throw new ItemCreationException("Could not read resource " + resource, e);
- }
-
- LocalworkerServiceDescription item = new LocalworkerServiceDescription();
- item.setJson(json);
- item.setLocalworkerName(line);
- item.setOperation(localWorkerToScript.get(line));
- return item;
-
- }
-
- public Icon getIcon() {
- return LocalworkerActivityIcon.getLocalworkerIcon();
- }
-
- @Override
- public String toString() {
- return "Local workers provider";
- }
-
- public static String getServiceNameFromClassname(String classname) {
- return (localWorkerToScript.get(classname));
- }
-
- public String getId() {
- return providerId.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityConfigView.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityConfigView.java
deleted file mode 100644
index 41c7d25..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityConfigView.java
+++ /dev/null
@@ -1,42 +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.localworker.views;
-
-import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public class LocalworkerActivityConfigView extends BeanshellConfigurationPanel {
-
- public LocalworkerActivityConfigView(Activity activity, ApplicationConfiguration applicationConfiguration) {
- super(activity, applicationConfiguration);
- }
-
- public boolean isConfigurationChanged() {
- boolean configurationChanged = super.isConfigurationChanged();
- if (configurationChanged) {
- getJson().put("isAltered", true);
- }
- return configurationChanged;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityContextualView.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityContextualView.java
deleted file mode 100644
index 461696d..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityContextualView.java
+++ /dev/null
@@ -1,115 +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.localworker.views;
-
-import java.awt.Frame;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.localworker.actions.LocalworkerActivityConfigurationAction;
-import net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-@SuppressWarnings("serial")
-public class LocalworkerActivityContextualView extends HTMLBasedActivityContextualView {
-
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ActivityIconManager activityIconManager;
- private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
- private final ApplicationConfiguration applicationConfiguration;
-
- public LocalworkerActivityContextualView(Activity activity, EditManager editManager,
- FileManager fileManager, ColourManager colourManager,
- ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry,
- ApplicationConfiguration applicationConfiguration) {
- super(activity, colourManager);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- this.applicationConfiguration = applicationConfiguration;
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- StringBuilder html = new StringBuilder();
- html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
- for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
- html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
- html.append(inputActivityPort.getDepth() + "</td></tr>");
- }
- html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
- for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
- html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
- html.append(outputActivityPort.getDepth() + "</td></tr>");
- }
- return html.toString();
- }
-
- @Override
- public String getViewTitle() {
- String result = "";
- Configuration configuration = getConfigBean();
- JsonNode json = configuration.getJson();
- String workerName = LocalworkerServiceProvider.getServiceNameFromClassname(json.get(
- "localworkerName").textValue());
- if (json.get("isAltered").booleanValue()) {
- result = "Altered local worker service";
- if ((workerName != null) && !workerName.equals("")) {
- result += " - originally " + workerName;
- }
- } else {
- result = "Local worker service";
- if ((workerName != null) && !workerName.equals("")) {
- result += " - " + workerName;
- }
- }
- return result;
- }
-
- @Override
- public Action getConfigureAction(Frame owner) {
- return new LocalworkerActivityConfigurationAction(getActivity(), owner, editManager,
- fileManager, activityIconManager, serviceDescriptionRegistry,
- applicationConfiguration);
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityViewFactory.java b/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityViewFactory.java
deleted file mode 100644
index 3723215..0000000
--- a/taverna-localworker-activity-ui/src/main/java/net/sf/taverna/t2/activities/localworker/views/LocalworkerActivityViewFactory.java
+++ /dev/null
@@ -1,82 +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.localworker.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-public class LocalworkerActivityViewFactory implements ContextualViewFactory<Activity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private ApplicationConfiguration applicationConfiguration;
-
- public boolean canHandle(Object object) {
- return object instanceof Activity
- && ((Activity) object).getType()
- .equals(LocalworkerServiceDescription.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays.asList(new ContextualView[] { new LocalworkerActivityContextualView(activity,
- editManager, fileManager, colourManager, activityIconManager,
- serviceDescriptionRegistry, applicationConfiguration) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
- this.applicationConfiguration = applicationConfiguration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/actions/LocalworkerActivityConfigurationAction.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
new file mode 100644
index 0000000..d141ace
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/actions/LocalworkerActivityConfigurationAction.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.localworker.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.Action;
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.activities.localworker.views.LocalworkerActivityConfigView;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * The {@link LocalworkerActivity}s have pre-defined scripts, ports etc in a serialised form on
+ * disk. So if the user wants to change them they have to do so at own risk.
+ *
+ * @author Ian Dunlop
+ */
+@SuppressWarnings("serial")
+public class LocalworkerActivityConfigurationAction extends ActivityConfigurationAction {
+
+ public static final String EDIT_LOCALWORKER_SCRIPT = "Edit beanshell script";
+
+ private final EditManager editManager;
+
+ private final FileManager fileManager;
+
+ private final ApplicationConfiguration applicationConfiguration;
+
+ private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ public LocalworkerActivityConfigurationAction(Activity activity, Frame owner,
+ EditManager editManager, FileManager fileManager,
+ ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry,
+ ApplicationConfiguration applicationConfiguration) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.applicationConfiguration = applicationConfiguration;
+ putValue(Action.NAME, EDIT_LOCALWORKER_SCRIPT);
+ }
+
+ /**
+ * If the localworker has not been changed it pops up a {@link JOptionPane} warning the user
+ * that they change things at their own risk. Otherwise just show the config view
+ */
+ public void actionPerformed(ActionEvent e) {
+ Object[] options = { "Continue", "Cancel" };
+ Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
+ JsonNode json = configuration.getJson();
+ if (!json.get("isAltered").booleanValue()) {
+ int n = JOptionPane
+ .showOptionDialog(
+ null,
+ "Changing the properties of a Local Worker may affect its behaviour. Do you want to continue?",
+ "WARNING", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
+ null, // do not use a
+ // custom Icon
+ options, options[0]);
+
+ if (n == 0) {
+ // continue was clicked so prepare for config
+ openDialog();
+ } else {
+ // do nothing
+ }
+ } else {
+ openDialog();
+ }
+ }
+
+ private void openDialog() {
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+ .getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+ final LocalworkerActivityConfigView localworkerConfigView = new LocalworkerActivityConfigView(
+ getActivity(), applicationConfiguration);
+ final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
+ localworkerConfigView, editManager);
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/menu/ConfigureLocalworkerMenuAction.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
new file mode 100644
index 0000000..f344dd6
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/menu/ConfigureLocalworkerMenuAction.java
@@ -0,0 +1,62 @@
+package org.apache.taverna.activities.localworker.menu;
+
+import javax.swing.Action;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+import org.apache.taverna.activities.beanshell.actions.BeanshellActivityConfigurationAction;
+import org.apache.taverna.activities.localworker.actions.LocalworkerActivityConfigurationAction;
+import org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.ContextualMenuComponent;
+import org.apache.taverna.ui.menu.MenuComponent;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+public class ConfigureLocalworkerMenuAction extends AbstractConfigureActivityMenuAction implements
+ MenuComponent, ContextualMenuComponent {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ApplicationConfiguration applicationConfiguration;
+
+ public ConfigureLocalworkerMenuAction() {
+ super(LocalworkerServiceDescription.ACTIVITY_TYPE);
+ }
+
+ @Override
+ protected Action createAction() {
+ Action result = null;
+ result = new LocalworkerActivityConfigurationAction(findActivity(), getParentFrame(),
+ editManager, fileManager, activityIconManager, serviceDescriptionRegistry,
+ applicationConfiguration);
+ result.putValue(Action.NAME, BeanshellActivityConfigurationAction.EDIT_BEANSHELL_SCRIPT);
+ addMenuDots(result);
+ return result;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
new file mode 100644
index 0000000..f207aab
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerActivityIcon.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.localworker.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ * @author David Withers
+ */
+public class LocalworkerActivityIcon implements ActivityIconSPI {
+
+ private static Icon icon;
+
+ public int canProvideIconScore(URI activityType) {
+ if (LocalworkerServiceDescription.ACTIVITY_TYPE.equals(activityType))
+ return DEFAULT_ICON + 1;
+ else
+ return NO_ICON;
+ }
+
+ public Icon getIcon(URI activityType) {
+ return getLocalworkerIcon();
+ }
+
+ public static Icon getLocalworkerIcon() {
+ if (icon == null) {
+ icon = new ImageIcon(LocalworkerActivityIcon.class
+ .getResource("/localworker.png"));
+ }
+ return icon;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
new file mode 100644
index 0000000..73812d2
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceDescription.java
@@ -0,0 +1,105 @@
+package org.apache.taverna.activities.localworker.servicedescriptions;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class LocalworkerServiceDescription extends ServiceDescription {
+
+ public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/localworker");
+
+ private static final String LOCALWORKER = ServiceDescription.LOCAL_SERVICES;
+
+ private JsonNode json;
+ private String operation;
+ private String category;
+ private String provider;
+ private String localworkerName;
+
+ public JsonNode getJson() {
+ return json;
+ }
+
+ public void setJson(JsonNode json) {
+ this.json = json;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getLocalworkerName() {
+ return localworkerName;
+ }
+
+ public void setLocalworkerName(String localworkerName) {
+ this.localworkerName = localworkerName;
+ }
+
+ public String getType() {
+ return "Localworker";
+ }
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_TYPE;
+ }
+
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration configuration = new Configuration();
+ configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+ configuration.setJson(getJson());
+ return configuration;
+ }
+
+ @Override
+ public Icon getIcon() {
+ return LocalworkerActivityIcon.getLocalworkerIcon();
+ }
+
+ @Override
+ public String getName() {
+ return operation;
+ }
+
+ @Override
+ public List<? extends Comparable<?>> getPath() {
+ List<String> result =
+ Arrays.asList (LOCALWORKER, category);
+ return result;
+ }
+
+ @Override
+ protected List<Object> getIdentifyingData() {
+ return Arrays.<Object>asList(getJson());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
new file mode 100644
index 0000000..86444e9
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/servicedescriptions/LocalworkerServiceProvider.java
@@ -0,0 +1,302 @@
+package org.apache.taverna.activities.localworker.servicedescriptions;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+
+import org.apache.log4j.Logger;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class LocalworkerServiceProvider implements ServiceDescriptionProvider {
+
+ private static final String LOCALWORKER_NAMES = "/localworker_names";
+
+ private static final String LOCALWORKER_SERVICE = "Local service";
+
+ private static Logger logger = Logger.getLogger(Logger.class);
+
+ private static final URI providerId = URI
+ .create("http://taverna.sf.net/2010/service-provider/localworker");
+
+ /** Used to deserialize the Activities stored on disk */
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ private static Map<String, String> localWorkerToScript = new HashMap<String, String>();
+
+ static {
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.ByteArrayToString",
+ "Byte Array To String");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.DecodeBase64",
+ "Decode Base 64 to byte Array");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EchoList", "Echo List");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EmitLotsOfStrings",
+ "Create Lots Of Strings");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.EncodeBase64",
+ "Encode Byte Array to Base 64");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.ExtractImageLinks",
+ "Get image URLs from HTTP document");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.FilterStringList",
+ "Filter List of Strings by regex");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.FlattenList",
+ "Flatten List");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.PadNumber",
+ "Pad numeral with leading 0s");
+ localWorkerToScript.put(
+ "org.embl.ebi.escience.scuflworkers.java.RegularExpressionStringList",
+ "Filter list of strings extracting match to a regex");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SendEmail",
+ "Send an Email");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SliceList",
+ "Extract Elements from a List");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.SplitByRegex",
+ "Split string into string list by regular expression");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringConcat",
+ "Concatenate two strings");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringListMerge",
+ "Merge String List to a String");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetDifference",
+ "String List Difference");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetIntersection",
+ "String List Intersection");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringSetUnion",
+ "String List Union");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates",
+ "Remove String Duplicates");
+ localWorkerToScript.put(
+ "org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor",
+ "Always Fails");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.TestSometimesFails",
+ "Sometimes Fails");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.WebImageFetcher",
+ "Get Image From URL");
+ localWorkerToScript.put("org.embl.ebi.escience.scuflworkers.java.WebPageFetcher",
+ "Get Web Page from URL");
+
+ // xml:XPathText
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.xml.XPathTextWorker",
+ "XPath From Text");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.xml.XSLTWorker",
+ "Transform XML");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.xml.XSLTWorkerWithParameters",
+ "Transform XML with parameters");
+
+ // biojava
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker",
+ "Read Gen Bank File");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker",
+ "Reverse Complement DNA");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker",
+ "Read Swiss Prot File");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.biojava.TranscribeWorker",
+ "Transcribe DNA");
+
+ // io
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.TextFileReader",
+ "Read Text File");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.TextFileWriter",
+ "Write Text File");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.LocalCommand",
+ "Execute Command Line App");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.FileListByExtTask",
+ "List Files by Extension");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.FileListByRegexTask",
+ "List Files By Regex");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.DataRangeTask",
+ "Select Data Range From File");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.io.ConcatenateFileListWorker",
+ "Concatenate Files");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.io.EnvVariableWorker",
+ "Get Environment Variables as XML");
+
+ // ui
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.AskWorker", "Ask");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.SelectWorker", "Select");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.ChooseWorker", "Choose");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.TellWorker", "Tell");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.WarnWorker", "Warn");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ui.SelectFileWorker",
+ "Select File");
+ // ncbi
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.NucleotideFastaWorker",
+ "Get Nucleotide FASTA");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.NucleotideGBSeqWorker",
+ "Get Nucleotide GBSeq XML");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.ncbi.NucleotideINSDSeqXMLWorker",
+ "Get Nucleotide INSDSeq XML");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.ncbi.NucleotideTinySeqXMLWorker",
+ "Get Nucleotide TinySeq XML");
+
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.ProteinFastaWorker",
+ "Get Protein FASTA");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.ncbi.ProteinINSDSeqXMLWorker",
+ "Get Protein INSDSeq XML");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.ProteinGBSeqWorker",
+ "Get Protein GBSeq XML");
+ localWorkerToScript.put(
+ "net.sourceforge.taverna.scuflworkers.ncbi.ProteinTinySeqXMLWorker",
+ "Get Protein TinySeq XML");
+
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.PubMedESearchWorker",
+ "Search PubMed XML");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.ncbi.PubMedEFetchWorker",
+ "Get PubMed XML By PMID");
+
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.jdbc.SQLQueryWorker",
+ "Execute SQL Query");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.jdbc.SQLUpdateWorker",
+ "Execute SQL Update");
+
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.net.BrowseUrl",
+ "Open web browser at a URL");
+ localWorkerToScript.put("net.sourceforge.taverna.scuflworkers.net.ExtractHeader",
+ "Extract HTTP Header");
+ }
+
+ public String getName() {
+ return LOCALWORKER_SERVICE;
+ }
+
+ /**
+ * Use the {@link net.sf.taverna.t2.activities.localworker.translator.LocalworkerTranslator} to
+ * get a {@link Map} of all the local workers. Use the keys in this map
+ * to load all the serialized activities from disk by using
+ * <code> getClass().getResourceAsStream("/" + className) </code> to get
+ * them and then the {@link ActivityXMLDeserializer} to get the actual {@link Activity}. Create
+ * the {@link LocalworkerActivityItem} by
+ * populating them with the correct ports and depths. Sets the category to
+ * match the T1 version so that a query by category will split the local
+ * workers in to the correct place.
+ */
+ public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
+
+ List<ServiceDescription> items = new ArrayList<ServiceDescription>();
+
+ InputStream inputStream = getClass().getResourceAsStream(LOCALWORKER_NAMES);
+ if (inputStream == null) {
+ logger.error("Could not find resource " + LOCALWORKER_NAMES);
+ return;
+ }
+ BufferedReader inputReader = new BufferedReader(new InputStreamReader(inputStream));
+ String line = "";
+ String category = null;
+ try {
+ while ((line = inputReader.readLine()) != null) {
+ if (line.startsWith("category")) {
+ String[] split = line.split(":");
+ category = split[1];
+ } else {
+ LocalworkerServiceDescription createItem;
+ try {
+ createItem = createItem(line);
+ } catch (ItemCreationException e) {
+ logger.warn("Could not create item for: " + line, e);
+ continue;
+ }
+ createItem.setCategory(category);
+ createItem.setProvider("myGrid");
+ items.add(createItem);
+ }
+ }
+ } catch (IOException e1) {
+ logger.warn("Could not read local worker definitions from " + LOCALWORKER_NAMES);
+ }
+ callBack.partialResults(items);
+ callBack.finished();
+
+ }
+
+ @Override
+ public ServiceDescriptionProvider newInstance() {
+ return new LocalworkerServiceProvider();
+ }
+
+ @SuppressWarnings("serial")
+ public class ItemCreationException extends Exception {
+
+ public ItemCreationException() {
+ super();
+ }
+
+ public ItemCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ItemCreationException(String message) {
+ super(message);
+ }
+
+ public ItemCreationException(Throwable cause) {
+ super(cause);
+ }
+
+ }
+
+ /**
+ * Loads the deserialised local worker from disk and creates a {@link LocalworkerActivityItem}
+ * with the correct ports and script from it
+ *
+ * @param line
+ * @return a LocalWorker with the appropriate Input/Output ports and script
+ * @throws ItemCreationException
+ */
+ private LocalworkerServiceDescription createItem(String line) throws ItemCreationException {
+ // get the file from disk
+ String resource = "/" + line + ".json";
+ InputStream resourceAsStream = getClass().getResourceAsStream(resource);
+ if (resourceAsStream == null) {
+ throw new ItemCreationException("Could not find resource " + resource);
+ }
+
+ JsonNode json;
+ try {
+ json = objectMapper.readTree(resourceAsStream);
+ } catch (IOException e) {
+ throw new ItemCreationException("Could not read resource " + resource, e);
+ }
+
+ LocalworkerServiceDescription item = new LocalworkerServiceDescription();
+ item.setJson(json);
+ item.setLocalworkerName(line);
+ item.setOperation(localWorkerToScript.get(line));
+ return item;
+
+ }
+
+ public Icon getIcon() {
+ return LocalworkerActivityIcon.getLocalworkerIcon();
+ }
+
+ @Override
+ public String toString() {
+ return "Local workers provider";
+ }
+
+ public static String getServiceNameFromClassname(String classname) {
+ return (localWorkerToScript.get(classname));
+ }
+
+ public String getId() {
+ return providerId.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityConfigView.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityConfigView.java
new file mode 100644
index 0000000..7030d46
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityConfigView.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.localworker.views;
+
+import org.apache.taverna.activities.beanshell.views.BeanshellConfigurationPanel;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class LocalworkerActivityConfigView extends BeanshellConfigurationPanel {
+
+ public LocalworkerActivityConfigView(Activity activity, ApplicationConfiguration applicationConfiguration) {
+ super(activity, applicationConfiguration);
+ }
+
+ public boolean isConfigurationChanged() {
+ boolean configurationChanged = super.isConfigurationChanged();
+ if (configurationChanged) {
+ getJson().put("isAltered", true);
+ }
+ return configurationChanged;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityContextualView.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityContextualView.java
new file mode 100644
index 0000000..2980c36
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityContextualView.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.localworker.views;
+
+import java.awt.Frame;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.localworker.actions.LocalworkerActivityConfigurationAction;
+import org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+@SuppressWarnings("serial")
+public class LocalworkerActivityContextualView extends HTMLBasedActivityContextualView {
+
+ private final EditManager editManager;
+ private final FileManager fileManager;
+ private final ActivityIconManager activityIconManager;
+ private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+ private final ApplicationConfiguration applicationConfiguration;
+
+ public LocalworkerActivityContextualView(Activity activity, EditManager editManager,
+ FileManager fileManager, ColourManager colourManager,
+ ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry,
+ ApplicationConfiguration applicationConfiguration) {
+ super(activity, colourManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.activityIconManager = activityIconManager;
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ StringBuilder html = new StringBuilder();
+ html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
+ for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
+ html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
+ html.append(inputActivityPort.getDepth() + "</td></tr>");
+ }
+ html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
+ for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
+ html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
+ html.append(outputActivityPort.getDepth() + "</td></tr>");
+ }
+ return html.toString();
+ }
+
+ @Override
+ public String getViewTitle() {
+ String result = "";
+ Configuration configuration = getConfigBean();
+ JsonNode json = configuration.getJson();
+ String workerName = LocalworkerServiceProvider.getServiceNameFromClassname(json.get(
+ "localworkerName").textValue());
+ if (json.get("isAltered").booleanValue()) {
+ result = "Altered local worker service";
+ if ((workerName != null) && !workerName.equals("")) {
+ result += " - originally " + workerName;
+ }
+ } else {
+ result = "Local worker service";
+ if ((workerName != null) && !workerName.equals("")) {
+ result += " - " + workerName;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new LocalworkerActivityConfigurationAction(getActivity(), owner, editManager,
+ fileManager, activityIconManager, serviceDescriptionRegistry,
+ applicationConfiguration);
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 100;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityViewFactory.java b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityViewFactory.java
new file mode 100644
index 0000000..ec48292
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/java/org/apache/taverna/activities/localworker/views/LocalworkerActivityViewFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.localworker.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class LocalworkerActivityViewFactory implements ContextualViewFactory<Activity> {
+
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ActivityIconManager activityIconManager;
+ private ColourManager colourManager;
+ private ServiceDescriptionRegistry serviceDescriptionRegistry;
+ private ApplicationConfiguration applicationConfiguration;
+
+ public boolean canHandle(Object object) {
+ return object instanceof Activity
+ && ((Activity) object).getType()
+ .equals(LocalworkerServiceDescription.ACTIVITY_TYPE);
+ }
+
+ public List<ContextualView> getViews(Activity activity) {
+ return Arrays.asList(new ContextualView[] { new LocalworkerActivityContextualView(activity,
+ editManager, fileManager, colourManager, activityIconManager,
+ serviceDescriptionRegistry, applicationConfiguration) });
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+ this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+ }
+
+ public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index c3c01e0..0000000
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 5911ddf..0000000
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.localworker.menu.ConfigureLocalworkerMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 720a022..0000000
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index f1d2c0d..0000000
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.localworker.views.LocalworkerActivityViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..7a2e65b
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..98f48fe
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1 @@
+org.apache.taverna.activities.localworker.menu.ConfigureLocalworkerMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..990d212
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..f1d1fe0
--- /dev/null
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.localworker.views.LocalworkerActivityViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context-osgi.xml b/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context-osgi.xml
index dd4c7a8..a8c3ab7 100644
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context-osgi.xml
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context-osgi.xml
@@ -6,19 +6,19 @@
http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
- <service ref="LocalworkerActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+ <service ref="LocalworkerActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
- <service ref="LocalworkerServiceProvider" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+ <service ref="LocalworkerServiceProvider" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
<service ref="ConfigureLocalworkerMenuAction" auto-export="interfaces" />
- <service ref="LocalworkerActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+ <service ref="LocalworkerActivityViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+ <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+ <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context.xml b/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context.xml
index edcd6be..4c1bc28 100644
--- a/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context.xml
+++ b/taverna-localworker-activity-ui/src/main/resources/META-INF/spring/localworker-activity-ui-context.xml
@@ -3,11 +3,11 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="LocalworkerActivityIcon" class="net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerActivityIcon" />
+ <bean id="LocalworkerActivityIcon" class="org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerActivityIcon" />
- <bean id="LocalworkerServiceProvider" class="net.sf.taverna.t2.activities.localworker.servicedescriptions.LocalworkerServiceProvider" />
+ <bean id="LocalworkerServiceProvider" class="org.apache.taverna.activities.localworker.servicedescriptions.LocalworkerServiceProvider" />
- <bean id="ConfigureLocalworkerMenuAction" class="net.sf.taverna.t2.activities.localworker.menu.ConfigureLocalworkerMenuAction">
+ <bean id="ConfigureLocalworkerMenuAction" class="org.apache.taverna.activities.localworker.menu.ConfigureLocalworkerMenuAction">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
@@ -15,7 +15,7 @@
<property name="applicationConfiguration" ref="applicationConfiguration" />
</bean>
- <bean id="LocalworkerActivityViewFactory" class="net.sf.taverna.t2.activities.localworker.views.LocalworkerActivityViewFactory">
+ <bean id="LocalworkerActivityViewFactory" class="org.apache.taverna.activities.localworker.views.LocalworkerActivityViewFactory">
<property name="editManager" ref="editManager" />
<property name="fileManager" ref="fileManager" />
<property name="activityIconManager" ref="activityIconManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker
index d6c62b2..c491c54 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.GenBankParserWorker
@@ -1,7 +1,7 @@
<activity xmlns="http://taverna.sf.net/2008/xml/t2flow">
-<class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.biojava.bio.seq.Sequence;
import org.biojava.bio.seq.SequenceIterator;
import org.biojava.bio.seq.io.SeqIOTools;
@@ -50,7 +50,7 @@ ps.close();
<element class="string">uk.org.mygrid.resources:biojava:1.4pre1</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -59,16 +59,16 @@ ps.close();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>genbankdata</name>
<depth>0</depth>
<mimeTypes>
<string>'text/xml'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker
index 0044c82..68aba93 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.ReverseCompWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.biojava.bio.seq.DNATools;
import org.biojava.bio.symbol.SymbolList;
@@ -19,7 +19,7 @@ revSeq = symL.seqString();
<element class="string">uk.org.mygrid.resources:biojava:1.4pre1</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -28,16 +28,16 @@ revSeq = symL.seqString();
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>revSeq</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker
----------------------------------------------------------------------
diff --git a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker
index 7f64778..60a7e25 100644
--- a/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker
+++ b/taverna-localworker-activity-ui/src/main/resources/net.sourceforge.taverna.scuflworkers.biojava.SwissProtParserWorker
@@ -1,4 +1,4 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
+<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import org.biojava.bio.seq.Sequence;
import org.biojava.bio.seq.SequenceIterator;
import org.biojava.bio.seq.io.SeqIOTools;
@@ -48,7 +48,7 @@ ps.close();
<element class="string">uk.org.mygrid.resources:biojava:1.4pre1</element>
</dependencies>
<inputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
@@ -57,16 +57,16 @@ ps.close();
<mimeTypes>
<string>'text/plain</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
- <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>results</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
- </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
+ </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
-</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
+</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>
\ No newline at end of file
[21/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
deleted file mode 100644
index e8291ed..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/SshInvocationMechanismEditor.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.manager.ssh;
-
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor;
-import net.sf.taverna.t2.activities.externaltool.ssh.ExternalToolSshInvocationMechanism;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode;
-import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNodeFactory;
-
-/**
- * @author alanrw
- *
- */
-public final class SshInvocationMechanismEditor extends
- InvocationMechanismEditor<ExternalToolSshInvocationMechanism> {
-
- private ArrayList<ExternalToolSshNodeViewer> nodeViewers = new ArrayList<ExternalToolSshNodeViewer>();
- private int inputGridy = 0;
-
- private ExternalToolSshInvocationMechanism mechanism = null;
-
- private static Insets insets = new Insets(1,5,1,5);
-
- private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
-
- @Override
- public boolean canShow(Class<?> c) {
- return ExternalToolSshInvocationMechanism.class.isAssignableFrom(c);
- }
-
- @Override
- public void show(ExternalToolSshInvocationMechanism invocationMechanism) {
- mechanism = invocationMechanism;
- this.removeAll();
- inputGridy = 1;
- final JPanel innerPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints inputConstraint = new GridBagConstraints();
- inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- inputConstraint.gridx = 0;
- inputConstraint.gridy = 0;
- inputConstraint.weightx = 0.1;
- inputConstraint.fill = GridBagConstraints.BOTH;
-
- inputConstraint.gridx = 0;
- nodeViewers.clear();
- for (SshNode node : invocationMechanism.getNodes()) {
- ExternalToolSshNodeViewer nodeViewer = new ExternalToolSshNodeViewer(node);
- addNodeViewer(this, innerPanel, nodeViewer);
- }
-
- this.setLayout(new GridBagLayout());
- GridBagConstraints outerPanelConstraint = new GridBagConstraints();
- outerPanelConstraint.gridx = 0;
- outerPanelConstraint.gridy = 0;
- outerPanelConstraint.weightx = 0.1;
- outerPanelConstraint.weighty = 0.1;
- outerPanelConstraint.fill = GridBagConstraints.BOTH;
- this.add(new JScrollPane(innerPanel),
- outerPanelConstraint);
- outerPanelConstraint.weighty = 0;
- final JButton addHostButton = new DeselectingButton("Add host",
- new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
-
- ExternalToolSshNodeViewer newViewer = new ExternalToolSshNodeViewer();
-
- addNodeViewer(SshInvocationMechanismEditor.this, innerPanel, newViewer);
- innerPanel.revalidate();
- innerPanel.repaint();
- }
-
- });
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new GridBagLayout());
-
- JPanel filler = new JPanel();
- outerPanelConstraint.weightx = 0.1;
- outerPanelConstraint.weighty = 0;
- outerPanelConstraint.gridx = 0;
- outerPanelConstraint.gridy = 0;
-
- buttonPanel.add(filler, outerPanelConstraint);
-
- outerPanelConstraint.weightx = 0;
- outerPanelConstraint.weighty = 0;
- outerPanelConstraint.gridx = 1;
- outerPanelConstraint.gridy = 0;
-
- buttonPanel.add(addHostButton, outerPanelConstraint);
-
- outerPanelConstraint.weightx = 0;
- outerPanelConstraint.weighty = 0;
- outerPanelConstraint.gridx = 0;
- outerPanelConstraint.gridy = 1;
- outerPanelConstraint.fill = GridBagConstraints.BOTH;
- this.add(buttonPanel, outerPanelConstraint);
- }
-
- protected void addNodeViewer(final JPanel result, final JPanel innerPanel,
- ExternalToolSshNodeViewer viewer) {
- final JPanel subPanel = new JPanel();
- subPanel.setLayout(new GridBagLayout());
- subPanel.setBorder(border);
- final GridBagConstraints inputConstraint = new GridBagConstraints();
- inputConstraint.insets = insets;
- inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- inputConstraint.weightx = 0.1;
- inputConstraint.fill = GridBagConstraints.BOTH;
-
- inputConstraint.gridy = 0 ;
- inputConstraint.gridx = 0;
-
- subPanel.add(new JLabel("Host: "), inputConstraint);
- final JTextField hostnameField = viewer.getHostnameField();
- inputConstraint.gridx++;
- subPanel.add(hostnameField, inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 0;
- subPanel.add(new JLabel("Port: "), inputConstraint);
- final JTextField portField = viewer.getPortField();
- inputConstraint.gridx++;
- subPanel.add(portField ,inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 0;
- subPanel.add(new JLabel("Working directory: "), inputConstraint);
- final JTextField directoryField = viewer.getDirectoryField();
- inputConstraint.gridx++;
- subPanel.add(directoryField ,inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 0;
- subPanel.add(new JLabel("Link command: "), inputConstraint);
- final JTextField linkCommandField = viewer.getLinkCommandField();
- inputConstraint.gridx++;
- subPanel.add(linkCommandField ,inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 0;
- subPanel.add(new JLabel("Copy command: "), inputConstraint);
- final JTextField copyCommandField = viewer.getCopyCommandField();
- inputConstraint.gridx++;
- subPanel.add(copyCommandField ,inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 0;
- subPanel.add(new JLabel("Fetch data: "), inputConstraint);
- inputConstraint.gridx++;
- final JCheckBox retrieveDataField = viewer.getRetrieveDataField();
- subPanel.add(retrieveDataField ,inputConstraint);
-
- inputConstraint.gridy++ ;
- inputConstraint.gridx = 1;
- inputConstraint.fill = GridBagConstraints.NONE;
- inputConstraint.anchor = GridBagConstraints.EAST;
- final ExternalToolSshNodeViewer v = viewer;
- final JButton removeButton = new DeselectingButton("Remove",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
- synchronized(nodeViewers) {
- nodeViewers.remove(v);
- }
- innerPanel.remove(subPanel);
- innerPanel.revalidate();
- innerPanel.repaint();
- result.revalidate();
- result.repaint();
- }
-
- });
- subPanel.add(removeButton, inputConstraint);
-
- inputConstraint.gridy = ++inputGridy;
- innerPanel.add(subPanel, inputConstraint);
-
- nodeViewers.add(viewer);
- inputGridy++;
- }
-
- private List<SshNode> getNodeList() {
- List<SshNode> result = new ArrayList<SshNode>();
- for (ExternalToolSshNodeViewer viewer : nodeViewers) {
- SshNode node = SshNodeFactory.getInstance().getSshNode(viewer.getHostname(), viewer.getPort(), viewer.getDirectory());
- node.setLinkCommand(viewer.getLinkCommand());
- node.setCopyCommand(viewer.getCopyCommand());
- node.setRetrieveData(viewer.getRetrieveDataField().isSelected());
- result.add(node);
- }
- return result;
- }
-
- @Override
- public ExternalToolSshInvocationMechanism updateInvocationMechanism() {
- mechanism.setNodes(getNodeList());
- return mechanism;
- }
-
- @Override
- public InvocationMechanism createMechanism(String mechanismName) {
- ExternalToolSshInvocationMechanism result = new ExternalToolSshInvocationMechanism();
- result.setName(mechanismName);
- return result;
- }
-
- @Override
- public String getName() {
- return ("SSH");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolContextualMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
deleted file mode 100644
index 1ebdbd1..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolContextualMenuAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.externaltool.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import org.apache.taverna.workflowmodel.Dataflow;
-
-import org.apache.log4j.Logger;
-
-/**
- * An action to add an external tool + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author Alan Williamns
- *
- */
-@SuppressWarnings("serial")
-public class AddExternalToolContextualMenuAction extends AbstractContextualMenuAction {
-
- private static final String ADD_EXTERNAL_TOOL = "Tool";
-
- private static final URI insertSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/insert");
-
- private static Logger logger = Logger.getLogger(AddExternalToolMenuAction.class);
-
- private EditManager editManager;
-
- private MenuManager menuManager;
-
- private SelectionManager selectionManager;
-
- private ActivityIconManager activityIconManager;
-
- public AddExternalToolContextualMenuAction() {
- super(insertSection, 900);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled() && getContextualSelection().getSelection() instanceof Dataflow;
- }
-
- @Override
- protected Action createAction() {
-
- return new AddExternalToolAction();
- }
-
- protected class AddExternalToolAction extends AbstractAction {
- AddExternalToolAction() {
- super(ADD_EXTERNAL_TOOL, activityIconManager.iconForActivity(
- new ExternalToolActivity()));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(
- ExternalToolTemplateServiceDescription.getServiceDescription(), false,
- editManager, menuManager, selectionManager);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolMenuAction.java
deleted file mode 100644
index ff1f11e..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/AddExternalToolMenuAction.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.externaltool.menu;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-import net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu;
-
-import org.apache.log4j.Logger;
-
-/**
- * An action to add a externaltool activity + a wrapping processor to the workflow.
- *
- * @author Alex Nenadic
- * @author alanrw
- *
- */
-@SuppressWarnings("serial")
-public class AddExternalToolMenuAction extends AbstractMenuAction {
-
- private static final String ADD_EXTERNAL_TOOL = "Tool";
-
- private static final URI ADD_EXTERNAL_TOOL_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddExternalTool");
-
- private static Logger logger = Logger
- .getLogger(AddExternalToolMenuAction.class);
-
- private EditManager editManager;
- private MenuManager menuManager;
- private SelectionManager selectionManager;
-
- private ActivityIconManager activityIconManager;
-
- public AddExternalToolMenuAction() {
- super(InsertMenu.INSERT, 900, ADD_EXTERNAL_TOOL_URI);
- }
-
- @Override
- protected Action createAction() {
-
- return new AddExternalToolAction();
- }
-
- protected class AddExternalToolAction extends DesignOnlyAction {
- AddExternalToolAction () {
- super ();
- putValue(SMALL_ICON, activityIconManager.iconForActivity(
- new ExternalToolActivity()));
- putValue(NAME, ADD_EXTERNAL_TOOL);
- putValue(SHORT_DESCRIPTION, "Tool");
- putValue(Action.ACCELERATOR_KEY,
- KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK));
- }
-
- public void actionPerformed(ActionEvent e) {
- WorkflowView.importServiceDescription(ExternalToolTemplateServiceDescription.getServiceDescription(),
- false, editManager, menuManager, selectionManager);
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setMenuManager(MenuManager menuManager) {
- this.menuManager = menuManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/ConfigureExternalToolMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
deleted file mode 100644
index f57b25c..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/ConfigureExternalToolMenuAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
- *
- * 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.externaltool.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.actions.ExternalToolActivityConfigureAction;
-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;
-
-/**
- * This class adds the plugin configuration action to the context menu of every use case activity.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ConfigureExternalToolMenuAction extends
- AbstractConfigureActivityMenuAction<ExternalToolActivity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
-
- public ConfigureExternalToolMenuAction() {
- super(ExternalToolActivity.class);
- }
-
- @Override
- protected Action createAction() {
- ExternalToolActivityConfigureAction configAction = new ExternalToolActivityConfigureAction(
- findActivity(), getParentFrame(), editManager, fileManager, activityIconManager);
- addMenuDots(configAction);
- return configAction;
- }
-
- 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-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/FeedbackMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/FeedbackMenuAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/FeedbackMenuAction.java
deleted file mode 100644
index 8c7a284..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/menu/FeedbackMenuAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
- *
- * 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.externaltool.menu;
-
-import java.awt.Desktop;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.Icon;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-
-import org.apache.log4j.Logger;
-
-/**
- * This class adds the feedback item to the context menu of every use case
- * activity.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class FeedbackMenuAction extends AbstractMenuAction {
-
- private static Logger logger = Logger.getLogger(FeedbackMenuAction.class);
-
-
- private static final URI feedbackSection = URI.create("http://taverna.sf.net/2009/contextMenu/configure");
-
- public FeedbackMenuAction() {
- super(feedbackSection, 51);
- }
-
- protected Action createAction() {
- // final ImageIcon icon = KnowARCConfigurationFactory.getConfiguration().getIcon();
- return new SendFeedbackAction("Send Feedback...", null);
- }
-
- private final class SendFeedbackAction extends AbstractAction {
- private static final long serialVersionUID = 1L;
-
- private static final String errTitle = "Could not open web browser for feedback:";
- private static final String feedbackUrl = "http://www.taverna.org.uk/about/contact-us/feedback?product=ExternalToolService";
-
- private SendFeedbackAction(String name, Icon icon) {
- super(name, icon);
- }
-
- public void actionPerformed(ActionEvent e) {
- if (Desktop.isDesktopSupported()) {
- try {
- Desktop.getDesktop().browse(URI.create(feedbackUrl));
- } catch (IOException e1) {
- JOptionPane.showMessageDialog(null, feedbackUrl + "\n" + e1.getLocalizedMessage(), errTitle, JOptionPane.ERROR_MESSAGE);
- }
- } else {
- JOptionPane.showMessageDialog(null, "Go to " + feedbackUrl, errTitle, JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
deleted file mode 100644
index 86b0882..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/AddExternalToolServiceDialog.java
+++ /dev/null
@@ -1,189 +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.externaltool.servicedescriptions;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-/**
- * Dialog that lets user specify a URL of a Tool service they want
- * to add to the Service Panel. In the case the Tool URL is behind
- * HTTPS or service's endpoints require HTTPS it will ask user to confirm
- * if they want to trust it.
- *
- * @author Alex Nenadic
- *
- */
-@SuppressWarnings("serial")
-public abstract class AddExternalToolServiceDialog extends HelpEnabledDialog {
-
- private JTextField toolLocationField;
- private Logger logger = Logger.getLogger(AddExternalToolServiceDialog.class);
-
- public AddExternalToolServiceDialog() {
- super(MainWindow.getMainWindow(), "Add tool service", true, null); // create a non-modal dialog
- initComponents();
- setLocationRelativeTo(getParent());
- }
-
- private void initComponents() {
- JPanel mainPanel = new JPanel(new GridBagLayout());
- mainPanel.setBorder(new EmptyBorder(10,10,10,10));
-
- JLabel toolLocatitionLabel = new JLabel("Tool registry location",ExternalToolActivityIcon.getExternalToolIcon(), JLabel.LEFT);
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.weighty = 0.0;
-
- gbc.weightx = 0.0;
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 0);
- mainPanel.add(toolLocatitionLabel, gbc);
-
- toolLocationField = new JTextField("http://taverna.nordugrid.org/sharedRepository/xml.php");
- gbc.weightx = 1.0;
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 5);
- mainPanel.add(toolLocationField, gbc);
-
- final JButton addServiceButton = new JButton("Add");
- addServiceButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- addPressed();
- }
- });
-
- // When user presses "Return" key fire the action on the "Add" button
- addServiceButton.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent evt) {
- if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
- addPressed();
- }
- }
- });
- getRootPane().setDefaultButton(addServiceButton);
-
- JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- buttonsPanel.add(addServiceButton);
-
- getContentPane().setLayout(new BorderLayout());
- getContentPane().add(mainPanel, BorderLayout.CENTER);
- getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
-
- setSize(getPreferredSize());
- pack();
- }
-
- /**
- * 'Add service' button pressed or otherwise activated.
- */
- private void addPressed()
- {
- final String toolURLString = toolLocationField.getText().trim();
- new Thread("Adding tool " + toolURLString) {
- public void run() {
- // Only add the service provider for this service if service URL
- // starts with 'http'
- // or if it starts with 'https' and user explicitly said they
- // wanted to trust this service.
- /*
- * if (shouldTrust(toolURLString)){ addRegistry(toolURLString);
- * }
- */
- try {
- URL url = new URL(toolURLString);
- URLConnection connection = url.openConnection();
- try {
- // If the url starts with 'https' - security hook for
- // https connection's trust manager
- // will be engaged and user will be asked automatically
- // if they want
- // to trust the connection (if it is not already
- // trusted). If the urls starts with 'http' -
- // this will not have any effect apart from checking if
- // we can open a connection.
- connection.connect(); // if this does not fail - add the
- // tool
- // service provider for this service to
- // the registry
- } finally {
- try {
- connection.getInputStream().close();
- } catch (IOException ex) {
- }
- }
- addRegistry(toolURLString);
- } catch (Exception ex) { // anything failed
- JOptionPane.showMessageDialog(null,
- "Could not read the tool descriptions from "
- + toolURLString + ":\n" + ex,
- "Could not add tool service",
- JOptionPane.ERROR_MESSAGE);
-
- logger.error(
- "Failed to add tool description provider for service: "
- + toolURLString, ex);
-
- }
- };
- }.start();
- closeDialog();
- }
-
- protected abstract void addRegistry(String tool);
-
- /**
- * Closes the dialog.
- */
- private void closeDialog() {
- setVisible(false);
- dispose();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
deleted file mode 100644
index 566389c..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolActivityIcon.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.servicedescriptions;
-
-import java.awt.Color;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-
-/**
- * This class provides an icon for the use case activity.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolActivityIcon implements ActivityIconSPI {
-
- private static final String PROCESSOR_COLOUR_STRING = "#F28C55";
-
- private static Icon icon;
-
- public int canProvideIconScore(Activity<?> activity) {
- if (activity.getClass().getName().equals(ExternalToolActivity.class.getName()))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(Activity<?> activity) {
- return getExternalToolIcon();
- }
-
- public static Icon getExternalToolIcon() {
- if (icon == null) {
- icon = new ImageIcon(ExternalToolActivityIcon.class.getResource("/externaltool.png"));
- }
- return icon;
- }
-
- public static String getColourString() {
- return PROCESSOR_COLOUR_STRING;
- }
-
- public void setColourManager(ColourManager colourManager) {
- // set colour for XPath processors in the workflow diagram
- colourManager.setPreferredColour(ExternalToolActivity.class.getCanonicalName(),
- Color.decode(PROCESSOR_COLOUR_STRING));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
deleted file mode 100644
index c0a9c72..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceDescription.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.servicedescriptions;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManager;
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-/**
- * ExternalToolServiceDescription stores the repository URL and the use case id so
- * that it can create an ExternalToolActivityConfigurationBean
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolServiceDescription extends ServiceDescription<ExternalToolActivityConfigurationBean> {
-
- private static Logger logger = Logger
- .getLogger(ExternalToolServiceDescription.class);
-
-
- private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
-
- private String repositoryUrl;
- private String externaltoolid;
- private UseCaseDescription useCaseDescription;
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- public String getExternaltoolid() {
- return externaltoolid;
- }
-
- public void setExternaltoolid(String externaltoolid) {
- this.externaltoolid = externaltoolid;
- }
-
- public Icon getIcon() {
- if (useCaseDescription != null) {
- String icon_url = useCaseDescription.getIcon_url();
- if ((icon_url != null) && !icon_url.isEmpty() && !icon_url.endsWith(".ico"))
- try {
- ImageIcon result = new ImageIcon(new URL(icon_url));
- if ((result != null) && (result.getIconHeight() != 0) && (result.getIconWidth() != 0)){
- return result;
- }
- } catch (MalformedURLException e) {
- logger.error("Problematic URL" + icon_url, e);
- }
- }
- return ExternalToolActivityIcon.getExternalToolIcon();
- }
-
- public Class<? extends Activity<ExternalToolActivityConfigurationBean>> getActivityClass() {
- return ExternalToolActivity.class;
- }
-
- public ExternalToolActivityConfigurationBean getActivityConfiguration() {
- ExternalToolActivityConfigurationBean bean = new ExternalToolActivityConfigurationBean();
- bean.setRepositoryUrl(repositoryUrl);
- bean.setExternaltoolid(externaltoolid);
- bean.setUseCaseDescription(useCaseDescription);
- bean.setMechanism(manager.getDefaultMechanism());
-
- return bean;
- }
-
- public String getName() {
- return externaltoolid;
- }
-
- @SuppressWarnings("unchecked")
- public List<? extends Comparable> getPath() {
- List<String> result = new ArrayList<String>();
- result.add("Tools decribed @ " + repositoryUrl);
- String group = useCaseDescription.getGroup();
- if ((group != null) && !group.isEmpty()) {
- String[] groups = group.split(":");
- for (String g : groups) {
- result.add(g);
- }
- }
- return result;
- }
-
- protected List<Object> getIdentifyingData() {
- // we require use cases inside one XML file to have unique IDs, which
- // means every externaltool is uniquely identified by its repository URL and
- // its use case ID.
- return Arrays.<Object> asList(repositoryUrl, externaltoolid);
- }
-
- public String getDescription() {
- if (useCaseDescription != null) {
- String description = useCaseDescription.getDescription();
- if (description == null) {
- return "";
- }
- return description;
- }
- return "";
- }
-
- public void setUseCaseDescription(UseCaseDescription usecase) {
- this.useCaseDescription = usecase;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
deleted file mode 100644
index 8eee3f2..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProvider.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.servicedescriptions;
-
-import java.io.IOException;
-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.servicedescriptions.AbstractConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-/**
- * ExternalToolServiceProvider searches an use case repository XML for use case
- * descriptions.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolServiceProvider extends AbstractConfigurableServiceProvider<ExternalToolServiceProviderConfig>
- implements CustomizedConfigurePanelProvider<ExternalToolServiceProviderConfig> {
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/externaltool");
-
- public ExternalToolServiceProvider() {
- super(new ExternalToolServiceProviderConfig("http://taverna.nordugrid.org/sharedRepository/xml.php"));
- }
-
- public String getName() {
- return "Tool service";
- }
-
- public List<ExternalToolServiceProviderConfig> getDefaultConfigurations() {
- List<ExternalToolServiceProviderConfig> defaults = new ArrayList<ExternalToolServiceProviderConfig>();
- // Disabled until sensible set
-// defaults.add(new ExternalToolServiceProviderConfig("http://taverna.nordugrid.org/sharedRepository/xml.php"));
- return defaults;
- }
-
- public void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack) {
- String repositoryUrl = serviceProviderConfig.getRepositoryUrl();
- callBack.status("Parsing use case repository:" + repositoryUrl);
- // prepare a list of all use case descriptions which are stored in
- // the given repository URL
- List<UseCaseDescription> usecases = new ArrayList<UseCaseDescription> ();
- try {
- usecases = UseCaseEnumeration.readDescriptionsFromUrl(
- repositoryUrl);
- } catch (IOException e) {
- callBack.fail("Unable to read tool descriptions", e);
- }
- callBack.status("Found " + usecases.size() + " use cases:" + repositoryUrl);
- // convert all the UseCaseDescriptions in the XML file into
- // ExternalToolServiceDescription items
- List<ExternalToolServiceDescription> items = new ArrayList<ExternalToolServiceDescription>();
- for (UseCaseDescription usecase : usecases) {
- ExternalToolServiceDescription item = new ExternalToolServiceDescription();
- item.setRepositoryUrl(repositoryUrl);
- item.setExternaltoolid(usecase.getUsecaseid());
- item.setUseCaseDescription(usecase);
- items.add(item);
- }
- // we dont have streaming data loading or partial results, so return
- // results and finish
- callBack.partialResults(items);
- callBack.finished();
- }
-
- @Override
- public String toString() {
- return getName() + " " + getConfiguration().getRepositoryUrl();
- }
-
- public Icon getIcon() {
- return ExternalToolActivityIcon.getExternalToolIcon();
- }
-
- @Override
- protected List<? extends Object> getIdentifyingData() {
- List<String> result;
- // one can fully identify an use case repository by its URL
- result = Arrays.asList(getConfiguration().getRepositoryUrl());
- return result;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry registry) {
- }
-
- @SuppressWarnings("serial")
- public void createCustomizedConfigurePanel(final CustomizedConfigureCallBack<ExternalToolServiceProviderConfig> callBack) {
-
- AddExternalToolServiceDialog addWSDLServiceDialog = new AddExternalToolServiceDialog() {
- @Override
- protected void addRegistry(String externalToolURL) {
-
- ExternalToolServiceProviderConfig providerConfig = new ExternalToolServiceProviderConfig(externalToolURL);
- callBack.newProviderConfiguration(providerConfig);
- }
- };
- addWSDLServiceDialog.setVisible(true);
- }
-
-
- public String getId() {
- return providerId.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
deleted file mode 100644
index 0967a6e..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolServiceProviderConfig.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.servicedescriptions;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
-import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
-
-/**
- * ExternalToolServiceProviderConfig stores the URL of the use case repository XML file
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolServiceProviderConfig extends PropertyAnnotated {
- private String repositoryUrl;
-
- public ExternalToolServiceProviderConfig() {
- }
-
- public ExternalToolServiceProviderConfig(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- @PropertyAnnotation(displayName = "Tool registry location", preferred = true)
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- @Override
- public String toString() {
- return repositoryUrl;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
deleted file mode 100644
index 23f2d7d..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/servicedescriptions/ExternalToolTemplateServiceDescription.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.servicedescriptions;
-
-import java.net.URI;
-import java.util.UUID;
-
-import javax.swing.Icon;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManager;
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-
-/**
- * @author alanrw
- *
- */
-public class ExternalToolTemplateServiceDescription extends
- AbstractTemplateService<ExternalToolActivityConfigurationBean> {
-
- private static final URI providerId = URI
- .create("http://taverna.sf.net/2010/service-provider/external-tool");
-
- private static final String EXTERNAL_TOOL = "Tool";
-
- private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
-
- @Override
- public Class<? extends Activity<ExternalToolActivityConfigurationBean>> getActivityClass() {
- return ExternalToolActivity.class;
- }
-
- @Override
- public ExternalToolActivityConfigurationBean getActivityConfiguration() {
- ExternalToolActivityConfigurationBean result = new ExternalToolActivityConfigurationBean();
- result.setExternaltoolid(UUID.randomUUID().toString());
- result.setUseCaseDescription(new UseCaseDescription(""));
- result.setMechanism(manager.getDefaultMechanism());
- return result;
- }
-
- @Override
- public Icon getIcon() {
- return ExternalToolActivityIcon.getExternalToolIcon();
- }
-
- @Override
- public String getDescription() {
- return "A service that allows tools to be used as services";
- }
-
- @SuppressWarnings("unchecked")
- public static ServiceDescription getServiceDescription() {
- ExternalToolTemplateServiceDescription bts = new ExternalToolTemplateServiceDescription();
- return bts.templateService;
- }
-
-
-
- @Override
- public String getId() {
- return providerId.toString();
- }
-
- @Override
- public String getName() {
- return EXTERNAL_TOOL;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/utils/Tools.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/utils/Tools.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/utils/Tools.java
deleted file mode 100644
index 55cda5c..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/utils/Tools.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.utils;
-
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputUser;
-
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- *
- */
-public class Tools {
-
- private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
-
- private static Insets insets = new Insets(5,5,5,5);
-
- public static void addViewer(final JPanel innerPanel, String[] labels, JComponent[] elements,
- final List viewerList, final Object viewer, final JPanel outerPanel) {
- final JPanel subPanel = new JPanel();
- subPanel.setLayout(new GridBagLayout());
- subPanel.setBorder(border);
-
- final GridBagConstraints labelConstraint = new GridBagConstraints();
- labelConstraint.insets = insets;
- labelConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- labelConstraint.fill = GridBagConstraints.BOTH;
- labelConstraint.gridy = 0;
- labelConstraint.gridx = 0;
- labelConstraint.weightx = 0;
-
- final GridBagConstraints elementConstraint = new GridBagConstraints();
- elementConstraint.insets = insets;
- elementConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- elementConstraint.fill = GridBagConstraints.BOTH;
- elementConstraint.gridy = 0;
- elementConstraint.gridx = 1;
- elementConstraint.weightx = 1.0;
-
- final GridBagConstraints removeConstraint = new GridBagConstraints();
- removeConstraint.insets = insets;
- removeConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- removeConstraint.fill = GridBagConstraints.BOTH;
- removeConstraint.gridx = 1;
- removeConstraint.weightx = 0;
- removeConstraint.fill = GridBagConstraints.NONE;
- removeConstraint.anchor = GridBagConstraints.EAST;
-
- final GridBagConstraints subPanelConstraint = new GridBagConstraints();
- subPanelConstraint.insets = insets;
- subPanelConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- subPanelConstraint.fill = GridBagConstraints.BOTH;
- subPanelConstraint.gridx = 1;
-// subPanelConstraint.gridy = ++stringReplacementGridy;
- subPanelConstraint.weightx = 1.00;
- subPanelConstraint.fill = GridBagConstraints.HORIZONTAL;
- subPanelConstraint.anchor = GridBagConstraints.WEST;
-
- for (int i = 0; i < labels.length; i++) {
- subPanel.add(new JLabel(labels[i] + ":"), labelConstraint);
- subPanel.add(elements[i], elementConstraint);
- labelConstraint.gridy++;
- elementConstraint.gridy++;
- }
-
- removeConstraint.gridy = labelConstraint.gridy + 1;
- final JButton removeButton = new DeselectingButton("Remove",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
- synchronized (viewerList) {
- viewerList.remove(viewer);
- }
- innerPanel.remove(subPanel);
- innerPanel.revalidate();
- innerPanel.repaint();
- outerPanel.revalidate();
- outerPanel.repaint();
- }
-
- });
- subPanel.add(removeButton, removeConstraint);
- innerPanel.add(subPanel, subPanelConstraint);
- }
-
- public static boolean isStringReplacement(ScriptInputUser si) {
- return !si.isList() && !si.isFile() && !si.isTempFile();
- }
-
- public static boolean isInputFile(ScriptInputUser si) {
- return !si.isList() && si.isFile();
- }
-
- public static boolean isFileList(ScriptInputUser si) {
- return si.isList() && si.isFile();
- }
-
- public static boolean isUnderstood(ScriptInputUser si) {
- return isStringReplacement(si) || isInputFile(si) || isFileList(si);
- }
-
- public static boolean areAllUnderstood(Map<String, ScriptInput> inputs) {
- for (ScriptInput si : inputs.values()) {
- if ((si instanceof ScriptInputUser) && !isUnderstood((ScriptInputUser) si)) {
- return false;
- }
- }
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/AnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/AnnotationPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/AnnotationPanel.java
deleted file mode 100644
index 83e75e8..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/AnnotationPanel.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * @author alanrw
- *
- */
-public class AnnotationPanel extends JPanel {
-
- public AnnotationPanel(Component nameField, Component descriptionArea, Component groupField) {
- super();
- this.setLayout(new BorderLayout());
- JPanel subPanel = new JPanel(new BorderLayout());
- JPanel namePanel = new JPanel();
- namePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
- namePanel.add(new JLabel("Name: "));
- namePanel.add(nameField);
- subPanel.add(namePanel, BorderLayout.NORTH);
- JPanel groupPanel = new JPanel();
- groupPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
- groupPanel.add(new JLabel("Group: "));
- groupPanel.add(groupField);
- subPanel.add(groupPanel, BorderLayout.SOUTH);
- this.add(subPanel, BorderLayout.NORTH);
- JPanel descriptionPanel = new JPanel();
- descriptionPanel.setLayout(new BorderLayout());
- descriptionPanel.add(new JLabel("Description:"), BorderLayout.NORTH);
- descriptionPanel.add(descriptionArea, BorderLayout.CENTER);
- this.add(descriptionPanel, BorderLayout.CENTER);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/EditablePanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/EditablePanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/EditablePanel.java
deleted file mode 100644
index b395983..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/EditablePanel.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolServiceDescription;
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- *
- */
-public class EditablePanel extends JPanel {
- public EditablePanel(final ExternalToolConfigView view) {
- super(new FlowLayout());
-
- JButton update = new DeselectingButton("Update tool description",
- new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ExternalToolActivityConfigurationBean bean = view.getConfiguration();
- String repositoryUrl = bean.getRepositoryUrl();
- String id = bean.getExternaltoolid();
- UseCaseDescription usecase = null;
- try {
- usecase = UseCaseEnumeration.readDescriptionFromUrl(
- repositoryUrl, id);
- }
- catch (IOException ex) {
- // Already logged
- }
- if (usecase != null) {
- bean.setUseCaseDescription(usecase);
- view.refreshConfiguration(bean);
- } else {
- JOptionPane.showMessageDialog(view, "Unable to find tool description " + id, "Missing tool description", JOptionPane.ERROR_MESSAGE);
- }
- }});
- this.add(update);
-
- JButton makeEditable = new DeselectingButton("Edit tool description",
- new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- ExternalToolActivityConfigurationBean config = view.makeConfiguration();
- view.setEditable(true, config);
-
- }
- });
- makeEditable.setToolTipText("Edit the tool description");
- if (Tools.areAllUnderstood(view.getConfiguration().getUseCaseDescription().getInputs())) {
- this.add(makeEditable);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityContextualView.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityContextualView.java
deleted file mode 100644
index 39b2c5e..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityContextualView.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.views;
-
-import java.awt.Frame;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.actions.ExternalToolActivityConfigureAction;
-import net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolActivityIcon;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInput;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptInputStatic;
-import de.uni_luebeck.inb.knowarc.usecases.ScriptOutput;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-/**
- * ExternalToolActivityContextualView displays the use case information in a HTML table. Currently,
- * this is only the use case ID.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolActivityContextualView extends
- HTMLBasedActivityContextualView<ExternalToolActivityConfigurationBean> {
- private static final long serialVersionUID = 1L;
- private final EditManager editManager;
- private final FileManager fileManager;
- private final ActivityIconManager activityIconManager;
-
- public ExternalToolActivityContextualView(Activity<?> activity, EditManager editManager,
- FileManager fileManager, ColourManager colourManager, ActivityIconManager activityIconManager) {
- super(activity, colourManager);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.activityIconManager = activityIconManager;
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- String html = "";
- ExternalToolActivityConfigurationBean bean = getConfigBean();
- String repositoryUrl = bean.getRepositoryUrl();
- if ((repositoryUrl == null) || repositoryUrl.isEmpty()) {
- repositoryUrl = "<b>Not specified</b>";
- }
- html += "<tr><td>Repository URL</td><td>" + repositoryUrl + "</td></tr>";
-
- String id = bean.getExternaltoolid();
- if ((id == null) || id.isEmpty()) {
- id = "<b>Not specified</b>";
- }
- html += "<tr><td>Id</td><td>" + id + "</td></tr>";
-
- UseCaseDescription useCaseDescription = bean.getUseCaseDescription();
- String name = useCaseDescription.getUsecaseid();
- if ((name == null) || name.isEmpty()) {
- name = "<b>Not specified</b>";
- }
- html += "<tr><td>Name</td><td>" + name + "</td></tr>";
-
- Map<String, ScriptInput> stringReplacements = new TreeMap<String, ScriptInput>();
- Map<String, ScriptInput> fileInputs = new TreeMap<String, ScriptInput>();
-
- for (Entry<String, ScriptInput> entry : useCaseDescription.getInputs().entrySet()) {
- String key = entry.getKey();
- ScriptInput value = entry.getValue();
- if (value.isFile()) {
- fileInputs.put(key, value);
- } else if (value.isTempFile()) {
- // Nothing
- } else {
- stringReplacements.put(key, value);
- }
- }
-
- if (!stringReplacements.isEmpty()) {
- html += "<tr><td colspan=2 align=center><b>String replacements</b></td></tr>";
- html += "<tr><td><b>Port name</b></td><td><b>Replaces</b></td></tr>";
- for (String siName : stringReplacements.keySet()) {
- html += "<tr><td>" + siName + "</td>";
- ScriptInput si = stringReplacements.get(siName);
- html += "<td>%%" + si.getTag() + "%%</td>";
-
- html += "</tr>";
- }
- }
-
- if (!fileInputs.isEmpty()) {
- html += "<tr><td colspan=2 align=center><b>File inputs</b></td></tr>";
- html += "<tr><td><b>Port name</b></td><td><b>To file</b></td></tr>";
- for (String siName : fileInputs.keySet()) {
- html += "<tr><td>" + siName + "</td>";
- ScriptInput si = fileInputs.get(siName);
- html += "<td>" + si.getTag() + "</td>";
-
- html += "</tr>";
- }
- }
-
- List<ScriptInputStatic> staticInputs = useCaseDescription.getStatic_inputs();
- if (!staticInputs.isEmpty()) {
- html += "<tr><td colspan=2 align=center><b>Static inputs</b></td></tr>";
- html += "<tr><td><b>Type</b></td><td><b>To file</b></td></tr>";
- for (ScriptInputStatic si : staticInputs) {
- if (si.getUrl() != null) {
- html += "<td><b>URL</b></td>";
- } else {
- html += "<td><b>Explicit content</b></td>";
- }
- if (si.isFile()) {
- html += "<td>" + si.getTag() + "</td>";
- }
- html += "</tr>";
- }
- }
- Map<String, ScriptOutput> outputs = useCaseDescription.getOutputs();
- if (!outputs.isEmpty()) {
- html += "<tr><td colspan=2 align=center><b>File outputs</b></td></tr>";
- html += "<tr><td><b>Port name</b></td><td><b>From file</b></td></tr>";
- for (String soName : outputs.keySet()) {
- html += "<tr><td>" + soName + "</td>";
- ScriptOutput so = outputs.get(soName);
- html += "<td>" + so.getPath() + "</td>";
- html += "</tr>";
- }
- }
- return html;
- }
-
- @Override
- public String getViewTitle() {
- return "Tool service";
- }
-
- @Override
- public Action getConfigureAction(final Frame owner) {
- return new ExternalToolActivityConfigureAction((ExternalToolActivity) getActivity(), owner,
- editManager, fileManager, activityIconManager);
- }
-
- public String getBackgroundColour() {
-
- return ExternalToolActivityIcon.getColourString();
- }
-
- @Override
- public int getPreferredPosition() {
- return 100;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityViewFactory.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityViewFactory.java
deleted file mode 100644
index 902c736..0000000
--- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ExternalToolActivityViewFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2010 Hajo Nils Krabbenhoeft, INB, University of Luebeck
- *
- * 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.externaltool.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-/**
- * ExternalToolActivityViewFactory produces an ExternalToolActivityContextualView to show
- * information for a use case activity.
- *
- * @author Hajo Nils Krabbenhoeft
- */
-public class ExternalToolActivityViewFactory implements ContextualViewFactory<ExternalToolActivity> {
-
- private EditManager editManager;
- private FileManager fileManager;
- private ActivityIconManager activityIconManager;
- private ColourManager colourManager;
-
- public boolean canHandle(Object object) {
- if (object instanceof ExternalToolActivity) {
- return true;
- }
- return false;
- }
-
- public List<ContextualView> getViews(ExternalToolActivity selection) {
- return Arrays.asList(new ContextualView[] { new ExternalToolActivityContextualView(
- selection, editManager, fileManager, colourManager, activityIconManager) });
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
-}
[08/23] incubator-taverna-workbench-common-activities git commit:
Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLInputSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLInputSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLInputSplitterAction.java
deleted file mode 100644
index 6faee9d..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLInputSplitterAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008 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.wsdl.actions;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.AddXMLSplitterEdit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.wsdl.parser.ArrayTypeDescriptor;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-import net.sf.taverna.wsdl.parser.WSDLParser;
-import net.sf.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.xml.sax.SAXException;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
- * that is selected is added as an input splitter to the currently open dataflow
- * using the {@link AddXMLSplitterEdit}
- *
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- */
-@SuppressWarnings("serial")
-public class AddXMLInputSplitterAction extends AbstractAddXMLSplitterAction {
-
- public AddXMLInputSplitterAction(Activity activity, JComponent owner, EditManager editManager,
- SelectionManager selectionManager) {
- super(activity, owner, editManager, selectionManager);
- putValue(NAME, "Add input XML splitter");
- }
-
- @Override
- public Map<String, TypeDescriptor> getTypeDescriptors() throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException {
- Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>();
- Configuration configuration = scufl2Tools.configurationFor(activity, selectionManager.getSelectedProfile());
- if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
- String wsdlLocation = configuration.getJson().get("operation").get("wsdl").textValue();
- String operationName = configuration.getJson().get("operation").get("name").textValue();
- List<TypeDescriptor> inputDescriptors = new WSDLParser(wsdlLocation)
- .getOperationInputParameters(operationName);
- for (TypeDescriptor descriptor : inputDescriptors) {
- descriptors.put(descriptor.getName(), descriptor);
- }
- } else if (activity.getType().equals(WSDLServiceDescription.INPUT_SPLITTER_TYPE)) {
- String wrappedType = configuration.getJson().get("wrappedType").textValue();
- Element element = new SAXBuilder().build(new StringReader(wrappedType)).getRootElement();
- TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
- if (typeDescriptor instanceof ComplexTypeDescriptor) {
- for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) {
- descriptors.put(desc.getName(), desc);
- }
- }
- else if (typeDescriptor instanceof ArrayTypeDescriptor) {
- TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType();
- descriptors.put(typeDescriptor.getName(), desc);
- }
- }
- return descriptors;
- }
-
- @Override
- protected boolean isInput() {
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLOutputSplitterAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLOutputSplitterAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLOutputSplitterAction.java
deleted file mode 100644
index 60cba69..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLOutputSplitterAction.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008 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.wsdl.actions;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.xml.sax.SAXException;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.AddXMLSplitterEdit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.wsdl.parser.ArrayTypeDescriptor;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-import net.sf.taverna.wsdl.parser.WSDLParser;
-import net.sf.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * Pops up a {@link JOptionPane} with the names of all the wsdl ports. The one
- * that is selected is added as an output splitter to the currently open
- * dataflow using the {@link AddXMLSplitterEdit}
- *
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- */
-@SuppressWarnings("serial")
-public class AddXMLOutputSplitterAction extends AbstractAddXMLSplitterAction {
-
- public AddXMLOutputSplitterAction(Activity activity, JComponent owner, EditManager editManager,
- SelectionManager selectionManager) {
- super(activity, owner, editManager, selectionManager);
- putValue(NAME, "Add output XML splitter");
-
- }
-
- @Override
- public Map<String, TypeDescriptor> getTypeDescriptors() throws UnknownOperationException, IOException, ParserConfigurationException, WSDLException, SAXException, JDOMException {
- Map<String, TypeDescriptor> descriptors = new HashMap<String, TypeDescriptor>();
- Configuration configuration = scufl2Tools.configurationFor(activity, selectionManager.getSelectedProfile());
- if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
- String wsdlLocation = configuration.getJson().get("operation").get("wsdl").textValue();
- String operationName = configuration.getJson().get("operation").get("name").textValue();
- List<TypeDescriptor> inputDescriptors = new WSDLParser(wsdlLocation)
- .getOperationOutputParameters(operationName);
- for (TypeDescriptor descriptor : inputDescriptors) {
- descriptors.put(descriptor.getName(), descriptor);
- }
- } else if (activity.getType().equals(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE)) {
- String wrappedType = configuration.getJson().get("wrappedType").textValue();
- Element element = new SAXBuilder().build(new StringReader(wrappedType)).getRootElement();
- TypeDescriptor typeDescriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
- if (typeDescriptor instanceof ComplexTypeDescriptor) {
- for (TypeDescriptor desc : ((ComplexTypeDescriptor) typeDescriptor)
- .getElements()) {
- descriptors.put(desc.getName(), desc);
- }
- }
- else if (typeDescriptor instanceof ArrayTypeDescriptor) {
- TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType();
- descriptors.put(typeDescriptor.getName(), desc);
- }
- }
- return descriptors;
- }
-
- @Override
- protected boolean isInput() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLSplitterEdit.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLSplitterEdit.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLSplitterEdit.java
deleted file mode 100644
index 484feac..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/AddXMLSplitterEdit.java
+++ /dev/null
@@ -1,315 +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.wsdl.actions;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.activities.wsdl.xmlsplitter.XMLSplitterConfigurationBeanBuilder;
-import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workflow.edits.AddChildEdit;
-import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
-import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
-import net.sf.taverna.wsdl.parser.ArrayTypeDescriptor;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
-
-import org.jdom.Element;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.Scufl2Tools;
-import uk.org.taverna.scufl2.api.configurations.Configuration;
-import uk.org.taverna.scufl2.api.core.DataLink;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.core.Workflow;
-import uk.org.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.profiles.ProcessorBinding;
-import uk.org.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class AddXMLSplitterEdit implements Edit<Workflow> {
-
- public static final URI INPUT_SPLITTER_TYPE = URI
- .create("http://ns.taverna.org.uk/2010/activity/xml-splitter/in");
- public static final URI OUTPUT_SPLITTER_TYPE = URI
- .create("http://ns.taverna.org.uk/2010/activity/xml-splitter/out");
- public static final URI SPLITTER_CONFIG_TYPE = URI
- .create("http://ns.taverna.org.uk/2010/activity/xml-splitter#Config");
-
- private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
- private final Workflow workflow;
- private final Profile profile;
- private final Activity activity;
- private TypeDescriptor typeDescriptor;
- private final String portName;
- private final boolean isInput;
-
- private CompoundEdit compoundEdit1 = null;
- private Edit<?> linkUpEdit;
- private boolean applied = false;
-
- public AddXMLSplitterEdit(Workflow workflow, Profile profile, Activity activity,
- TypeDescriptor typeDescriptor, String portName, boolean isInput) {
- this.workflow = workflow;
- this.profile = profile;
- this.activity = activity;
- this.typeDescriptor = typeDescriptor;
- this.portName = portName;
- this.isInput = isInput;
- }
-
- @Override
- public Workflow doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
-
- Activity splitter = null;
- Configuration splitterConfiguration = null;
- String sourcePortName = "";
- Processor sourceProcessor = null;
-
- String sinkPortName = "";
- Processor sinkProcessor = null;
-
- Processor activityProcessor = null;
- List<ProcessorBinding> processorBindingsToActivity = scufl2Tools
- .processorBindingsToActivity(activity);
- for (ProcessorBinding processorBinding : processorBindingsToActivity) {
- activityProcessor = processorBinding.getBoundProcessor();
- break;
- }
- if (activityProcessor == null) {
- throw new EditException("Cannot find the processor that the activity belongs to");
- }
-
- String displayName = portName;
- if (portName.equals("parameters")) {
- displayName = isInput ? "input" : "output";
- }
- String processorName = activityProcessor.getName();
- String candidateName;
- if (displayName.startsWith(processorName)) {
- // No need to make GetRequest_GetRequestResponse
- candidateName = displayName;
- } else {
- // Combine with processor name
- String displayProcessorName;
- if (activity.getType().equals(INPUT_SPLITTER_TYPE)
- || activity.getType().equals(OUTPUT_SPLITTER_TYPE)) {
- // For splitters on splitters - avoid adding up blah_bluh_blih_more_stuff
- String[] processorNameSplit = processorName.replace("_input", "")
- .replace("_output", "").split("_");
- displayProcessorName = processorNameSplit[processorNameSplit.length - 1];
- } else {
- displayProcessorName = activityProcessor.getName();
- }
- candidateName = displayProcessorName + "_" + displayName;
- }
-
- Processor splitterProcessor = new Processor();
- splitterProcessor.setName(candidateName);
-
- CrossProduct crossProduct = new CrossProduct();
- crossProduct.setParent(splitterProcessor.getIterationStrategyStack());
-
- ProcessorBinding processorBinding = new ProcessorBinding();
- processorBinding.setBoundProcessor(splitterProcessor);
-
- try {
- if (activity.getType().equals(INPUT_SPLITTER_TYPE)) {
- if (!isInput) {
- throw new EditException(
- "Can only add an input splitter to another input splitter");
- }
- if (typeDescriptor instanceof ArrayTypeDescriptor
- && !((ArrayTypeDescriptor) typeDescriptor).isWrapped()) {
- typeDescriptor = ((ArrayTypeDescriptor) typeDescriptor).getElementType();
- }
-
- Element element = XMLSplitterSerialisationHelper
- .typeDescriptorToExtensionXML(typeDescriptor);
-// String wrappedType = new XMLOutputter().outputString(element);
-
- splitter = new Activity();
- splitter.setType(INPUT_SPLITTER_TYPE);
- splitterConfiguration = new Configuration();
- splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
- splitterConfiguration.setConfigures(splitter);
-// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
-
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- splitterConfiguration.setJson(bean);
-
- XMLSplitterPortBuilder.addPortsForInput(element, splitter, splitterProcessor,
- processorBinding);
-
- } else if (activity.getType().equals(OUTPUT_SPLITTER_TYPE)) {
- if (isInput) {
- throw new EditException(
- "Can only add an output splitter to another output splitter");
- }
- if (typeDescriptor instanceof ArrayTypeDescriptor
- && !((ArrayTypeDescriptor) typeDescriptor).isWrapped()) {
- typeDescriptor = ((ArrayTypeDescriptor) typeDescriptor).getElementType();
- }
-
- Element element = XMLSplitterSerialisationHelper
- .typeDescriptorToExtensionXML(typeDescriptor);
-// String wrappedType = new XMLOutputter().outputString(element);
-
- splitter = new Activity();
- splitter.setType(OUTPUT_SPLITTER_TYPE);
- splitterConfiguration = new Configuration();
- splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
- splitterConfiguration.setConfigures(splitter);
-// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
-
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
- splitterConfiguration.setJson(bean);
-
- XMLSplitterPortBuilder.addPortsForOutput(element, splitter, splitterProcessor,
- processorBinding);
-
- } else if (activity.getType().equals(WSDLServiceDescription.ACTIVITY_TYPE)) {
- if (isInput) {
- Element element = XMLSplitterSerialisationHelper
- .typeDescriptorToExtensionXML(typeDescriptor);
-// String wrappedType = new XMLOutputter().outputString(element);
-
- splitter = new Activity();
- splitter.setType(WSDLServiceDescription.INPUT_SPLITTER_TYPE);
- splitterConfiguration = new Configuration();
- splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
- splitterConfiguration.setConfigures(splitter);
-// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
-
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- splitterConfiguration.setJson(bean);
-
- XMLSplitterPortBuilder.addPortsForInput(element, splitter, splitterProcessor,
- processorBinding);
-
- } else {
- Element element = XMLSplitterSerialisationHelper
- .typeDescriptorToExtensionXML(typeDescriptor);
-// String wrappedType = new XMLOutputter().outputString(element);
-
- splitter = new Activity();
- splitter.setType(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE);
- splitterConfiguration = new Configuration();
- splitterConfiguration.setType(SPLITTER_CONFIG_TYPE);
- splitterConfiguration.setConfigures(splitter);
-// ((ObjectNode) splitterConfiguration.getJson()).put("wrappedType", wrappedType);
-
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
- splitterConfiguration.setJson(bean);
-
- XMLSplitterPortBuilder.addPortsForOutput(element, splitter, splitterProcessor,
- processorBinding);
- }
- } else {
- throw new EditException(
- "The activity type is not suitable for adding xml processing processors");
- }
- } catch (Exception e) {
- throw new EditException(
- "An error occured whilst tyring to add an XMLSplitter to the activity:"
- + activity, e);
- }
-
- if (isInput) {
- sourcePortName = "output";
- sinkPortName = portName;
- sinkProcessor = activityProcessor;
- sourceProcessor = splitterProcessor;
- } else {
- sourcePortName = portName;
- sinkPortName = "input";
- sinkProcessor = splitterProcessor;
- sourceProcessor = activityProcessor;
- }
-
- processorBinding.setBoundActivity(splitter);
-
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- editList.add(new AddChildEdit<Profile>(profile, splitter));
- editList.add(new AddChildEdit<Profile>(profile, splitterConfiguration));
- editList.add(new AddChildEdit<Profile>(profile, processorBinding));
- editList.add(new AddProcessorEdit(workflow, splitterProcessor));
-
- compoundEdit1 = new CompoundEdit(editList);
- compoundEdit1.doEdit();
-
- List<Edit<?>> linkUpEditList = new ArrayList<Edit<?>>();
-
- OutputProcessorPort source = sourceProcessor.getOutputPorts().getByName(sourcePortName);
- InputProcessorPort sink = sinkProcessor.getInputPorts().getByName(sinkPortName);
-
- if (source == null)
- throw new EditException("Unable to find the source port when linking up "
- + sourcePortName + " to " + sinkPortName);
- if (sink == null)
- throw new EditException("Unable to find the sink port when linking up "
- + sourcePortName + " to " + sinkPortName);
-
- DataLink dataLink = new DataLink();
- dataLink.setReceivesFrom(source);
- dataLink.setSendsTo(sink);
- linkUpEditList.add(new AddDataLinkEdit(workflow, dataLink));
-
- linkUpEdit = new CompoundEdit(linkUpEditList);
- linkUpEdit.doEdit();
- applied = true;
- return workflow;
- }
-
- @Override
- public void undo() {
- if (!applied) {
- throw new RuntimeException("Attempt to undo edit that was never applied");
- }
- if (linkUpEdit.isApplied())
- linkUpEdit.undo();
- if (compoundEdit1.isApplied())
- compoundEdit1.undo();
- applied = false;
- }
-
- @Override
- public boolean isApplied() {
- return applied;
- }
-
- @Override
- public Object getSubject() {
- return workflow;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/WSDLActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/WSDLActivityConfigureAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/WSDLActivityConfigureAction.java
deleted file mode 100644
index 92a8fb6..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/WSDLActivityConfigureAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 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.wsdl.actions;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.Action;
-import javax.swing.JDialog;
-
-import net.sf.taverna.t2.activities.wsdl.views.WSDLActivityConfigurationView;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public class WSDLActivityConfigureAction extends ActivityConfigurationAction {
-
- private final EditManager editManager;
- private final FileManager fileManager;
- private final CredentialManager credentialManager;
-
- public WSDLActivityConfigureAction(Activity activity, Frame owner, EditManager editManager,
- FileManager fileManager, ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry, CredentialManager credentialManager) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.credentialManager = credentialManager;
- putValue(Action.NAME, "Configure security");
- }
-
- public void actionPerformed(ActionEvent e) {
- JDialog currentDialog = ActivityConfigurationAction.getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
- final ActivityConfigurationPanel rshellConfigView = new WSDLActivityConfigurationView(
- getActivity(), credentialManager);
- final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(),
- rshellConfigView, editManager);
-
- ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/XMLSplitterPortBuilder.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/XMLSplitterPortBuilder.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/XMLSplitterPortBuilder.java
deleted file mode 100644
index f41f298..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/actions/XMLSplitterPortBuilder.java
+++ /dev/null
@@ -1,127 +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.wsdl.actions;
-
-import net.sf.taverna.wsdl.parser.ArrayTypeDescriptor;
-import net.sf.taverna.wsdl.parser.BaseTypeDescriptor;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.xmlsplitter.XMLSplitterSerialisationHelper;
-
-import org.jdom.Element;
-
-import uk.org.taverna.scufl2.api.activity.Activity;
-import uk.org.taverna.scufl2.api.common.NamedSet;
-import uk.org.taverna.scufl2.api.core.Processor;
-import uk.org.taverna.scufl2.api.port.InputActivityPort;
-import uk.org.taverna.scufl2.api.port.InputProcessorPort;
-import uk.org.taverna.scufl2.api.port.OutputActivityPort;
-import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
-import uk.org.taverna.scufl2.api.profiles.ProcessorBinding;
-import uk.org.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import uk.org.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-
-/**
- * A helper class to facilitate in building XMLSplitter ports
- * from the type descriptor XML.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class XMLSplitterPortBuilder {
-
- public static void addPortsForInput(Element element, Activity activity, Processor processor,
- ProcessorBinding binding) {
- TypeDescriptor descriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
- addOutputPort("output", 0, activity, processor, binding);
-
- if (descriptor instanceof ComplexTypeDescriptor) {
- for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getElements()) {
- addInputPort(typeDescriptor.getName(), depthForDescriptor(typeDescriptor), activity, processor,
- binding);
- }
- NamedSet<InputActivityPort> inputPorts = activity.getInputPorts();
- for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getAttributes()) {
- String name = typeDescriptor.getName();
- if (inputPorts.containsName(name)) {
- name = "1" + name;
- }
- addInputPort(name, depthForDescriptor(typeDescriptor), activity, processor, binding);
- }
- } else if (descriptor instanceof ArrayTypeDescriptor) {
- addInputPort(descriptor.getName(), 1, activity, processor, binding);
- }
- }
-
- public static void addPortsForOutput(Element element, Activity activity, Processor processor,
- ProcessorBinding binding) {
- TypeDescriptor descriptor = XMLSplitterSerialisationHelper.extensionXMLToTypeDescriptor(element);
- addInputPort("input", 0, activity, processor, binding);
-
- if (descriptor instanceof ComplexTypeDescriptor) {
- for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getElements()) {
- addOutputPort(typeDescriptor.getName(), depthForDescriptor(typeDescriptor), activity, processor,
- binding);
- }
- NamedSet<OutputActivityPort> outputPorts = activity.getOutputPorts();
- for (TypeDescriptor typeDescriptor : ((ComplexTypeDescriptor) descriptor).getAttributes()) {
- String name = typeDescriptor.getName();
- if (outputPorts.containsName(name)) {
- name = "1" + name;
- }
- addOutputPort(name, depthForDescriptor(typeDescriptor), activity, processor, binding);
- }
- } else if (descriptor instanceof ArrayTypeDescriptor) {
- addOutputPort(descriptor.getName(), 1, activity, processor, binding);
- }
- }
-
- private static int depthForDescriptor(TypeDescriptor desc) {
- if (desc instanceof ArrayTypeDescriptor
- && (!((ArrayTypeDescriptor) desc).isWrapped() || ((ArrayTypeDescriptor) desc)
- .getElementType() instanceof BaseTypeDescriptor)) {
- return 1;
- } else {
- return 0;
- }
- }
-
- private static void addOutputPort(String name, int depth, Activity activity,
- Processor processor, ProcessorBinding binding) {
- OutputActivityPort activityPort = new OutputActivityPort(activity, name);
- activityPort.setDepth(depth);
- activityPort.setGranularDepth(depth);
- OutputProcessorPort processorPort = new OutputProcessorPort(processor, name);
- processorPort.setDepth(depth);
- processorPort.setGranularDepth(depth);
- new ProcessorOutputPortBinding(binding, activityPort, processorPort);
- }
-
- private static void addInputPort(String name, int depth, Activity activity,
- Processor processor, ProcessorBinding binding) {
- InputActivityPort activityPort = new InputActivityPort(activity, name);
- activityPort.setDepth(depth);
- InputProcessorPort processorPort = new InputProcessorPort(processor, name);
- processorPort.setDepth(depth);
- new ProcessorInputPortBinding(binding, processorPort, activityPort);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
deleted file mode 100644
index a2935e6..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForWSDLActivityMenuAction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-
-public class AddXMLInputSplitterForWSDLActivityMenuAction extends AddXMLInputSplitterMenuAction {
-
- public AddXMLInputSplitterForWSDLActivityMenuAction() {
- super(WSDLServiceDescription.ACTIVITY_TYPE);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
deleted file mode 100644
index 070c006..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterForXMLInputSplitterMenuAction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-
-public class AddXMLInputSplitterForXMLInputSplitterMenuAction extends AddXMLInputSplitterMenuAction {
-
- public AddXMLInputSplitterForXMLInputSplitterMenuAction() {
- super(WSDLServiceDescription.INPUT_SPLITTER_TYPE);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
deleted file mode 100644
index 60ef904..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLInputSplitterMenuAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-
-import javax.swing.Action;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jdom.JDOMException;
-import org.xml.sax.SAXException;
-
-import net.sf.taverna.t2.activities.wsdl.InputPortTypeDescriptorActivity;
-import net.sf.taverna.t2.activities.wsdl.actions.AbstractAddXMLSplitterAction;
-import net.sf.taverna.t2.activities.wsdl.actions.AddXMLInputSplitterAction;
-import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
-import net.sf.taverna.t2.ui.menu.MenuComponent;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-
-/**
- * @author alanrw
- */
-public abstract class AddXMLInputSplitterMenuAction extends AbstractConfigureActivityMenuAction
- implements MenuComponent, ContextualMenuComponent {
-
- private static final String ADD_XML_INPUT_SPLITTER = "Add XML Input Splitter";
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddXMLInputSplitterMenuAction(URI activityType) {
- super(activityType);
- }
-
- @Override
- protected Action createAction() {
- AddXMLInputSplitterAction configAction = new AddXMLInputSplitterAction(findActivity(),
- null, editManager, selectionManager);
- Map<String, TypeDescriptor> descriptors;
- try {
- descriptors = configAction.getTypeDescriptors();
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- return null;
- }
- if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
- configAction.putValue(Action.NAME, ADD_XML_INPUT_SPLITTER);
- addMenuDots(configAction);
- return configAction;
- } else {
- return null;
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
deleted file mode 100644
index 58b3724..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForWSDLActivityMenuAction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-
-public class AddXMLOutputSplitterForWSDLActivityMenuAction extends AddXMLOutputSplitterMenuAction {
-
- public AddXMLOutputSplitterForWSDLActivityMenuAction() {
- super(WSDLServiceDescription.ACTIVITY_TYPE);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
deleted file mode 100644
index 129c996..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterForXMLOutputSplitterMenuAction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-
-public class AddXMLOutputSplitterForXMLOutputSplitterMenuAction extends AddXMLOutputSplitterMenuAction {
-
- public AddXMLOutputSplitterForXMLOutputSplitterMenuAction() {
- super(WSDLServiceDescription.OUTPUT_SPLITTER_TYPE);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
deleted file mode 100644
index 33541e6..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/AddXMLOutputSplitterMenuAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.wsdl.menu;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-
-import javax.swing.Action;
-import javax.wsdl.WSDLException;
-import javax.xml.parsers.ParserConfigurationException;
-
-import net.sf.taverna.t2.activities.wsdl.actions.AbstractAddXMLSplitterAction;
-import net.sf.taverna.t2.activities.wsdl.actions.AddXMLOutputSplitterAction;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.wsdl.parser.TypeDescriptor;
-import net.sf.taverna.wsdl.parser.UnknownOperationException;
-
-import org.jdom.JDOMException;
-import org.xml.sax.SAXException;
-
-/**
- * @author alanrw
- */
-public abstract class AddXMLOutputSplitterMenuAction extends AbstractConfigureActivityMenuAction {
-
- private static final String ADD_XML_OUTPUT_SPLITTER = "Add XML Output Splitter";
- private EditManager editManager;
- private SelectionManager selectionManager;
-
- public AddXMLOutputSplitterMenuAction(URI activityType) {
- super(activityType);
- }
-
- @Override
- protected Action createAction() {
- AddXMLOutputSplitterAction configAction = new AddXMLOutputSplitterAction(
- findActivity(), null, editManager, selectionManager);
- Map<String, TypeDescriptor> descriptors;
- try {
- descriptors = configAction.getTypeDescriptors();
- } catch (UnknownOperationException | IOException | ParserConfigurationException
- | WSDLException | SAXException | JDOMException e) {
- return null;
- }
- if (!AbstractAddXMLSplitterAction.filterDescriptors(descriptors).isEmpty()) {
- configAction.putValue(Action.NAME, ADD_XML_OUTPUT_SPLITTER);
- addMenuDots(configAction);
- return configAction;
- } else {
- return null;
- }
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/ConfigureWSDLMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/ConfigureWSDLMenuAction.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/ConfigureWSDLMenuAction.java
deleted file mode 100644
index 87e7d0f..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/menu/ConfigureWSDLMenuAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 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.wsdl.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.wsdl.actions.WSDLActivityConfigureAction;
-import net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceDescription;
-import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
-import net.sf.taverna.t2.ui.menu.MenuComponent;
-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 ConfigureWSDLMenuAction extends AbstractConfigureActivityMenuAction implements
- MenuComponent, ContextualMenuComponent {
-
- private EditManager editManager;
- private ActivityIconManager activityIconManager;
- private ServiceDescriptionRegistry serviceDescriptionRegistry;
- private CredentialManager credentialManager;
- private FileManager fileManager;
-
- public ConfigureWSDLMenuAction() {
- super(WSDLServiceDescription.ACTIVITY_TYPE);
- }
-
- @Override
- protected Action createAction() {
- WSDLActivityConfigureAction configAction = new WSDLActivityConfigureAction(findActivity(),
- getParentFrame(), editManager, fileManager, activityIconManager,
- serviceDescriptionRegistry, credentialManager);
- addMenuDots(configAction);
- return configAction;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setActivityIconManager(ActivityIconManager activityIconManager) {
- this.activityIconManager = activityIconManager;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
- this.serviceDescriptionRegistry = serviceDescriptionRegistry;
- }
-
- public void setCredentialManager(CredentialManager credentialManager) {
- this.credentialManager = credentialManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
deleted file mode 100644
index b2b31ae..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/AddWSDLServiceDialog.java
+++ /dev/null
@@ -1,303 +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.wsdl.servicedescriptions;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-/**
- * Dialog that lets user specify a URL of a WSDL service they want
- * to add to the Service Panel. In the case the WSDL URL is behind
- * HTTPS or service's endpoints require HTTPS it will ask user to confirm
- * if they want to trust it.
- *
- * @author Alex Nenadic
- *
- */
-@SuppressWarnings("serial")
-public abstract class AddWSDLServiceDialog extends HelpEnabledDialog {
-
- private JTextField wsdlLocationField;
- private Logger logger = Logger.getLogger(AddWSDLServiceDialog.class);
-
- public AddWSDLServiceDialog() {
- super(MainWindow.getMainWindow(), "Add WSDL service", true, null); // create a non-modal dialog
- initComponents();
- setLocationRelativeTo(getParent());
- }
-
- private void initComponents() {
- JPanel mainPanel = new JPanel(new GridBagLayout());
- mainPanel.setBorder(new EmptyBorder(10,10,10,10));
-
- JLabel wsdlLocatitionLabel = new JLabel("WSDL location",WSDLActivityIcon.getWSDLIcon(), JLabel.LEFT);
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.weighty = 0.0;
-
- gbc.weightx = 0.0;
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.NONE;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 0);
- mainPanel.add(wsdlLocatitionLabel, gbc);
-
- wsdlLocationField = new JTextField("http://somehost/service?wsdl");
- gbc.weightx = 1.0;
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.insets = new Insets(5, 10, 0, 5);
- mainPanel.add(wsdlLocationField, gbc);
-
- final JButton addServiceButton = new JButton("Add");
- addServiceButton.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent evt)
- {
- addPressed();
- }
- });
-
- // When user presses "Return" key fire the action on the "Add" button
- addServiceButton.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent evt) {
- if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
- addPressed();
- }
- }
- });
- getRootPane().setDefaultButton(addServiceButton);
-
- JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- buttonsPanel.add(addServiceButton);
-
- getContentPane().setLayout(new BorderLayout());
- getContentPane().add(mainPanel, BorderLayout.CENTER);
- getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
-
- setSize(getPreferredSize());
- pack();
- }
-
- /**
- * 'Add service' button pressed or otherwise activated.
- */
- private void addPressed()
- {
- final String wsdlURLString = wsdlLocationField.getText().trim();
- new Thread("Adding WSDL " + wsdlURLString) {
- public void run() {
- // Only add the service provider for this service if service URL
- // starts with 'http'
- // or if it starts with 'https' and user explicitly said they
- // wanted to trust this service.
- /*
- * if (shouldTrust(wsdlURLString)){ addRegistry(wsdlURLString);
- * }
- */
- try {
- URL url = new URL(wsdlURLString);
- URLConnection connection = url.openConnection();
- try {
- // If the url starts with 'https' - security hook for
- // https connection's trust manager
- // will be engaged and user will be asked automatically
- // if they want
- // to trust the connection (if it is not already
- // trusted). If the urls starts with 'http' -
- // this will not have any effect apart from checking if
- // we can open a connection.
- connection.connect(); // if this does not fail - add the
- // WSDL
- // service provider for this service to
- // the registry
- } finally {
- try {
- connection.getInputStream().close();
- } catch (IOException ex) {
- }
- }
- addRegistry(wsdlURLString);
- } catch (Exception ex) { // anything failed
- JOptionPane.showMessageDialog(null,
- "Could not read the WSDL definition from "
- + wsdlURLString + ":\n" + ex,
- "Could not add WSDL service",
- JOptionPane.ERROR_MESSAGE);
-
- logger.error(
- "Failed to add WSDL service provider for service: "
- + wsdlURLString, ex);
-
- }
- };
- }.start();
- closeDialog();
- }
-
- /**
- * If WSDL service's URL starts with 'https' - asks user
- * whether to trust it or not. If it starts with 'http' -
- * does not ask anything as the service is implicitly trusted (weird but true).
- */
- protected abstract void addRegistry(String wsdl);
-
- /**
- * Checks if a service is trusted and if not - asks user if they want to trust it.
- */
-// public boolean shouldTrust(String wsdlURLString){
-// try {
-// URI wsdlURI = new URI(wsdlURLString);
-// URL wsdlURL = wsdlURI.toURL();
-// String protocol = wsdlURL.getProtocol();
-// if (protocol.toLowerCase().startsWith("https")){
-// logger.info("Checking if service " + wsdlURLString + " is already trusted.");
-// // Check if opening an HTTPS connection will cause a SSLHandshakeException.
-// // This is most probably due to the fact that we do not have this service's
-// // certificate in Credential Manager's truststore
-// try {
-// HttpsURLConnection httpsConnection;
-// httpsConnection = (HttpsURLConnection) wsdlURL.openConnection();
-// httpsConnection.connect();
-// logger.info("HTTPS works out of the box for service " + wsdlURLString);
-// return true; // Opening HTTPS connection worked - so we trust this service already
-// }
-// catch (SSLException sslex) { // most probably due to the fact that service is not trusted, i.e. its certificate is not in Credential Manager's Truststore
-// logger.info("Service " + wsdlURLString + " is not trusted out of the box. Trying to fetch its certificate.");
-// logger.info("The SSLException was caused by: " + sslex.getCause());
-// // Handshake most probably failed as we do not already trust this service -
-// // fetch its certificate and ask user if they want to add this service as trusted
-// try {
-//
-// // This controls SSL socket creation for HTTPS connections
-// // per thread so the damage of switching off certificates
-// // verification is limited
-// ThreadLocalSSLSocketFactory.install();
-// // switch certificate checking off for a moment so we can fetch
-// // service's certificate
-// ThreadLocalSSLSocketFactory.startTrustingEverything();
-//
-// HttpsURLConnection httpsConnection;
-// httpsConnection = (HttpsURLConnection) wsdlURL
-// .openConnection();
-// httpsConnection.connect();
-// // Stop being overly trusting
-// ThreadLocalSSLSocketFactory.stopTrustingEverything();
-// Certificate[] certificates = httpsConnection
-// .getServerCertificates();
-// logger.info("Need to ask user if they want to trust service " + wsdlURLString);
-// // Ask user if they want to trust this service
-// ConfirmTrustedCertificateDialog confirmCertTrustDialog = new ConfirmTrustedCertificateDialog(
-// this, "Untrusted HTTPS connection", true,
-// (X509Certificate) certificates[0]);
-// confirmCertTrustDialog.setLocationRelativeTo(null);
-// confirmCertTrustDialog.setVisible(true);
-// boolean shouldTrust = confirmCertTrustDialog
-// .shouldTrust();
-// if (shouldTrust) {
-// try {
-// CredentialManager credManager = CredentialManager
-// .getInstance();
-// credManager
-// .saveTrustedCertificate((X509Certificate) certificates[0]);
-// return true;
-// } catch (CMException cme) {
-// logger
-// .error(
-// "Failed to add WSDL service provider for service: "
-// + wsdlURLString
-// + " . Credential Manager failed to "
-// + "save trusted certificate.",
-// cme);
-// return false;
-// }
-// } else {
-// // Do not even add a WSDL service provider for this
-// // service and tell user the service will not be
-// // added to Service Panel
-// JOptionPane
-// .showMessageDialog(
-// this,
-// "As you refused to trust it, the service will not be added to Service Panel.",
-// "Add WSDL service",
-// JOptionPane.INFORMATION_MESSAGE);
-// return false;
-// }
-// } catch (Exception e1) {
-// logger
-// .error(
-// "Failed to add WSDL service provider for service: "
-// + wsdlURLString
-// + ". 'Trust everyone' HTTPS connection failed.",
-// e1);
-// return false;
-// } finally {// switch it off here as well if some unexpected exception occurred
-// ThreadLocalSSLSocketFactory.stopTrustingEverything();
-// }
-//
-// } catch (Exception e2) {
-// logger.error("Failed to add WSDL service provider for service: "+ wsdlURLString+". Connecting to service failed.", e2);
-// return false;
-// }
-// }
-// else{ // protocol starts with 'http'
-// return true;
-// }
-// } catch (MalformedURLException e3) {
-// logger.error("Failed to add WSDL service provider: URL "+ wsdlURLString+" was malformed.", e3);
-// return false;
-// } catch (URISyntaxException e4) {
-// logger.error("Failed to add WSDL service provider: URI "+ wsdlURLString+" could not be parsed.", e4);
-// return false;
-// }
-// }
-
- /**
- * Closes the dialog.
- */
- private void closeDialog() {
- setVisible(false);
- dispose();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
deleted file mode 100644
index bc58aad..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
+++ /dev/null
@@ -1,586 +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.wsdl.servicedescriptions;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dialog;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.math.BigInteger;
-import java.util.HashMap;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-import javax.swing.JSeparator;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-import javax.security.auth.x500.X500Principal;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import net.sf.taverna.t2.security.credentialmanager.CMException;
-import net.sf.taverna.t2.security.credentialmanager.CMUtils;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.misc.NetscapeCertType;
-
-/**
- * Displays the details of a X.509 certificate and asks user if they want to
- * trust it.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class ConfirmTrustedCertificateDialog extends HelpEnabledDialog {
-
- private static Logger logger = Logger.getLogger(ConfirmTrustedCertificateDialog.class);
-
- // Stores certificate to display
- private X509Certificate cert;
-
- // Stores user's decision as whether to trust this service's certificaet or not.
- private boolean shouldTrust;
-
- /**
- * Creates new ConfirmTrustedCertificateDialog where parent is a Frame.
- */
- public ConfirmTrustedCertificateDialog(Frame parent, String title,
- boolean modal, X509Certificate crt)
- throws CMException {
- super(parent, title, modal, null);
- this.cert = crt;
- initComponents();
- }
-
- /**
- * Creates new ConfirmTrustedCertificateDialog where parent is a Dialog.
- */
- public ConfirmTrustedCertificateDialog(Dialog parent, String title,
- boolean modal, X509Certificate crt)
- throws CMException {
- super(parent, title, modal, null);
- this.cert = crt;
- initComponents();
- }
-
- /**
- * Initialise the dialog's GUI components.
- */
- private void initComponents(){
-
- // title panel
- JPanel titlePanel = new JPanel(new BorderLayout());
- titlePanel.setBackground(Color.WHITE);
- JLabel titleLabel = new JLabel("View service's certificate");
- titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f));
- titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
- DialogTextArea titleMessage = new DialogTextArea("This service requires HTTPS connection and has identified itself with the certificate below.\n" +
- "Do you want to trust this service? (Refusing to trust means you will not be able to invoke it from a workflow.)");
- titleMessage.setMargin(new Insets(5, 20, 10, 10));
- titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
- titleMessage.setEditable(false);
- titleMessage.setFocusable(false);
- titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10));
- titlePanel.add(titleLabel, BorderLayout.NORTH);
- titlePanel.add(titleMessage, BorderLayout.CENTER);
-
- // Certificate details:
-
- // Grid Bag Constraints templates for labels (column 1) and
- // values (column 2) of certificate details
- GridBagConstraints gbcLabel = new GridBagConstraints();
- gbcLabel.gridx = 0;
- gbcLabel.ipadx = 20;
- gbcLabel.gridwidth = 1;
- gbcLabel.gridheight = 1;
- gbcLabel.insets = new Insets(2, 15, 2, 2);
- gbcLabel.anchor = GridBagConstraints.LINE_START;
-
- GridBagConstraints gbcValue = new GridBagConstraints();
- gbcValue.gridx = 1;
- gbcValue.gridwidth = 1;
- gbcValue.gridheight = 1;
- gbcValue.insets = new Insets(2, 5, 2, 2);
- gbcValue.anchor = GridBagConstraints.LINE_START;
-
- // Netscape Certificate Type non-critical extension (if any)
- // defines the intended uses of the certificate - to make it look like
- // firefox's view certificate dialog
- byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); // Netscape Certificate Type OID
- JLabel jlIntendedUses = null;
- JTextField jtfIntendedUsesValue = null;
- JPanel jpUses = null;
- GridBagConstraints gbc_jpUses = null;
- if (intendedUses != null) {
- jlIntendedUses = new JLabel(
- "This certificate has been approved for the following uses:");
- jlIntendedUses.setFont(new Font(null, Font.BOLD, 11));
- jlIntendedUses.setBorder(new EmptyBorder(5, 5, 5, 5));
-
- jtfIntendedUsesValue = new JTextField(45);
- jtfIntendedUsesValue.setText(getIntendedUses(intendedUses));
- jtfIntendedUsesValue.setEditable(false);
- jtfIntendedUsesValue.setFont(new Font(null, Font.PLAIN, 11));
-
- jpUses = new JPanel(new BorderLayout());
- jpUses.add(jlIntendedUses, BorderLayout.NORTH);
- jpUses.add(jtfIntendedUsesValue, BorderLayout.CENTER);
- JSeparator jsp = new JSeparator(JSeparator.HORIZONTAL);
- jpUses.add(jsp, BorderLayout.SOUTH);
-
- gbc_jpUses = (GridBagConstraints) gbcLabel.clone();
- gbc_jpUses.gridy = 0;
- gbc_jpUses.gridwidth = 2; // takes two columns
- gbc_jpUses.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
- }
-
- // Issued To
- JLabel jlIssuedTo = new JLabel("Issued To");
- jlIssuedTo.setFont(new Font(null, Font.BOLD, 11));
- GridBagConstraints gbc_jlIssuedTo = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlIssuedTo.gridy = 1;
- gbc_jlIssuedTo.gridwidth = 2; // takes two columns
- gbc_jlIssuedTo.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
- // Distinguished Name (DN)
- String sDN = cert.getSubjectX500Principal().getName(
- X500Principal.RFC2253);
- CMUtils util = new CMUtils();
- util.parseDN(sDN);
- // Extract the CN, O, OU and EMAILADDRESS fields
- String sCN = util.getCN();
- String sOrg = util.getO();
- String sOU = util.getOU();
- // String sEMAILADDRESS = CMX509Util.getEmilAddress();
- // Common Name (CN)
- JLabel jlCN = new JLabel("Common Name (CN)");
- jlCN.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlCN = (GridBagConstraints) gbcLabel.clone();
- gbc_jlCN.gridy = 2;
- JLabel jlCNValue = new JLabel(sCN);
- jlCNValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlCNValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlCNValue.gridy = 2;
- // Organisation (O)
- JLabel jlOrg = new JLabel("Organisation (O)");
- jlOrg.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlOrg = (GridBagConstraints) gbcLabel.clone();
- gbc_jlOrg.gridy = 3;
- JLabel jlOrgValue = new JLabel(sOrg);
- jlOrgValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlOrgValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlOrgValue.gridy = 3;
- // Organisation Unit (OU)
- JLabel jlOU = new JLabel("Organisation Unit (OU)");
- jlOU.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlOU = (GridBagConstraints) gbcLabel.clone();
- gbc_jlOU.gridy = 4;
- JLabel jlOUValue = new JLabel(sOU);
- jlOUValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlOUValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlOUValue.gridy = 4;
- // E-mail Address
- // JLabel jlEmail = new JLabel("E-mail Address");
- // jlEmail.setFont(new Font(null, Font.PLAIN, 11));
- // GridBagConstraints gbc_jlEmail = (GridBagConstraints)
- // gbcLabel.clone();
- // gbc_jlEmail.gridy = 5;
- // JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
- // jlEmailValue.setFont(new Font(null, Font.PLAIN, 11));
- // GridBagConstraints gbc_jlEmailValue = (GridBagConstraints)
- // gbcValue.clone();
- // gbc_jlEmailValue.gridy = 5;
- // Serial Number
- JLabel jlSN = new JLabel("Serial Number");
- jlSN.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlSN = (GridBagConstraints) gbcLabel.clone();
- gbc_jlSN.gridy = 6;
- JLabel jlSNValue = new JLabel();
- // Get the hexadecimal serial number
- StringBuffer strBuff = new StringBuffer(new BigInteger(1, cert
- .getSerialNumber().toByteArray()).toString(16).toUpperCase());
- // Place colons at every two hexadecimal characters
- if (strBuff.length() > 2) {
- for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3) {
- strBuff.insert(iCnt, ':');
- }
- }
- jlSNValue.setText(strBuff.toString());
- jlSNValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlSNValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlSNValue.gridy = 6;
- // Version
- JLabel jlVersion = new JLabel("Version");
- jlVersion.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlVersion.gridy = 7;
- JLabel jlVersionValue = new JLabel(Integer.toString(cert.getVersion()));
- jlVersionValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlVersionValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlVersionValue.gridy = 7;
-
- // Issued By
- JLabel jlIssuedBy = new JLabel("Issued By");
- jlIssuedBy.setFont(new Font(null, Font.BOLD, 11));
- GridBagConstraints gbc_jlIssuedBy = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlIssuedBy.gridy = 8;
- gbc_jlIssuedBy.gridwidth = 2; // takes two columns
- gbc_jlIssuedBy.insets = new Insets(5, 5, 5, 5);// has slightly bigger
- // insets
- // Distinguished Name (DN)
- String iDN = cert.getIssuerX500Principal().getName(
- X500Principal.RFC2253);
- util.parseDN(iDN);
- // Extract the CN, O and OU fields
- String iCN = util.getCN();
- String iOrg = util.getO();
- String iOU = util.getOU();
- // Common Name (CN)
- JLabel jlICN = new JLabel("Common Name (CN)");
- jlICN.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlICN = (GridBagConstraints) gbcLabel.clone();
- gbc_jlICN.gridy = 9;
- JLabel jlICNValue = new JLabel(iCN);
- jlICNValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlICNValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlICNValue.gridy = 9;
- // Organisation (O)
- JLabel jlIOrg = new JLabel("Organisation (O)");
- jlIOrg.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIOrg = (GridBagConstraints) gbcLabel.clone();
- gbc_jlIOrg.gridy = 10;
- JLabel jlIOrgValue = new JLabel(iOrg);
- jlIOrgValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIOrgValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlIOrgValue.gridy = 10;
- // Organisation Unit (OU)
- JLabel jlIOU = new JLabel("Organisation Unit (OU)");
- jlIOU.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIOU = (GridBagConstraints) gbcLabel.clone();
- gbc_jlIOU.gridy = 11;
- JLabel jlIOUValue = new JLabel(iOU);
- jlIOUValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIOUValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlIOUValue.gridy = 11;
- // Validity
- JLabel jlValidity = new JLabel("Validity");
- jlValidity.setFont(new Font(null, Font.BOLD, 11));
- GridBagConstraints gbc_jlValidity = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlValidity.gridy = 12;
- gbc_jlValidity.gridwidth = 2; // takes two columns
- gbc_jlValidity.insets = new Insets(5, 5, 5, 5);// has slightly bigger
- // insets
- // Issued On
- JLabel jlIssuedOn = new JLabel("Issued On");
- jlIssuedOn.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIssuedOn = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlIssuedOn.gridy = 13;
- JLabel jlIssuedOnValue = new JLabel(cert.getNotBefore().toString());
- jlIssuedOnValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlIssuedOnValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlIssuedOnValue.gridy = 13;
- // Expires On
- JLabel jlExpiresOn = new JLabel("Expires On");
- jlExpiresOn.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlExpiresOn = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlExpiresOn.gridy = 14;
- JLabel jlExpiresOnValue = new JLabel(cert.getNotAfter().toString());
- jlExpiresOnValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlExpiresOnValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlExpiresOnValue.gridy = 14;
-
- // Fingerprints
- byte[] bCert = new byte[0];
- try {
- bCert = cert.getEncoded();
- } catch (CertificateEncodingException ex) {
- logger.error("Could not get the encoded form of the certificate.", ex);
- }
- JLabel jlFingerprints = new JLabel("Fingerprints");
- jlFingerprints.setFont(new Font(null, Font.BOLD, 11));
- GridBagConstraints gbc_jlFingerprints = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlFingerprints.gridy = 15;
- gbc_jlFingerprints.gridwidth = 2; // takes two columns
- gbc_jlFingerprints.insets = new Insets(5, 5, 5, 5);// has slightly
- // bigger insets
- // SHA-1 Fingerprint
- JLabel jlSHA1Fingerprint = new JLabel("SHA1 Fingerprint");
- jlSHA1Fingerprint.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlSHA1Fingerprint = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlSHA1Fingerprint.gridy = 16;
- JLabel jlSHA1FingerprintValue = new JLabel(getMessageDigest(bCert,
- "SHA1"));
- jlSHA1FingerprintValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlSHA1FingerprintValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlSHA1FingerprintValue.gridy = 16;
- // MD5 Fingerprint
- JLabel jlMD5Fingerprint = new JLabel("MD5 Fingerprint");
- jlMD5Fingerprint.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlMD5Fingerprint = (GridBagConstraints) gbcLabel
- .clone();
- gbc_jlMD5Fingerprint.gridy = 17;
- JLabel jlMD5FingerprintValue = new JLabel(
- getMessageDigest(bCert, "MD5"));
- jlMD5FingerprintValue.setFont(new Font(null, Font.PLAIN, 11));
- GridBagConstraints gbc_jlMD5FingerprintValue = (GridBagConstraints) gbcValue
- .clone();
- gbc_jlMD5FingerprintValue.gridy = 17;
-
- // Empty label to add a bit space at the bottom of the panel
- // to make it look like firefox's view certificate dialog
- JLabel jlEmpty = new JLabel("");
- GridBagConstraints gbc_jlEmpty = (GridBagConstraints) gbcLabel.clone();
- gbc_jlEmpty.gridy = 18;
- gbc_jlEmpty.gridwidth = 2; // takes two columns
- gbc_jlEmpty.ipady = 40;
-
- JPanel jpCertificate = new JPanel(new GridBagLayout());
- jpCertificate.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
- 15), new EtchedBorder()));
-
- if (intendedUses != null) {
- jpCertificate.add(jpUses, gbc_jpUses);
- }
- jpCertificate.add(jlIssuedTo, gbc_jlIssuedTo); // Issued To
- jpCertificate.add(jlCN, gbc_jlCN);
- jpCertificate.add(jlCNValue, gbc_jlCNValue);
- jpCertificate.add(jlOrg, gbc_jlOrg);
- jpCertificate.add(jlOrgValue, gbc_jlOrgValue);
- jpCertificate.add(jlOU, gbc_jlOU);
- jpCertificate.add(jlOUValue, gbc_jlOUValue);
- // jpCertificate.add(jlEmail, gbc_jlEmail);
- // jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
- jpCertificate.add(jlSN, gbc_jlSN);
- jpCertificate.add(jlSNValue, gbc_jlSNValue);
- jpCertificate.add(jlVersion, gbc_jlVersion);
- jpCertificate.add(jlVersionValue, gbc_jlVersionValue);
- jpCertificate.add(jlIssuedBy, gbc_jlIssuedBy); // Issued By
- jpCertificate.add(jlICN, gbc_jlICN);
- jpCertificate.add(jlICNValue, gbc_jlICNValue);
- jpCertificate.add(jlIOrg, gbc_jlIOrg);
- jpCertificate.add(jlIOrgValue, gbc_jlIOrgValue);
- jpCertificate.add(jlIOU, gbc_jlIOU);
- jpCertificate.add(jlIOUValue, gbc_jlIOUValue);
- jpCertificate.add(jlValidity, gbc_jlValidity); // Validity
- jpCertificate.add(jlIssuedOn, gbc_jlIssuedOn);
- jpCertificate.add(jlIssuedOnValue, gbc_jlIssuedOnValue);
- jpCertificate.add(jlExpiresOn, gbc_jlExpiresOn);
- jpCertificate.add(jlExpiresOnValue, gbc_jlExpiresOnValue);
- jpCertificate.add(jlFingerprints, gbc_jlFingerprints); // Fingerprints
- jpCertificate.add(jlSHA1Fingerprint, gbc_jlSHA1Fingerprint);
- jpCertificate.add(jlSHA1FingerprintValue, gbc_jlSHA1FingerprintValue);
- jpCertificate.add(jlMD5Fingerprint, gbc_jlMD5Fingerprint);
- jpCertificate.add(jlMD5FingerprintValue, gbc_jlMD5FingerprintValue);
- jpCertificate.add(jlEmpty, gbc_jlEmpty); // Empty label to get some vertical space on the frame
-
- // OK button
- JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
-
- final JButton jbTrust = new JButton("Trust");
- jbTrust.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- trustPressed();
- }
- });
- final JButton jbDontTrust = new JButton("Do not trust");
- jbDontTrust.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- dontTrustPressed();
- }
- });
-
- jpButtons.add(jbTrust);
- jpButtons.add(jbDontTrust);
-
- // Put it all together
- getContentPane().add(titlePanel, BorderLayout.NORTH);
- getContentPane().add(jpCertificate, BorderLayout.CENTER);
- getContentPane().add(jpButtons, BorderLayout.SOUTH);
-
- // Resizing wreaks havoc
- setResizable(false);
-
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent evt) {
- closeDialog();
- }
- });
-
- getRootPane().setDefaultButton(jbTrust);
-
- pack();
- }
-
- /**
- * Get the digest of a message as a formatted String.
- *
- * @param bMessage
- * The message to digest
- * @param digestType
- * The message digest algorithm
- * @return The message digest
- */
- public static String getMessageDigest(byte[] bMessage, String digestType) {
- // Create message digest object using the supplied algorithm
- MessageDigest messageDigest;
- try {
- messageDigest = MessageDigest.getInstance(digestType);
- } catch (NoSuchAlgorithmException ex) {
- logger.error("Failed to create message digest.", ex);
- return "";
- }
-
- // Create raw message digest
- byte[] bFingerPrint = messageDigest.digest(bMessage);
-
- // Place the raw message digest into a StringBuffer as a Hex number
- StringBuffer strBuff = new StringBuffer(new BigInteger(1, bFingerPrint)
- .toString(16).toUpperCase());
-
- // Odd number of characters so add in a padding "0"
- if ((strBuff.length() % 2) != 0) {
- strBuff.insert(0, '0');
- }
-
- // Place colons at every two hex characters
- if (strBuff.length() > 2) {
- for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3) {
- strBuff.insert(iCnt, ':');
- }
- }
-
- // Return the formatted message digest
- return strBuff.toString();
- }
-
- /**
- * Gets the intended certificate uses, i.e. Netscape Certificate Type
- * extension (2.16.840.1.113730.1.1) value as a string
- *
- * @param value
- * Extension value as a DER-encoded OCTET string
- * @return Extension value as a string
- */
- private String getIntendedUses(byte[] value) {
-
- // Netscape Certificate Types (2.16.840.1.113730.1.1)
- int[] INTENDED_USES = new int[] { NetscapeCertType.sslClient,
- NetscapeCertType.sslServer, NetscapeCertType.smime,
- NetscapeCertType.objectSigning, NetscapeCertType.reserved,
- NetscapeCertType.sslCA, NetscapeCertType.smimeCA,
- NetscapeCertType.objectSigningCA, };
-
- // Netscape Certificate Type strings (2.16.840.1.113730.1.1)
- HashMap<String, String> INTENDED_USES_STRINGS = new HashMap<String, String>();
- INTENDED_USES_STRINGS.put("128", "SSL Client");
- INTENDED_USES_STRINGS.put("64", "SSL Server");
- INTENDED_USES_STRINGS.put("32", "S/MIME");
- INTENDED_USES_STRINGS.put("16", "Object Signing");
- INTENDED_USES_STRINGS.put("8", "Reserved");
- INTENDED_USES_STRINGS.put("4", "SSL CA");
- INTENDED_USES_STRINGS.put("2", "S/MIME CA");
- INTENDED_USES_STRINGS.put("1", "Object Signing CA");
-
- // Get octet string from extension value
- ASN1OctetString fromByteArray = new DEROctetString(value);
- byte[] octets = fromByteArray.getOctets();
- DERBitString fromByteArray2 = new DERBitString(octets);
- int val = new NetscapeCertType(fromByteArray2).intValue();
- StringBuffer strBuff = new StringBuffer();
- for (int i = 0, len = INTENDED_USES.length; i < len; i++) {
- int use = INTENDED_USES[i];
- if ((val & use) == use) {
- strBuff.append(INTENDED_USES_STRINGS.get(String.valueOf(use))
- + ", \n");
- }
- }
- // remove the last ", \n" from the end of the buffer
- String str = strBuff.toString();
- str = str.substring(0, str.length() - 3);
- return str;
- }
-
- /**
- * 'Trust' button pressed.
- */
- private void trustPressed() {
- shouldTrust = true;
- closeDialog();
- }
-
- /**
- * 'Do not trust' button pressed.
- */
- private void dontTrustPressed() {
- shouldTrust = false;
- closeDialog();
- }
-
- /**
- * Closes the dialog.
- */
- public void closeDialog() {
- setVisible(false);
- dispose();
- }
-
- public boolean shouldTrust() {
- return shouldTrust;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLActivityIcon.java b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
deleted file mode 100644
index 79f8ccd..0000000
--- a/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
+++ /dev/null
@@ -1,60 +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.wsdl.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- * @author alanrw
- *
- */
-public class WSDLActivityIcon implements ActivityIconSPI {
-
- private static Icon icon;
-
- public int canProvideIconScore(URI activityType) {
- if (activityType.equals(WSDLServiceDescription.ACTIVITY_TYPE))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
-
- public Icon getIcon(URI activityType) {
- return getWSDLIcon();
- }
-
- public static Icon getWSDLIcon() {
- if (icon == null) {
- icon = new ImageIcon(WSDLActivityIcon.class.getResource("/wsdl.png"));
- }
- return icon;
- }
-}
-
-
-