http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
 
b/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
deleted file mode 100644
index e942d3a..0000000
--- 
a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1 of
- *  the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- 
******************************************************************************/
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.processor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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 
net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * SPI factory for creating a {@link ProcessorContextualView}.
- * 
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- */
-public class ProcessorActivitiesContextualViewFactory implements
-               ContextualViewFactory<Processor> {
-       private Scufl2Tools scufl2Tools = new Scufl2Tools();
-       private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
-       private SelectionManager selectionManager;
-
-       @Override
-       public boolean canHandle(Object selection) {
-               return selection instanceof Processor;
-       }
-
-       @Override
-       public List<ContextualView> getViews(Processor selection) {
-               List<ContextualView> result = new ArrayList<>();
-               List<ProcessorBinding> processorBindings = scufl2Tools
-                               .processorBindingsForProcessor(selection,
-                                               
selectionManager.getSelectedProfile());
-               for (ProcessorBinding processorBinding : processorBindings) {
-                       Activity activity = processorBinding.getBoundActivity();
-                       for (ContextualViewFactory<? super Activity> cvf : 
contextualViewFactoryRegistry
-                                       .getViewFactoriesForObject(activity))
-                               result.addAll(cvf.getViews(activity));
-               }
-               return result;
-       }
-
-       public void setContextualViewFactoryRegistry(
-                       ContextualViewFactoryRegistry 
contextualViewFactoryRegistry) {
-               this.contextualViewFactoryRegistry = 
contextualViewFactoryRegistry;
-       }
-
-       public void setSelectionManager(SelectionManager selectionManager) {
-               this.selectionManager = selectionManager;
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
 
b/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
deleted file mode 100644
index 2a3fae7..0000000
--- 
a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1 of
- *  the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- 
******************************************************************************/
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.processor;
-
-import static java.util.Collections.singletonList;
-import static javax.swing.BoxLayout.Y_AXIS;
-
-import java.util.List;
-
-import javax.swing.BoxLayout;
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import 
net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-/**
- * How to get a panel describing what Taverna predicts the depth of the ports 
of
- * a processor to be.
- * 
- * @author Stian Soiland-Reyes
- */
-public class ProcessorPredictedBehaviorContextualViewFactory implements
-               ContextualViewFactory<Processor> {
-       private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-       @Override
-       public boolean canHandle(Object selection) {
-               return selection instanceof Processor;
-       }
-
-       @Override
-       @SuppressWarnings("serial")
-       public List<ContextualView> getViews(final Processor selection) {
-               class ProcessorPredictedBehaviorContextualView extends 
ContextualView {
-                       protected JPanel mainPanel = new JPanel();
-                       protected Processor processor;
-
-                       public ProcessorPredictedBehaviorContextualView() {
-                               super();
-                               refreshView();
-                               initView();
-                       }
-
-                       @Override
-                       public void refreshView() {
-                               initialise();
-                               this.revalidate();
-                       }
-
-                       private synchronized void initialise() {
-                               mainPanel.removeAll();
-                               mainPanel.setLayout(new BoxLayout(mainPanel, 
Y_AXIS));
-
-                               StringBuilder html = new 
StringBuilder("<html><head>");
-                               addStyle(html);
-                               html.append("</head><body>");
-
-                               NamedSet<InputProcessorPort> inputs = 
processor.getInputPorts();
-                               if (!inputs.isEmpty()) {
-                                       html.append("<table 
border=1><tr><th>Input Port Name</th>")
-                                                       .append("<th>Size of 
data</th>").append("</tr>");
-                                       for (InputProcessorPort ip : inputs) {
-                                               
html.append("<tr><td>").append(ip.getName())
-                                                               
.append("</td><td>");
-                                               List<DataLink> 
incomingDataLinks = scufl2Tools
-                                                               
.datalinksTo(ip);
-                                               if (incomingDataLinks.isEmpty())
-                                                       html.append("No value");
-                                               else {
-                                                       int depth = 
getDepth(incomingDataLinks.get(0));
-                                                       if (depth == -1)
-                                                               
html.append("Invalid");
-                                                       else if (depth == 0)
-                                                               
html.append("Single value");
-                                                       else
-                                                               
html.append("List of depth ").append(depth);
-                                               }
-                                               html.append("</td></tr>");
-                                       }
-                                       html.append("</table>");
-                               }
-                               NamedSet<OutputProcessorPort> outputs = 
processor
-                                               .getOutputPorts();
-                               if (!outputs.isEmpty()) {
-                                       html.append("<table 
border=1><tr><th>Output Port Name</th>")
-                                                       .append("<th>Size of 
data</th>").append("</tr>");
-                                       for (OutputProcessorPort op : outputs) {
-                                               
html.append("<tr><td>").append(op.getName())
-                                                               
.append("</td><td>");
-                                               List<DataLink> 
outgoingDataLinks = scufl2Tools
-                                                               
.datalinksFrom(op);
-                                               if (outgoingDataLinks.isEmpty())
-                                                       html.append("No value");
-                                               else {
-                                                       int depth = 
getDepth(outgoingDataLinks.get(0));
-                                                       if (depth == -1)
-                                                               
html.append("Invalid/unpredicted");
-                                                       else if (depth == 0)
-                                                               
html.append("Single value");
-                                                       else
-                                                               
html.append("List of depth ").append(depth);
-                                               }
-                                               html.append("</td></tr>");
-                                       }
-                                       html.append("</table>");
-                               }
-                               if (inputs.isEmpty() && outputs.isEmpty())
-                                       html.append("<p>No port behavior 
predicted</p>");
-                               html.append("</body></html>");
-                               JEditorPane editorPane = new 
JEditorPane("text/html",
-                                               html.toString());
-                               editorPane.setEditable(false);
-                               mainPanel.add(editorPane);
-
-                               mainPanel.revalidate();
-                               mainPanel.repaint();
-                               this.revalidate();
-                               this.repaint();
-                       }
-
-                       protected void addStyle(StringBuilder html) {
-                               html.append("<style type='text/css'>")
-                                               .append("table {align:center; 
border:solid black 1px;")
-                                               .append("width:100%; 
height:100%; overflow:auto;}")
-                                               .append("</style>");
-                       }
-
-                       @Override
-                       public JComponent getMainFrame() {
-                               return mainPanel;
-                       }
-
-                       @Override
-                       public String getViewTitle() {
-                               return "Predicted behavior";
-                       }
-
-                       @Override
-                       public int getPreferredPosition() {
-                               return 300;
-                       }
-               }
-
-               return singletonList((ContextualView) new 
ProcessorPredictedBehaviorContextualView());
-       }
-
-       private int getDepth(DataLink datalink) {
-               // TODO calculate actual depth
-               return -1;
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
new file mode 100644
index 0000000..964cae6
--- /dev/null
+++ 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
@@ -0,0 +1,153 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.LINE_START;
+import static java.awt.GridBagConstraints.NONE;
+import static org.apache.taverna.workbench.ui.Utils.getParentFrame;
+
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import 
org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import 
org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * View of a processor, including it's iteration stack, activities, etc.
+ *
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class ProcessorActivitiesContextualView extends ContextualView {
+       private static final String ABSTRACT_PROCESSOR_MSG = "<strong>Abstract 
processor</strong><br>"
+                       + "<i>No services. This will not execute.</i>";
+       private Scufl2Tools scufl2Tools = new Scufl2Tools();
+       protected JPanel mainPanel = new JPanel();
+       protected Processor processor;
+       private final ContextualViewFactoryRegistry 
contextualViewFactoryRegistry;
+       private final SelectionManager selectionManager;
+
+       public ProcessorActivitiesContextualView(Processor processor,
+                       ContextualViewFactoryRegistry 
contextualViewFactoryRegistry,
+                       SelectionManager selectionManager) {
+               super();
+               this.processor = processor;
+               this.contextualViewFactoryRegistry = 
contextualViewFactoryRegistry;
+               this.selectionManager = selectionManager;
+               initialise();
+               initView();
+       }
+
+       @Override
+       public void refreshView() {
+               initialise();
+               this.revalidate();
+       }
+
+       private synchronized void initialise() {
+               mainPanel.removeAll();
+               mainPanel.setLayout(new GridBagLayout());
+
+               GridBagConstraints constraints = new GridBagConstraints();
+               constraints.gridx = 0;
+               constraints.gridy = 0;
+               constraints.weightx = 0.1;
+               constraints.weighty = 0;
+
+               List<ProcessorBinding> processorBindings = scufl2Tools
+                               .processorBindingsForProcessor(processor,
+                                               
selectionManager.getSelectedProfile());
+               if (processorBindings.isEmpty()) {
+                       JLabel noActivitiesLabel = new JLabel("<html>"
+                                       + ABSTRACT_PROCESSOR_MSG + "</html>");
+                       constraints.fill = NONE;
+                       constraints.anchor = LINE_START;
+                       mainPanel.add(noActivitiesLabel, constraints);
+               } else
+                       for (ProcessorBinding processorBinding : 
processorBindings)
+                               addViewForBinding(constraints, 
processorBinding);
+               mainPanel.revalidate();
+               mainPanel.repaint();
+               this.revalidate();
+               this.repaint();
+       }
+
+       private void addViewForBinding(GridBagConstraints constraints,
+                       ProcessorBinding processorBinding) {
+               Activity activity = processorBinding.getBoundActivity();
+               List<ContextualViewFactory<? super Activity>> 
viewFactoryForBeanType = contextualViewFactoryRegistry
+                               .getViewFactoriesForObject(activity);
+               if (viewFactoryForBeanType.isEmpty())
+                       return;
+               // TODO why a list when we only use the first, twice, and 
assume non-empty too?
+               ContextualView view = (ContextualView) 
viewFactoryForBeanType.get(0)
+                               .getViews(activity).get(0);
+
+               constraints.anchor = CENTER;
+               constraints.fill = HORIZONTAL;
+               mainPanel.add(view, constraints);
+               Frame frame = getParentFrame(this);
+               Action configureAction = view.getConfigureAction(frame);
+               if (configureAction != null) {
+                       constraints.gridy++;
+                       constraints.fill = NONE;
+                       constraints.anchor = LINE_START;
+                       JButton configureButton = new JButton(configureAction);
+                       if (configureButton.getText() == null
+                                       || configureButton.getText().isEmpty())
+                               configureButton.setText("Configure");
+                       mainPanel.add(configureButton, constraints);
+               }
+               constraints.gridy++;
+       }
+
+       @Override
+       public JComponent getMainFrame() {
+               return mainPanel;
+       }
+
+       @Override
+       public String getViewTitle() {
+               return "Service";
+       }
+
+       @Override
+       public int getPreferredPosition() {
+               return 100;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
new file mode 100644
index 0000000..0f26d5e
--- /dev/null
+++ 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
@@ -0,0 +1,74 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import 
org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import 
org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * SPI factory for creating a {@link ProcessorContextualView}.
+ * 
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+public class ProcessorActivitiesContextualViewFactory implements
+               ContextualViewFactory<Processor> {
+       private Scufl2Tools scufl2Tools = new Scufl2Tools();
+       private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+       private SelectionManager selectionManager;
+
+       @Override
+       public boolean canHandle(Object selection) {
+               return selection instanceof Processor;
+       }
+
+       @Override
+       public List<ContextualView> getViews(Processor selection) {
+               List<ContextualView> result = new ArrayList<>();
+               List<ProcessorBinding> processorBindings = scufl2Tools
+                               .processorBindingsForProcessor(selection,
+                                               
selectionManager.getSelectedProfile());
+               for (ProcessorBinding processorBinding : processorBindings) {
+                       Activity activity = processorBinding.getBoundActivity();
+                       for (ContextualViewFactory<? super Activity> cvf : 
contextualViewFactoryRegistry
+                                       .getViewFactoriesForObject(activity))
+                               result.addAll(cvf.getViews(activity));
+               }
+               return result;
+       }
+
+       public void setContextualViewFactoryRegistry(
+                       ContextualViewFactoryRegistry 
contextualViewFactoryRegistry) {
+               this.contextualViewFactoryRegistry = 
contextualViewFactoryRegistry;
+       }
+
+       public void setSelectionManager(SelectionManager selectionManager) {
+               this.selectionManager = selectionManager;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
new file mode 100644
index 0000000..66bc931
--- /dev/null
+++ 
b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
@@ -0,0 +1,176 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import static java.util.Collections.singletonList;
+import static javax.swing.BoxLayout.Y_AXIS;
+
+import java.util.List;
+
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import 
org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+/**
+ * How to get a panel describing what Taverna predicts the depth of the ports 
of
+ * a processor to be.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class ProcessorPredictedBehaviorContextualViewFactory implements
+               ContextualViewFactory<Processor> {
+       private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+       @Override
+       public boolean canHandle(Object selection) {
+               return selection instanceof Processor;
+       }
+
+       @Override
+       @SuppressWarnings("serial")
+       public List<ContextualView> getViews(final Processor selection) {
+               class ProcessorPredictedBehaviorContextualView extends 
ContextualView {
+                       protected JPanel mainPanel = new JPanel();
+                       protected Processor processor;
+
+                       public ProcessorPredictedBehaviorContextualView() {
+                               super();
+                               refreshView();
+                               initView();
+                       }
+
+                       @Override
+                       public void refreshView() {
+                               initialise();
+                               this.revalidate();
+                       }
+
+                       private synchronized void initialise() {
+                               mainPanel.removeAll();
+                               mainPanel.setLayout(new BoxLayout(mainPanel, 
Y_AXIS));
+
+                               StringBuilder html = new 
StringBuilder("<html><head>");
+                               addStyle(html);
+                               html.append("</head><body>");
+
+                               NamedSet<InputProcessorPort> inputs = 
processor.getInputPorts();
+                               if (!inputs.isEmpty()) {
+                                       html.append("<table 
border=1><tr><th>Input Port Name</th>")
+                                                       .append("<th>Size of 
data</th>").append("</tr>");
+                                       for (InputProcessorPort ip : inputs) {
+                                               
html.append("<tr><td>").append(ip.getName())
+                                                               
.append("</td><td>");
+                                               List<DataLink> 
incomingDataLinks = scufl2Tools
+                                                               
.datalinksTo(ip);
+                                               if (incomingDataLinks.isEmpty())
+                                                       html.append("No value");
+                                               else {
+                                                       int depth = 
getDepth(incomingDataLinks.get(0));
+                                                       if (depth == -1)
+                                                               
html.append("Invalid");
+                                                       else if (depth == 0)
+                                                               
html.append("Single value");
+                                                       else
+                                                               
html.append("List of depth ").append(depth);
+                                               }
+                                               html.append("</td></tr>");
+                                       }
+                                       html.append("</table>");
+                               }
+                               NamedSet<OutputProcessorPort> outputs = 
processor
+                                               .getOutputPorts();
+                               if (!outputs.isEmpty()) {
+                                       html.append("<table 
border=1><tr><th>Output Port Name</th>")
+                                                       .append("<th>Size of 
data</th>").append("</tr>");
+                                       for (OutputProcessorPort op : outputs) {
+                                               
html.append("<tr><td>").append(op.getName())
+                                                               
.append("</td><td>");
+                                               List<DataLink> 
outgoingDataLinks = scufl2Tools
+                                                               
.datalinksFrom(op);
+                                               if (outgoingDataLinks.isEmpty())
+                                                       html.append("No value");
+                                               else {
+                                                       int depth = 
getDepth(outgoingDataLinks.get(0));
+                                                       if (depth == -1)
+                                                               
html.append("Invalid/unpredicted");
+                                                       else if (depth == 0)
+                                                               
html.append("Single value");
+                                                       else
+                                                               
html.append("List of depth ").append(depth);
+                                               }
+                                               html.append("</td></tr>");
+                                       }
+                                       html.append("</table>");
+                               }
+                               if (inputs.isEmpty() && outputs.isEmpty())
+                                       html.append("<p>No port behavior 
predicted</p>");
+                               html.append("</body></html>");
+                               JEditorPane editorPane = new 
JEditorPane("text/html",
+                                               html.toString());
+                               editorPane.setEditable(false);
+                               mainPanel.add(editorPane);
+
+                               mainPanel.revalidate();
+                               mainPanel.repaint();
+                               this.revalidate();
+                               this.repaint();
+                       }
+
+                       protected void addStyle(StringBuilder html) {
+                               html.append("<style type='text/css'>")
+                                               .append("table {align:center; 
border:solid black 1px;")
+                                               .append("width:100%; 
height:100%; overflow:auto;}")
+                                               .append("</style>");
+                       }
+
+                       @Override
+                       public JComponent getMainFrame() {
+                               return mainPanel;
+                       }
+
+                       @Override
+                       public String getViewTitle() {
+                               return "Predicted behavior";
+                       }
+
+                       @Override
+                       public int getPreferredPosition() {
+                               return 300;
+                       }
+               }
+
+               return singletonList((ContextualView) new 
ProcessorPredictedBehaviorContextualView());
+       }
+
+       private int getDepth(DataLink datalink) {
+               // TODO calculate actual depth
+               return -1;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
 
b/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 3aa7ee0..0000000
--- 
a/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1,4 +0,0 @@
-#net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorDispatchStackContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
 
b/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..d312589
--- /dev/null
+++ 
b/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1,4 @@
+#org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorDispatchStackContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
 
b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
index 932b541..601c74a 100644
--- 
a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
+++ 
b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
@@ -6,10 +6,10 @@
                       http://www.springframework.org/schema/osgi
                       
http://www.springframework.org/schema/osgi/spring-osgi.xsd";>
 
-       <service ref="ProcessorPredictedBehaviorContextualViewFactory" 
interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory"
 />
-       <service ref="ProcessorActivitiesContextualViewFactory" 
interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory"
 />
+       <service ref="ProcessorPredictedBehaviorContextualViewFactory" 
interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory"
 />
+       <service ref="ProcessorActivitiesContextualViewFactory" 
interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory"
 />
 
-       <reference id="contextualViewFactoryRegistry" 
interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry"
 />
-       <reference id="selectionManager" 
interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+       <reference id="contextualViewFactoryRegistry" 
interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry"
 />
+       <reference id="selectionManager" 
interface="org.apache.taverna.workbench.selection.SelectionManager" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
----------------------------------------------------------------------
diff --git 
a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
 
b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
index 7f53cb8..e967ac7 100644
--- 
a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
+++ 
b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
@@ -3,8 +3,8 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                       
http://www.springframework.org/schema/beans/spring-beans.xsd";>
 
-       <bean id="ProcessorPredictedBehaviorContextualViewFactory" 
class="net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory"
 />
-       <bean id="ProcessorActivitiesContextualViewFactory" 
class="net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory">
+       <bean id="ProcessorPredictedBehaviorContextualViewFactory" 
class="org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory"
 />
+       <bean id="ProcessorActivitiesContextualViewFactory" 
class="org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory">
                        <property name="contextualViewFactoryRegistry" 
ref="contextualViewFactoryRegistry" />
                        <property name="selectionManager" 
ref="selectionManager" />
        </bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
----------------------------------------------------------------------
diff --git 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
 
b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
deleted file mode 100644
index 3f6664c..0000000
--- 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.credentialmanager;
-
-interface CMStrings {
-       String ALERT_TITLE = "Credential Manager Alert";
-       String ERROR_TITLE = "Credential Manager Error";
-       String WARN_TITLE = "Credential Manager Warning";
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
 
b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
deleted file mode 100644
index 9277c0e..0000000
--- 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1 of
- *  the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- 
******************************************************************************/
-package net.sf.taverna.t2.workbench.ui.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Font.PLAIN;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static 
net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used by users to change their master password for the Credential
- * Manager.
- */
-@SuppressWarnings("serial")
-public class ChangeMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
-       /** Old password entry field */
-       private JPasswordField oldPasswordField;
-       /** New password entry field */
-       private JPasswordField newPasswordField;
-       /** New password confirmation entry field */
-       private JPasswordField newPasswordConfirmField;
-       /** The entered new password */
-       private String password = null;
-       /** Instructions to the users as to what to do in the dialog */
-       private String instructions;
-       private final CredentialManager credentialManager;
-
-       public ChangeMasterPasswordDialog(JFrame parent, String title,
-                       boolean modal, String instructions,
-                       CredentialManager credentialManager) {
-               super(parent, title, modal, null);
-               this.instructions = instructions;
-               this.credentialManager = credentialManager;
-               initComponents();
-       }
-
-       private void initComponents() {
-               getContentPane().setLayout(new BorderLayout());
-
-               JLabel instructionsLabel = new JLabel(instructions);
-               instructionsLabel.setFont(new Font(null, PLAIN, 11));
-
-               JPanel instructionsPanel = new JPanel();
-               instructionsPanel.setLayout(new BoxLayout(instructionsPanel, 
Y_AXIS));
-               instructionsPanel.add(instructionsLabel);
-               instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
-
-               JLabel oldPasswordLabel = new JLabel("Old master password");
-               oldPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-               JLabel newPasswordLabel = new JLabel("New master password");
-               newPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-               JLabel newPasswordConfirmLabel = new JLabel(
-                               "Confirm new master password");
-               newPasswordConfirmLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-               oldPasswordField = new JPasswordField(15);
-               newPasswordField = new JPasswordField(15);
-               newPasswordConfirmField = new JPasswordField(15);
-
-               JPanel jpPassword = new JPanel(new GridLayout(0, 2, 5, 5));
-               jpPassword.add(oldPasswordLabel);
-               jpPassword.add(oldPasswordField);
-               jpPassword.add(newPasswordLabel);
-               jpPassword.add(newPasswordField);
-               jpPassword.add(newPasswordConfirmLabel);
-               jpPassword.add(newPasswordConfirmField);
-
-               JPanel mainPanel = new JPanel(new BorderLayout());
-               mainPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 
10, 10),
-                               new EtchedBorder()));
-               mainPanel.add(instructionsPanel, NORTH);
-               mainPanel.add(jpPassword, CENTER);
-
-               JButton okButton = new JButton("OK");
-               okButton.addActionListener(new ActionListener() {
-                       @Override
-                       public void actionPerformed(ActionEvent evt) {
-                               okPressed();
-                       }
-               });
-
-               JButton cancelButton = new JButton("Cancel");
-               cancelButton.addActionListener(new ActionListener() {
-                       @Override
-                       public void actionPerformed(ActionEvent evt) {
-                               cancelPressed();
-                       }
-               });
-               JPanel buttonsPanel = new JPanel(new 
FlowLayout(FlowLayout.CENTER));
-               buttonsPanel.add(okButton);
-               buttonsPanel.add(cancelButton);
-
-               getContentPane().add(mainPanel, CENTER);
-               getContentPane().add(buttonsPanel, SOUTH);
-
-               addWindowListener(new WindowAdapter() {
-                       @Override
-                       public void windowClosing(WindowEvent evt) {
-                               closeDialog();
-                       }
-               });
-
-               setResizable(false);
-               getRootPane().setDefaultButton(okButton);
-               pack();
-       }
-
-       /**
-        * Get the password set in the dialog or null if none was set.
-        */
-       public String getPassword() {
-               return password;
-       }
-
-       /**
-        * Check that the user has provided the correct old master password, 
that
-        * the user has supplied the new password and confirmed it and that it 
is
-        * not empty. If all is OK, stores the new password in the password 
field.
-        * 
-        */
-       private boolean checkPassword() {
-               String oldPassword = new String(oldPasswordField.getPassword());
-
-               if (oldPassword.length() == 0) {
-                       // old password must not be empty
-                       showMessageDialog(this,
-                                       "You must provide your current master 
password",
-                                       WARN_TITLE, WARNING_MESSAGE);
-                       return false;
-               }
-
-               try {
-                       if 
(!credentialManager.confirmMasterPassword(oldPassword)) {
-                               showMessageDialog(this,
-                                               "You have provided an incorrect 
master password",
-                                               WARN_TITLE, WARNING_MESSAGE);
-                               return false;
-                       }
-               } catch (Exception e) {
-                       showMessageDialog(
-                                       this,
-                                       "Credential Manager could not verify 
your current master password",
-                                       WARN_TITLE, WARNING_MESSAGE);
-                       return false;
-               }
-
-               String newPassword = new String(newPasswordField.getPassword());
-               String newPasswordConfirm = new String(
-                               newPasswordConfirmField.getPassword());
-
-               if (!newPassword.equals(newPasswordConfirm)) {
-                       // passwords do not match
-                       showMessageDialog(this, "Passwords do not match", 
WARN_TITLE,
-                                       WARNING_MESSAGE);
-                       return false;
-               }
-
-               if (newPassword.isEmpty()) {
-                       // passwords match but are empty
-                       showMessageDialog(this, "The new master password cannot 
be empty",
-                                       WARN_TITLE, WARNING_MESSAGE);
-                       return false;
-               }
-
-               // passwords match and not empty
-               password = newPassword;
-               return true;
-       }
-
-       private void okPressed() {
-               if (checkPassword())
-                       closeDialog();
-       }
-
-       private void cancelPressed() {
-               /*
-                * Set the password to null as it might have changed in the 
meantime if
-                * user entered something then cancelled.
-                */
-               password = null;
-               closeDialog();
-       }
-
-       private void closeDialog() {
-               setVisible(false);
-               dispose();
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
----------------------------------------------------------------------
diff --git 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
 
b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
deleted file mode 100644
index 5dbb697..0000000
--- 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
- * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
- * 
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1 of
- *  the License, or (at your option) any later version.
- *    
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *    
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- 
******************************************************************************/
-package net.sf.taverna.t2.workbench.ui.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Color.WHITE;
-import static java.awt.Font.BOLD;
-import static java.awt.Font.PLAIN;
-import static java.awt.GridBagConstraints.LINE_START;
-import static javax.security.auth.x500.X500Principal.RFC2253;
-
-import java.awt.BorderLayout;
-import java.awt.Dialog;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Frame;
-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.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.math.BigInteger;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-/**
- * Displays the details of a X.509 certificate and asks user if they want to
- * trust it. This is normally invoked by the Taverna's TrustManager when 
trying 
- * to confirm the trust in the remote server during SSL handshake.
- */
-@SuppressWarnings("serial")
-public class ConfirmTrustedCertificateDialog extends 
NonBlockedHelpEnabledDialog {
-       private static Logger logger = 
Logger.getLogger(ConfirmTrustedCertificateDialog.class);
-
-       /** The certificate to display */
-       private X509Certificate cert;
-       /** User's decision as whether to trust this service's certificate or 
not */
-       private boolean shouldTrust;
-       /**
-        * Should the decision also be saved in Credential Manager? Actually - 
it is
-        * always saved now as it was really hard to implement trusting for one
-        * connection only - so we can either "trust" or "not" trust but not
-        * "trust once".
-        */
-       private boolean shouldSave = false;
-       private final DistinguishedNameParser dnParser;
-
-       public ConfirmTrustedCertificateDialog(Frame parent, String title,
-                       boolean modal, X509Certificate crt, 
DistinguishedNameParser dnParser) {
-               super(parent, title, modal);
-               this.cert = crt;
-               this.dnParser = dnParser;
-               initComponents();
-       }
-
-       public ConfirmTrustedCertificateDialog(Dialog parent, String title,
-                       boolean modal, X509Certificate crt, 
DistinguishedNameParser dnParser)
-                       throws CMException {
-               super(parent, title, modal);
-               this.cert = crt;
-               this.dnParser = dnParser;
-               initComponents();
-       }
-
-       private void initComponents(){          
-               // title panel
-               JPanel titlePanel = new JPanel(new BorderLayout());
-               titlePanel.setBackground(WHITE);
-               JLabel titleLabel = new JLabel("View service's certificate");
-               titleLabel.setFont(titleLabel.getFont().deriveFont(BOLD, 
13.5f));
-               titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
-
-               DialogTextArea titleMessage = new DialogTextArea();
-               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, NORTH);
-               titlePanel.add(titleMessage, CENTER);
-               
-               // Certificate details:
-
-               ParsedDistinguishedName subjectDN = dnParser.parseDN(cert
-                               .getSubjectX500Principal().getName(RFC2253));
-               ParsedDistinguishedName issuerDN = dnParser.parseDN(cert
-                               .getIssuerX500Principal().getName(RFC2253));
-               JPanel certificatePanel = 
createCertificateDetailsPanel(subjectDN, issuerDN);
-               titleMessage.setText("The service host " + subjectDN.getCN() + 
" 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 services on this host from a 
workflow.)");
-
-               // OK button
-               JPanel buttonsPanel = new JPanel(new 
FlowLayout(FlowLayout.CENTER));
-
-//             final JButton trustButton = new JButton("Trust once");
-//             trustButton.addActionListener(new ActionListener() {
-//                     public void actionPerformed(ActionEvent evt) {
-//                             trustPressed();
-//                     }
-//             });
-               
-               //final JButton trustAlwaysButton = new JButton("Trust always");
-               final JButton trustAlwaysButton = new JButton("Trust");
-               trustAlwaysButton.addActionListener(new ActionListener() {
-                       @Override
-                       public void actionPerformed(ActionEvent evt) {
-                               trustAlwaysPressed();
-                       }
-               });
-               
-               final JButton dontTrustButton = new JButton("Do not trust");
-               dontTrustButton.addActionListener(new ActionListener() {
-                       @Override
-                       public void actionPerformed(ActionEvent evt) {
-                               dontTrustPressed();
-                       }
-               });
-
-               //jpButtons.add(trustButton);
-               buttonsPanel.add(trustAlwaysButton);
-               buttonsPanel.add(dontTrustButton);
-
-               getContentPane().add(titlePanel, NORTH);
-               getContentPane().add(certificatePanel, CENTER);
-               getContentPane().add(buttonsPanel, SOUTH);
-
-               setResizable(false);
-
-               addWindowListener(new WindowAdapter() {
-                       @Override
-                       public void windowClosing(WindowEvent evt) {
-                               closeDialog();
-                       }
-               });
-
-               getRootPane().setDefaultButton(trustAlwaysButton);
-               pack();
-       }
-
-       private JPanel createCertificateDetailsPanel(ParsedDistinguishedName 
subjectDN, ParsedDistinguishedName issuerDN) {
-               /*
-                * Grid Bag Constraints templates for labels (column 1) and 
values
-                * (column 2) of certificate details
-                */
-               GridBagConstraints gbc_labels = new GridBagConstraints();
-               gbc_labels.gridx = 0;
-               gbc_labels.ipadx = 20;
-               gbc_labels.gridwidth = 1;
-               gbc_labels.gridheight = 1;
-               gbc_labels.insets = new Insets(2, 15, 2, 2);
-               gbc_labels.anchor = LINE_START;
-
-               GridBagConstraints gbc_values = new GridBagConstraints();
-               gbc_values.gridx = 1;
-               gbc_values.gridwidth = 1;
-               gbc_values.gridheight = 1;
-               gbc_values.insets = new Insets(2, 5, 2, 2);
-               gbc_values.anchor = 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
-                * 
-                * From openssl's documentation: "The [above] extension is non 
standard,
-                * Netscape specific and largely obsolete. Their use in new 
applications
-                * is discouraged."
-                * 
-                * TODO replace with "basicConstraints, keyUsage and extended 
key usage
-                * extensions which are now used instead."
-                */
-//             byte[] intendedUses = 
cert.getExtensionValue("2.16.840.1.113730.1.1"); // Netscape Certificate Type 
OID
-//             JLabel intendedUsesLabel = null;
-//             JTextField intendedUsesTextField = null;
-//             JPanel intendedUsesPanel = null;
-//             GridBagConstraints gbc_intendedUsesLabel = null;
-//             if (intendedUses != null) {
-//                     intendedUsesLabel = new JLabel(
-//                                     "This certificate has been approved for 
the following uses:");
-//                     intendedUsesLabel.setFont(new Font(null, Font.BOLD, 
11));
-//                     intendedUsesLabel.setBorder(new EmptyBorder(5, 5, 5, 
5));
-//
-//                     intendedUsesTextField = new JTextField(45);
-//                     
intendedUsesTextField.setText(CMUtils.getIntendedCertificateUses(intendedUses));
-//                     intendedUsesTextField.setEditable(false);
-//                     intendedUsesTextField.setFont(new Font(null, 
Font.PLAIN, 11));
-//
-//                     intendedUsesPanel = new JPanel(new BorderLayout());
-//                     intendedUsesPanel.add(intendedUsesLabel, 
BorderLayout.NORTH);
-//                     intendedUsesPanel.add(intendedUsesTextField, 
BorderLayout.CENTER);
-//                     JSeparator separator = new 
JSeparator(JSeparator.HORIZONTAL);
-//                     intendedUsesPanel.add(separator, BorderLayout.SOUTH);
-//
-//                     gbc_intendedUsesLabel = (GridBagConstraints) 
gbc_labels.clone();
-//                     gbc_intendedUsesLabel.gridy = 0;
-//                     gbc_intendedUsesLabel.gridwidth = 2; // takes two 
columns
-//                     gbc_intendedUsesLabel.insets = new Insets(5, 5, 5, 
5);// has slightly bigger insets
-//             }
-
-               // Issued To
-               JLabel issuedToLabel = new JLabel("Issued To");
-               issuedToLabel.setFont(new Font(null, BOLD, 11));
-               GridBagConstraints gbc_issuedTo = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_issuedTo.gridy = 1;
-               gbc_issuedTo.gridwidth = 2; // takes two columns
-               gbc_issuedTo.insets = new Insets(5, 5, 5, 5);// has slightly 
bigger insets
-               // Subject's Distinguished Name (DN)
-               // Extract the CN, O, OU and EMAILADDRESS fields
-               String subjectCN = subjectDN.getCN();
-               String subjectOrg = subjectDN.getO();
-               String subjectOU = subjectDN.getOU();
-               // String sEMAILADDRESS = CMUtils.getEmilAddress();
-               // Subject's Common Name (CN)
-               JLabel subjectCNLabel = new JLabel("Common Name (CN)");
-               subjectCNLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectCNLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_subjectCNLabel.gridy = 2;
-               JLabel subjectCNValue = new JLabel(subjectCN);
-               subjectCNValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectCNValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_subjectCNValue.gridy = 2;
-               // Subject's Organisation (O)
-               JLabel subjectOrgLabel = new JLabel("Organisation (O)");
-               subjectOrgLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectOrgLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_subjectOrgLabel.gridy = 3;
-               JLabel subjectOrgValue = new JLabel(subjectOrg);
-               subjectOrgValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectOrgValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_subjectOrgValue.gridy = 3;
-               // Subject's Organisation Unit (OU)
-               JLabel subjectOULabel = new JLabel("Organisation Unit (OU)");
-               subjectOULabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectOULabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_subjectOULabel.gridy = 4;
-               JLabel subjectOUValue = new JLabel(subjectOU);
-               subjectOUValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_subjectOUValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_subjectOUValue.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 snLabel = new JLabel("Serial Number");
-               snLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_snLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_snLabel.gridy = 6;
-               JLabel snValue = new JLabel();
-               // Get the hexadecimal serial number
-               StringBuilder strBuff = new StringBuilder(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, ':');
-               snValue.setText(strBuff.toString());
-               snValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_snValue = (GridBagConstraints) gbc_values
-                               .clone();
-               gbc_snValue.gridy = 6;
-               // Certificate version number
-               JLabel versionLabel = new JLabel("Version");
-               versionLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_versionLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_versionLabel.gridy = 7;
-               JLabel versionValue = new 
JLabel(Integer.toString(cert.getVersion()));
-               versionValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_versionValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_versionValue.gridy = 7;
-
-               // Issued By
-               JLabel issuedByLabel = new JLabel("Issued By");
-               issuedByLabel.setFont(new Font(null, BOLD, 11));
-               GridBagConstraints gbc_issuedByLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_issuedByLabel.gridy = 8;
-               gbc_issuedByLabel.gridwidth = 2; // takes two columns
-               gbc_issuedByLabel.insets = new Insets(5, 5, 5, 5);// has 
slightly bigger insets
-               // Issuer's Distinguished Name (DN)
-               // Extract the CN, O and OU fields for the issuer
-               String issuerCN = issuerDN.getCN();
-               String issuerOrg = issuerDN.getO();
-               String issuerOU = issuerDN.getOU();
-               // Issuer's Common Name (CN)
-               JLabel issuerCNLabel = new JLabel("Common Name (CN)");
-               issuerCNLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerCNLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_issuerCNLabel.gridy = 9;
-               JLabel issuerCNValue = new JLabel(issuerCN);
-               issuerCNValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerCNValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_issuerCNValue.gridy = 9;
-               // Issuer's Organisation (O)
-               JLabel issuerOrgLabel = new JLabel("Organisation (O)");
-               issuerOrgLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerOrgLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_issuerOrgLabel.gridy = 10;
-               JLabel issuerOrgValue = new JLabel(issuerOrg);
-               issuerOrgValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerOrgValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_issuerOrgValue.gridy = 10;
-               // Issuer's Organisation Unit (OU)
-               JLabel issuerOULabel = new JLabel("Organisation Unit (OU)");
-               issuerOULabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerOULabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_issuerOULabel.gridy = 11;
-               JLabel issuerOUValue = new JLabel(issuerOU);
-               issuerOUValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuerOUValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_issuerOUValue.gridy = 11;
-               
-               // Validity
-               JLabel validityLabel = new JLabel("Validity");
-               validityLabel.setFont(new Font(null, BOLD, 11));
-               GridBagConstraints gbc_validityLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_validityLabel.gridy = 12;
-               gbc_validityLabel.gridwidth = 2; // takes two columns
-               gbc_validityLabel.insets = new Insets(5, 5, 5, 5);// has 
slightly bigger insets
-               // Issued On
-               JLabel issuedOnLabel = new JLabel("Issued On");
-               issuedOnLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuedOnLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_issuedOnLabel.gridy = 13;
-               JLabel issuedOnValue = new 
JLabel(cert.getNotBefore().toString());
-               issuedOnValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_issuedOnValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_issuedOnValue.gridy = 13;
-               // Expires On
-               JLabel expiresOnLabel = new JLabel("Expires On");
-               expiresOnLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_expiresOnLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_expiresOnLabel.gridy = 14;
-               JLabel expiresOnValue = new 
JLabel(cert.getNotAfter().toString());
-               expiresOnValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_expiresOnValue = (GridBagConstraints) 
gbc_values
-                               .clone();
-               gbc_expiresOnValue.gridy = 14;
-
-               // Fingerprints
-               byte[] binaryCertificateEncoding = new byte[0];
-               try {
-                       // each certificate has one binary encoding; for X.509 
certs it is DER
-                       binaryCertificateEncoding = cert.getEncoded();
-               } catch (CertificateEncodingException ex) {
-                       logger.error("Could not get the encoded form of the 
certificate.", ex);
-               }
-               JLabel fingerprintsLabel = new JLabel("Fingerprints");
-               fingerprintsLabel.setFont(new Font(null, BOLD, 11));
-               GridBagConstraints gbc_fingerprintsLabel = (GridBagConstraints) 
gbc_labels
-                               .clone();
-               gbc_fingerprintsLabel.gridy = 15;
-               gbc_fingerprintsLabel.gridwidth = 2; // takes two columns
-               gbc_fingerprintsLabel.insets = new Insets(5, 5, 5, 5);// has 
slightly bigger insets
-               // SHA-1 Fingerprint
-               JLabel sha1FingerprintLabel = new JLabel("SHA1 Fingerprint");
-               sha1FingerprintLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_sha1FingerprintLabel = 
(GridBagConstraints) gbc_labels
-                               .clone();
-               gbc_sha1FingerprintLabel.gridy = 16;
-               JLabel sha1FingerprintValue = new JLabel(
-                               dnParser.getMessageDigestAsFormattedString(
-                                               binaryCertificateEncoding, 
"SHA1"));
-               sha1FingerprintValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_sha1FingerprintValue = 
(GridBagConstraints) gbc_values
-                               .clone();
-               gbc_sha1FingerprintValue.gridy = 16;
-               // MD5 Fingerprint
-               JLabel md5FingerprintLabel = new JLabel("MD5 Fingerprint");
-               md5FingerprintLabel.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_md5FingerprinLabel = 
(GridBagConstraints) gbc_labels
-                               .clone();
-               gbc_md5FingerprinLabel.gridy = 17;
-               JLabel md5FingerprintValue = new JLabel(
-                               dnParser.getMessageDigestAsFormattedString(
-                                               binaryCertificateEncoding, 
"MD5"));
-               md5FingerprintValue.setFont(new Font(null, PLAIN, 11));
-               GridBagConstraints gbc_md5FingerprintValue = 
(GridBagConstraints) gbc_values
-                               .clone();
-               gbc_md5FingerprintValue.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 emptyLabel = new JLabel("");
-               GridBagConstraints gbc_emptyLabel = (GridBagConstraints) 
gbc_labels.clone();
-               gbc_emptyLabel.gridy = 18;
-               gbc_emptyLabel.gridwidth = 2; // takes two columns
-               gbc_emptyLabel.ipady = 40;
-
-               JPanel certificatePanel = new JPanel(new GridBagLayout());
-               certificatePanel.setBorder(new CompoundBorder(new 
EmptyBorder(15, 15, 15,
-                               15), new EtchedBorder()));
-
-//             if (intendedUses != null)
-//                     certificatePanel.add(intendedUsesPanel, 
gbc_intendedUsesLabel);
-               certificatePanel.add(issuedToLabel, gbc_issuedTo); // Issued To
-               certificatePanel.add(subjectCNLabel, gbc_subjectCNLabel);
-               certificatePanel.add(subjectCNValue, gbc_subjectCNValue);
-               certificatePanel.add(subjectOrgLabel, gbc_subjectOrgLabel);
-               certificatePanel.add(subjectOrgValue, gbc_subjectOrgValue);
-               certificatePanel.add(subjectOULabel, gbc_subjectOULabel);
-               certificatePanel.add(subjectOUValue, gbc_subjectOUValue);
-               // jpCertificate.add(jlEmail, gbc_jlEmail);
-               // jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
-               certificatePanel.add(snLabel, gbc_snLabel);
-               certificatePanel.add(snValue, gbc_snValue);
-               certificatePanel.add(versionLabel, gbc_versionLabel);
-               certificatePanel.add(versionValue, gbc_versionValue);
-               certificatePanel.add(issuedByLabel, gbc_issuedByLabel); // 
Issued By
-               certificatePanel.add(issuerCNLabel, gbc_issuerCNLabel);
-               certificatePanel.add(issuerCNValue, gbc_issuerCNValue);
-               certificatePanel.add(issuerOrgLabel, gbc_issuerOrgLabel);
-               certificatePanel.add(issuerOrgValue, gbc_issuerOrgValue);
-               certificatePanel.add(issuerOULabel, gbc_issuerOULabel);
-               certificatePanel.add(issuerOUValue, gbc_issuerOUValue);
-               certificatePanel.add(validityLabel, gbc_validityLabel); // 
Validity
-               certificatePanel.add(issuedOnLabel, gbc_issuedOnLabel);
-               certificatePanel.add(issuedOnValue, gbc_issuedOnValue);
-               certificatePanel.add(expiresOnLabel, gbc_expiresOnLabel);
-               certificatePanel.add(expiresOnValue, gbc_expiresOnValue);
-               certificatePanel.add(fingerprintsLabel, gbc_fingerprintsLabel); 
// Fingerprints
-               certificatePanel.add(sha1FingerprintLabel, 
gbc_sha1FingerprintLabel);
-               certificatePanel.add(sha1FingerprintValue, 
gbc_sha1FingerprintValue);
-               certificatePanel.add(md5FingerprintLabel, 
gbc_md5FingerprinLabel);
-               certificatePanel.add(md5FingerprintValue, 
gbc_md5FingerprintValue);
-               // Empty label to get some vertical space on the frame
-               certificatePanel.add(emptyLabel, gbc_emptyLabel);
-               return certificatePanel;
-       }
-
-//     private void trustPressed() {
-//             shouldTrust = true;
-//             shouldSave = false;
-//             closeDialog();
-//     }
-
-       private void trustAlwaysPressed() {
-               shouldTrust = true;
-               shouldSave = true;
-               closeDialog();
-       }
-
-       private void dontTrustPressed() {
-               shouldTrust = false;
-               shouldSave = false;
-               closeDialog();
-       }
-
-       public void closeDialog() {
-               setVisible(false);
-               dispose();
-       }
-
-       public boolean shouldTrust() {
-               return shouldTrust;
-       }
-
-       public boolean shouldSave() {
-               return shouldSave;
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
----------------------------------------------------------------------
diff --git 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
 
b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
deleted file mode 100644
index c7eaef5..0000000
--- 
a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public License
- *  as published by the Free Software Foundation; either version 2.1 of
- *  the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- 
******************************************************************************/
-package net.sf.taverna.t2.workbench.ui.credentialmanager;
-
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.Frame;
-import java.security.cert.X509Certificate;
-
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.TrustConfirmationProvider;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author Stian Soiland-Reyes
- */
-public class ConfirmTrustedCertificateUI implements TrustConfirmationProvider {
-       private static Logger logger = Logger
-                       .getLogger(ConfirmTrustedCertificateUI.class);
-
-       private DistinguishedNameParser dnParser;
-
-       @Override
-       public Boolean shouldTrustCertificate(X509Certificate[] chain) {
-               boolean trustConfirm = false;
-               logger.info("Asking the user if they want to trust a 
certificate.");
-               // Ask user if they want to trust this service
-               ConfirmTrustedCertificateDialog confirmCertTrustDialog = new 
ConfirmTrustedCertificateDialog(
-                               (Frame) null, "Untrusted HTTPS connection", 
true,
-                               (X509Certificate) chain[0], dnParser);
-               confirmCertTrustDialog.setLocationRelativeTo(null);
-               confirmCertTrustDialog.setVisible(true);
-               trustConfirm = confirmCertTrustDialog.shouldTrust();
-//             trustConfirm.setShouldSave(confirmCertTrustDialog.shouldSave());
-               if (!confirmCertTrustDialog.shouldTrust())
-                       showMessageDialog(
-                                       null,
-                                       "As you refused to trust this host, you 
will not be able to use its services from a workflow.",
-                                       "Untrusted HTTPS connection", 
INFORMATION_MESSAGE);
-
-               return trustConfirm;
-       }
-
-       /**
-        * @param dnParser
-        *            the dnParser to set
-        */
-       public void setDistinguishedNameParser(DistinguishedNameParser 
dnParser) {
-               this.dnParser = dnParser;
-       }
-}

Reply via email to