You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:24:52 UTC
[05/16] incubator-taverna-workbench-common-activities git commit:
Revert "Temporarily empty repository"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/54050685/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
new file mode 100644
index 0000000..bc58aad
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/ConfirmTrustedCertificateDialog.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..79f8ccd
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLActivityIcon.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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;
+ }
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/54050685/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
new file mode 100644
index 0000000..faa3f8c
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceDescription.java
@@ -0,0 +1,154 @@
+/*********************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..daf0cad
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProvider.java
@@ -0,0 +1,206 @@
+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/54050685/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
new file mode 100644
index 0000000..9a63c03
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/WSDLServiceProviderConfig.java
@@ -0,0 +1,32 @@
+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/54050685/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
new file mode 100644
index 0000000..cc92f3b
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLInputSplitterActivityIcon.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..73c9bcb
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/servicedescriptions/XMLOutputSplitterActivityIcon.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..0ca95e5
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/AbstractXMLSplitterActionView.java
@@ -0,0 +1,159 @@
+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/54050685/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
new file mode 100644
index 0000000..4f728d9
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityConfigurationView.java
@@ -0,0 +1,446 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..ac129ec
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityContextualView.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..b3fb8ed
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/WSDLActivityViewFactory.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..228edd4
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterContextualView.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..d0d5f8f
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/java/net/sf/taverna/t2/activities/wsdl/views/XMLSplitterViewFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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/54050685/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
new file mode 100644
index 0000000..3bf8341
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLServiceProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/54050685/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
new file mode 100644
index 0000000..7b0e040
--- /dev/null
+++ b/taverna-wsdl-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
@@ -0,0 +1,5 @@
+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