Merge branch 'README'
diff --git a/pom.xml b/pom.xml
index 2f11b49..9da001f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,13 +1,15 @@
<?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">
+<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>net.sf.taverna.t2</groupId>
<artifactId>ui-activities</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>2.0-SNAPSHOT</version>
</parent>
<groupId>net.sf.taverna.t2.ui-activities</groupId>
<artifactId>rest-activity-ui</artifactId>
+ <packaging>bundle</packaging>
<name>REST Activity - UI bindings</name>
<dependencies>
@@ -32,33 +34,40 @@
<version>${t2.ui.api.version}</version>
</dependency>
<dependency>
- <groupId>net.sf.taverna.t2.ui-api</groupId>
- <artifactId>workbench-api</artifactId>
- <version>${t2.ui.api.version}</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.ui-impl</groupId>
- <artifactId>activity-tools</artifactId>
- <version>${t2.ui.impl.version}</version>
- </dependency>
- <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>workbench-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>report-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
<groupId>net.sf.taverna.t2.ui-components</groupId>
<artifactId>workflow-view</artifactId>
<version>${t2.ui.components.version}</version>
</dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.ui-components</groupId>
- <artifactId>graph-view</artifactId>
- <version>${t2.ui.components.version}</version>
- </dependency>
-
-
- <!-- for ColourManager -->
- <dependency>
- <groupId>net.sf.taverna.t2.ui-impl</groupId>
- <artifactId>configuration-impl</artifactId>
- <version>${t2.ui.impl.version}</version>
- </dependency>
- </dependencies>
+ </dependencies>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository
+ </url>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>mygrid-snapshot-repository</id>
+ <name>myGrid Snapshot Repository</name>
+ <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+ </repository>
+ </repositories>
</project>
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
index e3d688b..d6b46e1 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java
@@ -14,12 +14,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
-import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -29,7 +26,6 @@
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
@@ -41,24 +37,23 @@
import net.sf.taverna.t2.activities.rest.URISignatureHandler;
import net.sf.taverna.t2.activities.rest.URISignatureHandler.URISignatureParsingException;
import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.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
- ActivityConfigurationPanel<RESTActivity, RESTActivityConfigurationBean> {
+public class RESTActivityConfigurationPanel extends MultiPageActivityConfigurationPanel {
private static final Icon infoIcon = new ImageIcon(
RESTActivityConfigurationPanel.class.getResource("information.png"));
- private RESTActivity activity;
- private RESTActivityConfigurationBean configBean;
-
- //private RESTActivityConfigurationPanel thisPanel;
-
// GENERAL tab
- private JComboBox cbHTTPMethod; // HTTP method of this REST activity
+ private JComboBox<HTTP_METHOD> cbHTTPMethod; // HTTP method of this REST activity
private JTextField tfURLSignature; // URL signature that determines its
// input ports
- private JComboBox cbAccepts; // for Accepts header
+ private JComboBox<String> cbAccepts; // for Accepts header
private JLabel jlContentTypeExplanation;
private JLabel jlContentTypeExplanationPlaceholder;
private JLabel jlContentType;
@@ -68,16 +63,18 @@
// when the latter is not
// shown
private JLabel jlContentTypeFieldPlaceholder;
- private JComboBox cbContentType; // for MIME type of data sent to the server
+ private JComboBox<String> cbContentType; // for MIME type of data sent to the server
// by POST / PUT methods
private JLabel jlSendDataAs;
- private JComboBox cbSendDataAs;
+ 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;
@@ -86,37 +83,145 @@
private String[] mediaTypes;
- public RESTActivityConfigurationPanel(RESTActivity activity) {
- //this.thisPanel = this;
- this.activity = activity;
- initGui();
+ private final ServiceRegistry serviceRegistry;
+
+ public RESTActivityConfigurationPanel(Activity activity, ServiceRegistry serviceRegistry) {
+ super(activity);
+ this.serviceRegistry = serviceRegistry;
+ initialise();
}
- protected void initGui() {
- removeAll();
- setLayout(new BorderLayout());
-
- // create view title
-// ShadedLabel slConfigurationLabel = new ShadedLabel(
-// "Configuration options for this REST service",
-// ShadedLabel.ORANGE);
-// JPanel jpConfigurationLabel = new JPanel(new GridLayout(1, 1));
-// jpConfigurationLabel.add(slConfigurationLabel);
-// jpConfigurationLabel.setBorder(BorderFactory.createEmptyBorder(8, 10,
-// 0, 10));
-// add(jpConfigurationLabel, BorderLayout.NORTH);
-
- // create tabbed view
- JTabbedPane tpTabs = new JTabbedPane();
- tpTabs.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
- tpTabs.add("General", createGeneralTab());
- tpTabs.add("Advanced", createAdvancedTab());
- add(tpTabs, BorderLayout.CENTER);
-
- // Populate fields from activity configuration bean
+ @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();
@@ -149,7 +254,7 @@
c.insets = new Insets(7, 3, 3, 7);
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
- cbHTTPMethod = new JComboBox(RESTActivity.HTTP_METHOD.values());
+ cbHTTPMethod = new JComboBox<>(HTTP_METHOD.values());
cbHTTPMethod.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean contentTypeSelEnabled = RESTActivity
@@ -237,7 +342,7 @@
c.insets = new Insets(3, 3, 3, 7);
c.weightx = 1.0;
c.fill = GridBagConstraints.HORIZONTAL;
- cbAccepts = new JComboBox(getMediaTypes());
+ cbAccepts = new JComboBox<>(getMediaTypes());
cbAccepts.setEditable(true);
cbAccepts.getEditor().getEditorComponent().addFocusListener(
new FocusListener() {
@@ -277,7 +382,7 @@
c.insets = new Insets(3, 3, 3, 7);
c.weightx = 1.0;
c.fill = GridBagConstraints.HORIZONTAL;
- cbContentType = new JComboBox(getMediaTypes());
+ cbContentType = new JComboBox<>(getMediaTypes());
cbContentType.setEditable(true);
cbContentType.getEditor().getEditorComponent().addFocusListener(
new FocusListener() {
@@ -349,7 +454,7 @@
c.insets = new Insets(3, 3, 8, 7);
c.weightx = 1.0;
c.fill = GridBagConstraints.HORIZONTAL;
- cbSendDataAs = new JComboBox(RESTActivity.DATA_FORMAT.values());
+ cbSendDataAs = new JComboBox<>(DATA_FORMAT.values());
cbSendDataAs.setEditable(false);
jpGeneral.add(cbSendDataAs, c);
@@ -371,7 +476,7 @@
jlSendDataAsFieldPlaceholder.setPreferredSize(cbSendDataAs
.getPreferredSize());
jpGeneral.add(jlSendDataAsFieldPlaceholder, c);
-
+
JPanel finalPanel = new JPanel(new BorderLayout());
finalPanel.add(jpGeneral, BorderLayout.NORTH);
return (finalPanel);
@@ -444,7 +549,41 @@
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;
@@ -460,7 +599,7 @@
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;
@@ -471,7 +610,7 @@
jlHTTPHeadersInfoIcon
.setToolTipText("<html>Set additional HTTP headers</html>");
jpAdvanced.add(jlHTTPHeadersInfoIcon, c);
-
+
c.gridx = 1;
c.weightx = 0;
c.weighty = 0;
@@ -497,7 +636,7 @@
buttonPanel.add(addHeaderButton, FlowLayout.LEFT);
buttonPanel.add(removeHeaderButton);
jpAdvanced.add(buttonPanel, c);
-
+
c.gridx = 1;
c.gridy++;
c.weightx = 0;
@@ -512,281 +651,20 @@
JScrollPane headersTableScrollPane = new JScrollPane(httpHeadersTable);
jpAdvanced.add(headersTableScrollPane, c);
- // this JLabel makes the rest of the content of the panel to go to the
- // top of the tab
- // (instead of being centered)
-// c.gridx = 0;
-// c.gridy++;
-// c.weightx = 0;
-// c.weighty = 1.0;
-// c.insets = new Insets(0, 0, 0, 0);
-// JLabel jlSpacer = new JLabel();
-// jpAdvanced.add(jlSpacer, 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));
- }
+ public static void setVisibleRowCount(JTable table, int visibleRows){
+ int height = 0;
+ for(int row = 0; row < visibleRows; row++)
+ height += table.getRowHeight(row);
-
- /**
- * 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;
- }
- }
- }
-
- // check if Accept header value is at least not empty
-// We now allow blank values for the 'Accept' header
-// Object candidateAcceptHeaderValue = cbAccepts.getSelectedItem();
-// if (candidateAcceptHeaderValue == null
-// || ((String) candidateAcceptHeaderValue).length() == 0) {
-// JOptionPane.showMessageDialog(MainWindow.getMainWindow(),
-// "Accept header value must not be empty",
-// "REST Activity Configuration - Warning",
-// JOptionPane.WARNING_MESSAGE);
-// return (false);
-// }
-
- // check if Content-Type header value is at least not empty - only do
- // this for those HTTP
- // methods which actually use this value; otherwise, it doesn't really
- // matter, as the value
- // will not be stored to the bean anyway
-// We now allow blank values for the 'Content-Type' header
-// if (RESTActivity
-// .hasMessageBodyInputPort((RESTActivity.HTTP_METHOD) cbHTTPMethod
-// .getSelectedItem())) {
-// Object candidateContentTypeHeaderValue = cbContentType
-// .getSelectedItem();
-// if (candidateContentTypeHeaderValue == null
-// || ((String) candidateContentTypeHeaderValue).length() == 0) {
-// JOptionPane.showMessageDialog(MainWindow.getMainWindow(),
-// "Content-Type header value must not be empty",
-// "REST Activity Configuration - Warning",
-// JOptionPane.WARNING_MESSAGE);
-// return (false);
-// }
-// }
-
- // All valid, return true
- return true;
- }
-
- /**
- * Return configuration bean generated from user interface last time
- * noteConfiguration() was called.
- */
- @Override
- public RESTActivityConfigurationBean getConfiguration() {
- // Should already have been made by noteConfiguration()
- return configBean;
- }
-
- /**
- * Check if the user has changed the configuration from the original
- */
- @Override
- public boolean isConfigurationChanged() {
- HTTP_METHOD originalHTTPMethod = configBean.getHttpMethod();
- String originalURLSignature = configBean.getUrlSignature();
- String originalAcceptsHeaderValue = configBean.getAcceptsHeaderValue();
- String originalContentType = configBean.getContentTypeForUpdates();
- DATA_FORMAT originalOutgoingDataFormat = configBean
- .getOutgoingDataFormat();
- boolean originalSendHTTPExpectRequestHeader = configBean
- .getSendHTTPExpectRequestHeader();
- boolean originalShowRedirectionOutputPort = configBean
- .getShowRedirectionOutputPort();
- boolean originalEscapeParameters = configBean.getEscapeParameters();
-
- boolean contentTypeHasNotChanged = (originalContentType == null && ((String) cbContentType
- .getSelectedItem()).length() == 0)
- || (originalContentType != null && originalContentType
- .equals((String) cbContentType.getSelectedItem()));
-
- // Check if other HTTP header fields or their values have changed
- boolean otherHTTPHeadersNotChanged = true;
- // List of 2-element lists containing header name and value
- ArrayList<ArrayList<String>> originalOtherHTTPHeaders = configBean.getOtherHTTPHeaders();
- ArrayList<ArrayList<String>> otherHTTPHeaders = httpHeadersTableModel.getHTTPHeaderData();
- ListComparator listComparator = new ListComparator();
- // Sort the list rows by the first element in the row (which is HTTP header name)
- Collections.sort(originalOtherHTTPHeaders, listComparator);
- Collections.sort(otherHTTPHeaders, listComparator);
- if (originalOtherHTTPHeaders.size() != otherHTTPHeaders.size()){
- otherHTTPHeadersNotChanged = false; // if size differs we do not have to check anything else
- }
- else{
- // Lists are sorted by HTTP header names now, we can just iterate over any
- for (int i = 0; i < otherHTTPHeaders.size() ; i++){
- // Compare the header names
- if (!otherHTTPHeaders.get(i).get(0).equals(originalOtherHTTPHeaders.get(i).get(0))){
- otherHTTPHeadersNotChanged = false;
- break;
- }
- // Compare the header values
- if (!otherHTTPHeaders.get(i).get(1).equals(originalOtherHTTPHeaders.get(i).get(1))){
- otherHTTPHeadersNotChanged = false;
- break;
- }
- }
- }
-
- // true (changed) unless all fields match the originals
- return !(originalHTTPMethod == (HTTP_METHOD) cbHTTPMethod
- .getSelectedItem()
- && originalURLSignature.equals(tfURLSignature.getText())
- && originalAcceptsHeaderValue.equals((String) cbAccepts
- .getSelectedItem())
- && contentTypeHasNotChanged
- && originalOutgoingDataFormat == (DATA_FORMAT) cbSendDataAs
- .getSelectedItem()
- && originalSendHTTPExpectRequestHeader == cbSendHTTPExpectHeader.isSelected()
- && originalShowRedirectionOutputPort == cbShowRedirectionOutputPort.isSelected()
- && originalEscapeParameters == cbEscapeParameters.isSelected()
- && otherHTTPHeadersNotChanged);
-
- }
-
- /**
- * Prepare a new configuration bean from the UI, to be returned with
- * getConfiguration()
- */
- @Override
- public void noteConfiguration() {
- configBean = new RESTActivityConfigurationBean();
-
- // safe to cast, as it's the type of values that have been placed there
- configBean.setHttpMethod((RESTActivity.HTTP_METHOD) cbHTTPMethod
- .getSelectedItem());
- configBean.setUrlSignature(tfURLSignature.getText().trim());
- configBean.setAcceptsHeaderValue((String) cbAccepts.getSelectedItem());
- configBean.setContentTypeForUpdates((String) cbContentType
- .getSelectedItem());
- configBean.setOutgoingDataFormat((DATA_FORMAT) cbSendDataAs
- .getSelectedItem());
- configBean.setSendHTTPExpectRequestHeader(cbSendHTTPExpectHeader
- .isSelected());
- configBean.setShowRedirectionOutputPort(cbShowRedirectionOutputPort
- .isSelected());
- configBean.setEscapeParameters(cbEscapeParameters.isSelected());
- configBean.setOtherHTTPHeaders(httpHeadersTableModel.getHTTPHeaderData());
- }
-
- /**
- * Update GUI from a changed configuration bean (perhaps by undo / redo).
- */
- @Override
- public void refreshConfiguration() {
- configBean = activity.getConfiguration();
-
- 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());
- cbEscapeParameters.setSelected(configBean.getEscapeParameters());
- httpHeadersTableModel.setHTTPHeaderData(configBean.getOtherHTTPHeaders());
- }
-
- /*
- * Compares two lists of strings by doing string comparison on their first element.
- */
- private class ListComparator implements Comparator<ArrayList<String>>{
-
- @Override
- public int compare(ArrayList<String> list1, ArrayList<String> list2) {
- // lists should not be empty, but ...
- if (list1.isEmpty()){
- if (list2.isEmpty()){
- return 0;
- }
- else{
- return 1;
- }
- }
- else{
- if (list2.isEmpty()){
- return -1;
- }
- else{
- return list1.get(0).compareTo(list2.get(0));
- }
-
- }
- }
-
+ table.setPreferredScrollableViewportSize(new Dimension(
+ table.getPreferredScrollableViewportSize().width,
+ height));
}
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
index 5ff6219..bfb50d0 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java
@@ -3,39 +3,49 @@
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 net.sf.taverna.t2.activities.rest.RESTActivity;
-import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
@SuppressWarnings("serial")
/**
* @author Sergejs Aleksejevs
+ * @author David Withers
*/
-public class RESTActivityConfigureAction extends ActivityConfigurationAction<RESTActivity, RESTActivityConfigurationBean>
-{
+public class RESTActivityConfigureAction extends ActivityConfigurationAction {
- public RESTActivityConfigureAction(RESTActivity activity, Frame owner) {
- super(activity);
+ 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;
}
- @SuppressWarnings("unchecked")
- public void actionPerformed(ActionEvent e)
- {
- ActivityConfigurationDialog<RESTActivity,RESTActivityConfigurationBean> currentDialog =
- ActivityConfigurationAction.getDialog(getActivity());
-
+ public void actionPerformed(ActionEvent e) {
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+ .getDialog(getActivity());
+
if (currentDialog != null) {
currentDialog.toFront();
return;
}
-
- RESTActivityConfigurationPanel panel = new RESTActivityConfigurationPanel(getActivity());
- ActivityConfigurationDialog<RESTActivity,RESTActivityConfigurationBean> dialog =
- new ActivityConfigurationDialog<RESTActivity, RESTActivityConfigurationBean>(getActivity(), panel);
- ActivityConfigurationAction.setDialog(getActivity(), dialog);
+ RESTActivityConfigurationPanel panel = new RESTActivityConfigurationPanel(getActivity(), serviceRegistry);
+ ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(), panel,
+ editManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
}
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
index 2ec5d4b..96326f6 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java
@@ -1,19 +1,19 @@
/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
+ * 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
@@ -21,30 +21,26 @@
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.JComponent;
-import javax.swing.KeyStroke;
-import net.sf.taverna.t2.activities.rest.RESTActivity;
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.file.FileManager;
+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.workflowmodel.Dataflow;
-
-import org.apache.log4j.Logger;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.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 {
@@ -54,8 +50,11 @@
private static final URI insertSection = URI
.create("http://taverna.sf.net/2009/contextMenu/insert");
- private static Logger logger = Logger
- .getLogger(AddRESTTemplateAction.class);
+ private EditManager editManager;
+ private MenuManager menuManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private ServiceRegistry serviceRegistry;
public AddRESTTemplateAction() {
super(insertSection, 500);
@@ -63,8 +62,7 @@
@Override
public boolean isEnabled() {
- return super.isEnabled()
- && getContextualSelection().getSelection() instanceof Dataflow;
+ return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
}
@Override
@@ -72,20 +70,38 @@
return new AddRestAction();
}
-
+
protected class AddRestAction extends AbstractAction {
- AddRestAction () {
- super (ADD_REST, ActivityIconManager.getInstance().iconForActivity(
- new RESTActivity()));
+ AddRestAction() {
+ super(ADD_REST, activityIconManager
+ .iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE));
}
public void actionPerformed(ActionEvent e) {
- Dataflow workflow = FileManager.getInstance()
- .getCurrentDataflow();
-
- WorkflowView.importServiceDescription(GenericRESTTemplateService.getServiceDescription(),
- false);
+ 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;
+ }
+
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
index 9d1ec94..ec738e2 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java
@@ -1,19 +1,19 @@
/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
+ * 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
@@ -25,62 +25,90 @@
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.RESTActivity;
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 net.sf.taverna.t2.workbench.views.graph.actions.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu;
-
-import org.apache.log4j.Logger;
+import uk.org.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 ADD_REST_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddREST");
+ private static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
- private static Logger logger = Logger
- .getLogger(AddRESTTemplateMenuAction.class);
+ 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(InsertMenu.INSERT, 500, ADD_REST_URI);
+ super(INSERT, 500, ADD_REST_URI);
}
@Override
protected Action createAction() {
-
return new AddRESTMenuAction();
}
-
- protected class AddRESTMenuAction extends DesignOnlyAction {
- AddRESTMenuAction () {
- super ();
- putValue(SMALL_ICON, ActivityIconManager.getInstance().iconForActivity(
- new RESTActivity()));
- 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));
+
+ 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);
+ 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;
+ }
+
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
index cc693e0..69a3b96 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java
@@ -1,71 +1,76 @@
package net.sf.taverna.t2.activities.rest.ui.servicedescription;
-import java.util.Arrays;
-import java.util.List;
+import java.net.URI;
import javax.swing.Icon;
import net.sf.taverna.t2.activities.rest.RESTActivity;
-import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean;
import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
/**
- *
* @author Sergejs Aleksejevs
+ * @author David Withers
*/
-public class GenericRESTTemplateService extends AbstractTemplateService<RESTActivityConfigurationBean>
-{
- public GenericRESTTemplateService ()
- {
- super();
- /*
- // TODO - re-enable this if it is necessary to add another folder inside "Service templates" in the Service Panel
- templateService = new AbstractTemplateService.TemplateServiceDescription() {
- public List<String> getPath() {
- return Arrays.asList(SERVICE_TEMPLATES, "REST");
- }
- };
- */
- }
-
- @Override
- public Class<RESTActivity> getActivityClass() {
- return RESTActivity.class;
- }
-
- @Override
- /**
- * Default values for this template service are provided in this method.
- */
- public RESTActivityConfigurationBean getActivityConfiguration()
- {
- return (RESTActivityConfigurationBean.getDefaultInstance());
- }
-
- @Override
- public Icon getIcon() {
- return RESTActivityIcon.getRESTActivityIcon();
- }
-
- public String getName() {
- return "REST Service";
- }
-
- public String getDescription() {
- return "A generic REST service that can handle all HTTP methods";
- }
-
- @SuppressWarnings("unchecked")
+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";
+ }
-
- public String getId() {
- return "http://www.taverna.org.uk/2010/services/rest";
- }
-
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
index 76064de..c2309a9 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java
@@ -1,59 +1,54 @@
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.activities.rest.RESTActivity;
import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-import net.sf.taverna.t2.workbench.ui.impl.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+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;
-
-
- static {
- // set colour for REST processors in the workflow diagram
- ColourManager.getInstance().setPreferredColour(
- RESTActivity.class.getCanonicalName(), PROCESSOR_COLOUR);
- }
-
-
- public int canProvideIconScore(Activity<?> activity)
- {
- if (activity.getClass().getName().equals(RESTActivity.class.getName()))
- return DEFAULT_ICON + 1;
- else
- return NO_ICON;
- }
+public class RESTActivityIcon implements ActivityIconSPI {
+ private static final Color PROCESSOR_COLOUR = Color.decode("#7AAFFF");
- public Icon getIcon(Activity<?> activity) {
- return (getRESTActivityIcon());
- }
+ private static ImageIcon icon;
- 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 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);
+ }
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
index c56bade..91e198f 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/ConfigureRESTActivityMenuAction.java
@@ -2,35 +2,65 @@
import javax.swing.Action;
-import net.sf.taverna.t2.activities.rest.RESTActivity;
+import uk.org.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.
- *
+ * 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<RESTActivity>
-{
+public class ConfigureRESTActivityMenuAction extends AbstractConfigureActivityMenuAction {
- public ConfigureRESTActivityMenuAction() {
- super(RESTActivity.class);
- }
-
- @Override
- protected Action createAction()
- {
- RESTActivityConfigureAction configAction = new RESTActivityConfigureAction(
- findActivity(), getParentFrame());
- configAction.putValue(Action.NAME, "Configure REST service");
- addMenuDots(configAction);
- return configAction;
- }
+ 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;
+ }
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
index aca354c..5bea949 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextViewFactory.java
@@ -3,20 +3,60 @@
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 uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
-import net.sf.taverna.t2.activities.rest.RESTActivity;
+public class RESTActivityMainContextViewFactory implements ContextualViewFactory<Activity> {
-public class RESTActivityMainContextViewFactory implements
- ContextualViewFactory<RESTActivity> {
+ 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 RESTActivity;
+ return selection instanceof Activity
+ && ((Activity) selection).getType()
+ .equals(GenericRESTTemplateService.ACTIVITY_TYPE);
}
- public List<ContextualView> getViews(RESTActivity selection) {
- return Arrays.<ContextualView>asList(new RESTActivityMainContextualView(selection));
+ 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;
+ }
+
}
diff --git a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
index e59b5aa..f4ffe0f 100644
--- a/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
+++ b/src/main/java/net/sf/taverna/t2/activities/rest/ui/view/RESTActivityMainContextualView.java
@@ -15,20 +15,30 @@
import javax.swing.JTextArea;
import javax.swing.JTextField;
-import net.sf.taverna.t2.workbench.ui.impl.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
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 uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
@SuppressWarnings("serial")
public class RESTActivityMainContextualView extends ContextualView {
- private final RESTActivity activity;
+
+ private final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ private final Activity activity;
private JPanel jpMainPanel;
private JTextField tfHTTPMethod;
- //private JTextField tfURLSignature;
private JTextArea taURLSignature;
private JTextField tfAcceptHeader;
private JLabel jlContentType;
@@ -38,18 +48,34 @@
private JLabel jlSendHTTPExpectRequestHeader;
private JTextField tfSendHTTPExpectRequestHeader;
- public RESTActivityMainContextualView(RESTActivity activity) {
+ 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.getInstance().getPreferredColour(
- RESTActivity.class.getCanonicalName()), 2)));
+ 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;
@@ -77,8 +103,6 @@
jpMainPanel.add(jlURLSignature, c);
c.gridx++;
- // tfURLSignature = new JTextField(20);
- // tfURLSignature.setEditable(false);
taURLSignature = new JTextArea(3, 30);
taURLSignature.setEditable(false);
taURLSignature.setLineWrap(true);
@@ -125,8 +149,8 @@
c.gridx = 0;
c.gridy++;
jlSendHTTPExpectRequestHeader = new JLabel("Send HTTP 'Expect' header:");
- jlSendHTTPExpectRequestHeader.setFont(jlSendHTTPExpectRequestHeader
- .getFont().deriveFont(Font.BOLD));
+ jlSendHTTPExpectRequestHeader.setFont(jlSendHTTPExpectRequestHeader.getFont().deriveFont(
+ Font.BOLD));
jlSendHTTPExpectRequestHeader.setVisible(false);
jpMainPanel.add(jlSendHTTPExpectRequestHeader, c);
@@ -148,8 +172,6 @@
* views (even when this contextual view is collapsed).
*/
public String getViewTitle() {
- //RESTActivityConfigurationBean configuration = activity
- // .getConfiguration();
return "REST Service Details";
}
@@ -158,28 +180,25 @@
*/
@Override
public void refreshView() {
- RESTActivityConfigurationBean configuration = activity
- .getConfiguration();
+ Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent());
+ RESTActivityConfigurationBean configurationBean = new RESTActivityConfigurationBean(configuration.getJson());
// toggle visibility of the elements that do not always appear
- jlContentType.setVisible(activity.hasMessageBodyInputPort());
- tfContentTypeHeader.setVisible(activity.hasMessageBodyInputPort());
- jlSendDataAs.setVisible(activity.hasMessageBodyInputPort());
- tfSendDataAs.setVisible(activity.hasMessageBodyInputPort());
- jlSendHTTPExpectRequestHeader.setVisible(activity
- .hasMessageBodyInputPort());
- tfSendHTTPExpectRequestHeader.setVisible(activity
- .hasMessageBodyInputPort());
+ 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("" + configuration.getHttpMethod());
- //tfURLSignature.setText(configuration.getUrlSignature());
- taURLSignature.setText(configuration.getUrlSignature());
- tfAcceptHeader.setText(configuration.getAcceptsHeaderValue());
- tfContentTypeHeader.setText(configuration.getContentTypeForUpdates());
- tfSendDataAs.setText("" + configuration.getOutgoingDataFormat());
- tfSendHTTPExpectRequestHeader.setText(""
- + configuration.getSendHTTPExpectRequestHeader());
+ tfHTTPMethod.setText("" + configurationBean.getHttpMethod());
+ taURLSignature.setText(configurationBean.getUrlSignature());
+ tfAcceptHeader.setText(configurationBean.getAcceptsHeaderValue());
+ tfContentTypeHeader.setText(configurationBean.getContentTypeForUpdates());
+ tfSendDataAs.setText("" + configurationBean.getOutgoingDataFormat());
+ tfSendHTTPExpectRequestHeader.setText("" + configurationBean.getSendHTTPExpectRequestHeader());
}
/**
@@ -194,7 +213,8 @@
@Override
public Action getConfigureAction(final Frame owner) {
// "Configure" button appears because of this action being returned
- return new RESTActivityConfigureAction(activity, owner);
+ return new RESTActivityConfigureAction(activity, owner, editManager, fileManager,
+ activityIconManager, serviceDescriptionRegistry, serviceRegistry);
}
}
diff --git a/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml b/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
new file mode 100644
index 0000000..643d5be
--- /dev/null
+++ b/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ 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="GenericRESTTemplateService" interface="net.sf.taverna.t2.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" />
+
+ <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="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
+
+</beans:beans>
diff --git a/src/main/resources/META-INF/spring/rest-activity-ui-context.xml b/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
new file mode 100644
index 0000000..2b699e7
--- /dev/null
+++ b/src/main/resources/META-INF/spring/rest-activity-ui-context.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="RESTActivityIcon"
+ class="net.sf.taverna.t2.activities.rest.ui.servicedescription.RESTActivityIcon">
+ <property name="colourManager" ref="colourManager" />
+ </bean>
+
+ <bean id="GenericRESTTemplateService"
+ class="net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService" />
+
+ <bean id="ConfigureRESTActivityMenuAction"
+ class="net.sf.taverna.t2.activities.rest.ui.view.ConfigureRESTActivityMenuAction">
+ <property name="editManager" ref="editManager" />
+ <property name="fileManager" ref="fileManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
+ <property name="serviceRegistry" ref="serviceRegistry" />
+ </bean>
+ <bean id="AddRESTTemplateAction"
+ class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateAction">
+ <property name="editManager" ref="editManager" />
+ <property name="menuManager" ref="menuManager" />
+ <property name="selectionManager" ref="selectionManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="serviceRegistry" ref="serviceRegistry" />
+ </bean>
+ <bean id="AddRESTTemplateMenuAction"
+ class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateMenuAction">
+ <property name="editManager" ref="editManager" />
+ <property name="menuManager" ref="menuManager" />
+ <property name="selectionManager" ref="selectionManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="serviceRegistry" ref="serviceRegistry" />
+ </bean>
+
+ <bean id="RESTActivityMainContextViewFactory"
+ class="net.sf.taverna.t2.activities.rest.ui.view.RESTActivityMainContextViewFactory">
+ <property name="editManager" ref="editManager" />
+ <property name="fileManager" ref="fileManager" />
+ <property name="activityIconManager" ref="activityIconManager" />
+ <property name="colourManager" ref="colourManager" />
+ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
+ <property name="serviceRegistry" ref="serviceRegistry" />
+ </bean>
+
+</beans>