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 2018/06/29 10:54:48 UTC
[01/27] incubator-taverna-plugin-component git commit:
org.apache.taverna.component -> io.github.taverna-extras.component
Repository: incubator-taverna-plugin-component
Updated Branches:
refs/heads/master 72ede59e7 -> b7b61e713
org.apache.taverna.component -> io.github.taverna-extras.component
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/commit/09a209b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/09a209b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/09a209b8
Branch: refs/heads/master
Commit: 09a209b84ef9db8821e81600879bb17a4304b1cb
Parents: 72ede59
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Jun 29 11:39:18 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Jun 29 11:50:02 2018 +0100
----------------------------------------------------------------------
pom.xml | 13 ++++---------
taverna-component-activity-ui/pom.xml | 20 +-------------------
taverna-component-activity/pom.xml | 2 +-
taverna-component-repository-api/pom.xml | 2 +-
4 files changed, 7 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/09a209b8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4825360..e996ced 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,16 +20,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna</groupId>
- <artifactId>apache-taverna-parent</artifactId>
- <version>3-incubating</version>
- </parent>
- <groupId>org.apache.taverna.component</groupId>
- <artifactId>apache-taverna-plugin-component</artifactId>
- <version>2.1.0-incubating-SNAPSHOT</version>
+ <groupId>io.github.taverna-extras.component</groupId>
+ <artifactId>taverna-plugin-component</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Apache Taverna Plugin for Component activity</name>
+ <name>Taverna Plugin for Component activity</name>
<properties>
<taverna.language.version>0.15.1-incubating</taverna.language.version>
<taverna.osgi.version>0.2.1-incubating</taverna.osgi.version>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/09a209b8/taverna-component-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/pom.xml b/taverna-component-activity-ui/pom.xml
index 0cd1734..2c28f27 100644
--- a/taverna-component-activity-ui/pom.xml
+++ b/taverna-component-activity-ui/pom.xml
@@ -17,29 +17,11 @@
limitations under the License.
-->
-<!--
-
- 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.
-
--->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.taverna.component</groupId>
+ <groupId>io.github.taverna-extras.component</groupId>
<artifactId>apache-taverna-plugin-component</artifactId>
<version>2.1.0-incubating-SNAPSHOT</version>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/09a209b8/taverna-component-activity/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/pom.xml b/taverna-component-activity/pom.xml
index 9410910..6bffac2 100644
--- a/taverna-component-activity/pom.xml
+++ b/taverna-component-activity/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.taverna.component</groupId>
+ <groupId>io.github.taverna-extras.component</groupId>
<artifactId>apache-taverna-plugin-component</artifactId>
<version>2.1.0-incubating-SNAPSHOT</version>
</parent>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/09a209b8/taverna-component-repository-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/pom.xml b/taverna-component-repository-api/pom.xml
index e5e7da9..e5c6174 100644
--- a/taverna-component-repository-api/pom.xml
+++ b/taverna-component-repository-api/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.taverna.component</groupId>
+ <groupId>io.github.taverna-extras</groupId>
<artifactId>apache-taverna-plugin-component</artifactId>
<version>2.1.0-incubating-SNAPSHOT</version>
</parent>
[22/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChoiceMessage.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChoiceMessage.java
new file mode 100644
index 0000000..85249ca
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChoiceMessage.java
@@ -0,0 +1,40 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import io.github.taverna_extras.component.api.Registry;
+
+/**
+ * @author alanrw
+ */
+public class RegistryChoiceMessage {
+ private final Registry chosenRegistry;
+
+ public RegistryChoiceMessage(Registry chosenRegistry) {
+ this.chosenRegistry = chosenRegistry;
+ }
+
+ /**
+ * @return the chosenRegistry
+ */
+ public Registry getChosenRegistry() {
+ return chosenRegistry;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChooserPanel.java
new file mode 100644
index 0000000..1e2bf78
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryChooserPanel.java
@@ -0,0 +1,138 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.Vector;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class RegistryChooserPanel extends JPanel implements
+ Observable<RegistryChoiceMessage> {
+ private static final String REGISTRY_LABEL = "Component registry:";
+ private static final long serialVersionUID = 8390860727800654604L;
+ private static final Logger logger = getLogger(RegistryChooserPanel.class);
+
+ private final List<Observer<RegistryChoiceMessage>> observers = new ArrayList<>();
+ private final JComboBox<String> registryBox;
+ private final SortedMap<String, Registry> registryMap;
+
+ public RegistryChooserPanel(ComponentPreference pref) {
+ setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ registryMap = pref.getRegistryMap();
+ registryBox = new JComboBox<>(new Vector<>(registryMap.keySet()));
+ registryBox.setPrototypeDisplayValue(LONG_STRING);
+ registryBox.setEditable(false);
+
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ this.add(new JLabel(REGISTRY_LABEL), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = BOTH;
+ this.add(registryBox, gbc);
+
+ registryBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED)
+ dealWithSelection();
+ }
+ });
+
+ String firstKey = registryMap.firstKey();
+ registryBox.setSelectedItem(firstKey);
+ dealWithSelection();
+ }
+
+ private void updateToolTipText() {
+ String key = (String) registryBox.getSelectedItem();
+ Registry registry = registryMap.get(key);
+ registryBox.setToolTipText(registry.getRegistryBase().toString());
+ }
+
+ private void dealWithSelection() {
+ updateToolTipText();
+ Registry chosenRegistry = getChosenRegistry();
+ RegistryChoiceMessage message = new RegistryChoiceMessage(
+ chosenRegistry);
+ for (Observer<RegistryChoiceMessage> o : getObservers())
+ try {
+ o.notify(this, message);
+ } catch (Exception e) {
+ logger.error("problem handling selection update", e);
+ }
+ }
+
+ @Override
+ public void addObserver(Observer<RegistryChoiceMessage> observer) {
+ observers.add(observer);
+ Registry chosenRegistry = getChosenRegistry();
+ RegistryChoiceMessage message = new RegistryChoiceMessage(
+ chosenRegistry);
+ try {
+ observer.notify(this, message);
+ } catch (Exception e) {
+ logger.error("problem handling addition of observer", e);
+ }
+ }
+
+ @Override
+ public List<Observer<RegistryChoiceMessage>> getObservers() {
+ return observers;
+ }
+
+ @Override
+ public void removeObserver(Observer<RegistryChoiceMessage> observer) {
+ observers.remove(observer);
+ }
+
+ public Registry getChosenRegistry() {
+ if (registryBox.getSelectedIndex() < 0)
+ return null;
+ return registryMap.get(registryBox.getSelectedItem());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SearchChoicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SearchChoicePanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SearchChoicePanel.java
new file mode 100644
index 0000000..f26cf6b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SearchChoicePanel.java
@@ -0,0 +1,259 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class SearchChoicePanel extends JPanel {
+ private static final Logger logger = getLogger(SearchChoicePanel.class);
+ private static final String SEARCHING = "Searching...";
+ private static final String[] SEARCHING_ARRAY = new String[] { SEARCHING };
+ private static final String NO_MATCHES = "No matches";
+ private static final String SEARCH_FAILED = "Search failed";
+ private static final List<String> RESERVED_WORDS = Arrays.asList(SEARCHING,
+ NO_MATCHES, SEARCH_FAILED);
+
+ private ComponentPreference preference;//FIXME beaninject from constructor
+ private ComponentFactory factory;//FIXME beaninject from constructor
+ private Registry registry;
+ private String prefixes;
+ private String queryText;
+ private JLabel registryURLLabel;
+ private JComboBox<String> familyBox;
+ private JComboBox<String> componentBox;
+ private JComboBox<Object> versionBox;
+
+ public SearchChoicePanel(Registry registry, String prefixes,
+ String queryText) {
+ super(new GridBagLayout());
+ this.registry = registry;
+ this.prefixes = prefixes;
+ this.queryText = queryText;
+
+ componentBox = new JComboBox<>(SEARCHING_ARRAY);
+ componentBox.setPrototypeDisplayValue(LONG_STRING);
+ familyBox = new JComboBox<>(SEARCHING_ARRAY);
+ familyBox.setPrototypeDisplayValue(LONG_STRING);
+ versionBox = new JComboBox<Object>(SEARCHING_ARRAY);
+ versionBox.setPrototypeDisplayValue(LONG_STRING);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ JLabel registryLabel = new JLabel("Component registry:");
+
+ gbc.insets.left = 5;
+ gbc.insets.right = 5;
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1;
+ gbc.gridy++;
+ this.add(registryLabel, gbc);
+ gbc.gridx = 1;
+ registryURLLabel = new JLabel(SEARCHING);
+ this.add(registryURLLabel, gbc);
+ gbc.gridx = 0;
+ gbc.gridy++;
+ this.add(new JLabel("Component family:"), gbc);
+ gbc.gridx = 1;
+
+ this.add(familyBox, gbc);
+ gbc.gridx = 0;
+ gbc.gridy++;
+ this.add(new JLabel("Component:"), gbc);
+ gbc.gridx = 1;
+ this.add(componentBox, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy++;
+
+ this.add(new JLabel("Component version:"), gbc);
+ gbc.gridx = 1;
+ this.add(versionBox, gbc);
+
+ new Searcher().execute();
+ }
+
+ private class Searcher extends SwingWorker<Set<Version.ID>, Object> {
+ @Override
+ protected Set<Version.ID> doInBackground() throws Exception {
+ return registry.searchForComponents(prefixes, queryText);
+ }
+
+ @Override
+ protected void done() {
+ clearAll();
+ try {
+ Set<Version.ID> matches = get();
+ if (matches.isEmpty())
+ setAll(NO_MATCHES);
+ else
+ searchCompletedSuccessfully(matches);
+ } catch (InterruptedException e) {
+ logger.error("search was interrupted", e);
+ setAll(SEARCH_FAILED);
+ } catch (ExecutionException e) {
+ logger.error("problem in execution", e.getCause());
+ setAll(SEARCH_FAILED);
+ }
+ }
+ }
+
+ private void clearAll() {
+ familyBox.removeAllItems();
+ componentBox.removeAllItems();
+ versionBox.removeAllItems();
+ }
+
+ private void setAll(String text) {
+ registryURLLabel.setText(text);
+ familyBox.addItem(text);
+ componentBox.addItem(text);
+ versionBox.addItem(text);
+ }
+
+ private String[] calculateMatchingFamilyNames(
+ Set<Version.ID> matchingComponents) {
+ Set<String> result = new TreeSet<>();
+ for (Version.ID v : matchingComponents)
+ result.add(v.getFamilyName());
+ return result.toArray(new String[0]);
+ }
+
+ private void updateComponentBox(Set<Version.ID> matchingComponents,
+ JComboBox<String> componentBox, String selectedItem) {
+ componentBox.removeAllItems();
+ String[] matchingComponentNames = calculateMatchingComponentNames(
+ matchingComponents, selectedItem);
+ for (String componentName : matchingComponentNames)
+ componentBox.addItem(componentName);
+ componentBox.setSelectedIndex(0);
+ }
+
+ private String[] calculateMatchingComponentNames(
+ Set<Version.ID> matchingComponents, String familyName) {
+ Set<String> result = new TreeSet<>();
+ for (Version.ID v : matchingComponents)
+ if (v.getFamilyName().equals(familyName))
+ result.add(v.getComponentName());
+ return result.toArray(new String[0]);
+ }
+
+ private void updateVersionBox(Set<Version.ID> matchingComponents,
+ JComboBox<Object> versionBox, String componentName,
+ String familyName) {
+ versionBox.removeAllItems();
+ for (Integer v : calculateMatchingVersionNumbers(matchingComponents,
+ componentName, familyName))
+ versionBox.addItem(v);
+ versionBox.setSelectedIndex(0);
+ }
+
+ private Integer[] calculateMatchingVersionNumbers(
+ Set<Version.ID> matchingComponents, String componentName,
+ String familyName) {
+ Set<Integer> result = new TreeSet<>();
+ for (Version.ID v : matchingComponents)
+ if (v.getFamilyName().equals(familyName)
+ && v.getComponentName().equals(componentName))
+ result.add(v.getComponentVersion());
+ return result.toArray(new Integer[0]);
+ }
+
+ public Version.ID getVersionIdentification() {
+ String registryString = registryURLLabel.getText();
+ if (RESERVED_WORDS.contains(registryString))
+ return null;
+
+ try {
+ return factory.getVersion(registry.getRegistryBase(),
+ (String) familyBox.getSelectedItem(),
+ (String) componentBox.getSelectedItem(),
+ (Integer) versionBox.getSelectedItem()).getID();
+ } catch (ComponentException e) {
+ logger.warn(
+ "unexpected failure to construct component version token",
+ e);
+ return null;
+ }
+ }
+
+ private void searchCompletedSuccessfully(final Set<Version.ID> matches) {
+ Version.ID one = (Version.ID) matches.toArray()[0];
+ registryURLLabel.setText(preference.getRegistryName(one
+ .getRegistryBase()));
+ for (String familyName : calculateMatchingFamilyNames(matches))
+ familyBox.addItem(familyName);
+ familyBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == SELECTED)
+ updateComponentBox(matches, componentBox,
+ (String) familyBox.getSelectedItem());
+ }
+ });
+ componentBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == SELECTED)
+ updateVersionBox(matches, versionBox,
+ (String) componentBox.getSelectedItem(),
+ (String) familyBox.getSelectedItem());
+ }
+ });
+ familyBox.setSelectedIndex(0);
+ updateComponentBox(matches, componentBox,
+ (String) familyBox.getSelectedItem());
+ updateVersionBox(matches, versionBox,
+ (String) componentBox.getSelectedItem(),
+ (String) familyBox.getSelectedItem());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SharingPolicyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SharingPolicyChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SharingPolicyChooserPanel.java
new file mode 100644
index 0000000..3625a84
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/SharingPolicyChooserPanel.java
@@ -0,0 +1,157 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class SharingPolicyChooserPanel extends JPanel {
+ private static final String SHARING_LABEL = "Sharing policy:";
+ private static final String READING_MSG = "Reading sharing policies";
+ private static final String NO_PERMISSIONS_MSG = "No permissions available";
+ private static final long serialVersionUID = 2175274929391537032L;
+ private static final Logger logger = getLogger(SharingPolicyChooserPanel.class);
+
+ private final JComboBox<String> permissionBox = new JComboBox<>();
+ private final SortedMap<String, SharingPolicy> permissionMap = new TreeMap<>();
+ private Registry registry;
+
+ public SharingPolicyChooserPanel(RegistryChooserPanel registryPanel) {
+ this();
+ registryPanel.addObserver(new Observer<RegistryChoiceMessage>(){
+ @Override
+ public void notify(Observable<RegistryChoiceMessage> sender,
+ RegistryChoiceMessage message) throws Exception {
+ try {
+ registry = message.getChosenRegistry();
+ updateProfileModel();
+ } catch (Exception e) {
+ logger.error("problem when handling notification of registry", e);
+ }
+ }
+ });
+ }
+ public SharingPolicyChooserPanel() {
+ super();
+ permissionBox.setPrototypeDisplayValue(LONG_STRING);
+ this.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = NONE;
+ this.add(new JLabel(SHARING_LABEL), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = BOTH;
+ this.add(permissionBox, gbc);
+
+ permissionBox.setEditable(false);
+ }
+
+ private void updateProfileModel() {
+ permissionMap.clear();
+ permissionBox.removeAllItems();
+ permissionBox.addItem(READING_MSG);
+ permissionBox.setEnabled(false);
+ new SharingPolicyUpdater().execute();
+ }
+
+ public SharingPolicy getChosenPermission() {
+ if (permissionBox.getSelectedIndex() < 0)
+ return null;
+ return permissionMap.get(permissionBox.getSelectedItem());
+ }
+
+ private class SharingPolicyUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ List<SharingPolicy> sharingPolicies;
+ if (registry == null)
+ return null;
+ try {
+ sharingPolicies = registry.getPermissions();
+ if (sharingPolicies == null)
+ return null;
+ } catch (ComponentException e) {
+ logger.error("problem getting permissions", e);
+ throw e;
+ } catch (NullPointerException e) {
+ logger.error("null pointer getting permissions", e);
+ throw e;
+ }
+
+ for (SharingPolicy policy : sharingPolicies)
+ try {
+ permissionMap.put(policy.getName(), policy);
+ } catch (NullPointerException e) {
+ logger.error("problem getting name of policy", e);
+ }
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ permissionBox.removeAllItems();
+ try {
+ get();
+ for (String name : permissionMap.keySet())
+ permissionBox.addItem(name);
+ if (!permissionMap.isEmpty()) {
+ String firstKey = permissionMap.firstKey();
+ permissionBox.setSelectedItem(firstKey);
+ } else {
+ permissionBox.addItem(NO_PERMISSIONS_MSG);
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ logger.error(e);
+ permissionBox.addItem("Unable to read permissions");
+ }
+ permissionBox.setEnabled(!permissionMap.isEmpty());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentDefaults.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentDefaults.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentDefaults.java
new file mode 100644
index 0000000..faad899
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentDefaults.java
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.preference;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * Factored out defaults location system.
+ *
+ * @author Donal Fellows
+ */
+public class ComponentDefaults {
+ public static final String REGISTRY_LIST = "REGISTRY_NAMES";
+ private static final String LOCAL_NAME = "local registry";
+ private static final String MYEXPERIMENT_NAME = "myExperiment";
+ private static final String MYEXPERIMENT_SITE = "http://www.myexperiment.org";
+ public static final String DEFAULT_REGISTRY_LIST = LOCAL_NAME + "," + MYEXPERIMENT_NAME;
+
+ public static Map<String, String> getDefaultProperties() {
+ // Capacity = 3; we know that this is going to have 3 entries
+ Map<String, String> defaults = new LinkedHashMap<>(3);
+ defaults.put(LOCAL_NAME, calculateComponentsDirectoryPath());
+ defaults.put(MYEXPERIMENT_NAME, MYEXPERIMENT_SITE);
+ defaults.put(REGISTRY_LIST, DEFAULT_REGISTRY_LIST);
+ return defaults;
+ }
+
+ static ApplicationConfiguration config;//FIXME beaninject (and beanify!)
+
+ public static String calculateComponentsDirectoryPath() {
+ return new File(config.getApplicationHomeDir(), "components").toURI()
+ .toASCIIString();
+ }
+
+ private ComponentDefaults() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreference.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreference.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreference.java
new file mode 100644
index 0000000..b7ff333
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreference.java
@@ -0,0 +1,143 @@
+/*
+* 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 io.github.taverna_extras.component.ui.preference;
+
+import static org.apache.commons.lang.StringUtils.join;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.REGISTRY_LIST;
+import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.getDefaultProperties;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import org.apache.taverna.configuration.AbstractConfigurable;
+import org.apache.taverna.configuration.ConfigurationManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentPreference extends AbstractConfigurable {
+ public static final String DISPLAY_NAME = "Components";
+ private final Logger logger = getLogger(ComponentPreference.class);
+
+ private SortedMap<String, Registry> registryMap = new TreeMap<>();
+ private ComponentFactory factory;
+
+ public ComponentPreference(ConfigurationManager cm, ComponentFactory factory) {
+ super(cm);
+ this.factory = factory;
+ updateRegistryMap();
+ }
+
+ private void updateRegistryMap() {
+ registryMap.clear();
+
+ for (String key : getRegistryKeys()) {
+ String value = super.getProperty(key);
+ try {
+ registryMap.put(key, factory.getRegistry(new URL(
+ value)));
+ } catch (MalformedURLException e) {
+ logger.error("bogus url (" + value
+ + ") in configuration file", e);
+ } catch (ComponentException e) {
+ logger.error("failed to construct registry handle for "
+ + value, e);
+ }
+ }
+ }
+
+ private String[] getRegistryKeys() {
+ String registryNamesConcatenated = super.getProperty(REGISTRY_LIST);
+ if (registryNamesConcatenated == null)
+ return getDefaultPropertyMap().keySet().toArray(new String[]{});
+ return registryNamesConcatenated.split(",");
+ }
+
+ @Override
+ public String getFilePrefix() {
+ return "Component";
+ }
+
+ @Override
+ public String getUUID() {
+ return "2317A297-2AE0-42B5-86DC-99C9B7C0524A";
+ }
+
+ /**
+ * @return the registryMap
+ */
+ public SortedMap<String, Registry> getRegistryMap() {
+ return registryMap;
+ }
+
+ public String getRegistryName(URL registryBase) {
+ // Trim trailing '/' characters to ensure match.
+ String base = registryBase.toString();
+ while (base.endsWith("/"))
+ base = base.substring(0, base.length() - 1);
+
+ for (Entry<String, Registry> entry : registryMap.entrySet())
+ if (entry.getValue().getRegistryBaseString().equals(base))
+ return entry.getKey();
+ return base;
+ }
+
+ public void setRegistryMap(SortedMap<String, Registry> registries) {
+ registryMap.clear();
+ registryMap.putAll(registries);
+ super.clear();
+ List<String> keyList = new ArrayList<>();
+ for (Entry<String, Registry> entry : registryMap.entrySet()) {
+ String key = entry.getKey();
+ keyList.add(key);
+ super.setProperty(key, entry.getValue().getRegistryBaseString());
+ }
+ Collections.sort(keyList);
+ String registryNamesConcatenated = join(keyList, ",");
+ super.setProperty(REGISTRY_LIST, registryNamesConcatenated);
+ }
+
+ @Override
+ public Map<String, String> getDefaultPropertyMap() {
+ return getDefaultProperties();
+ }
+
+ @Override
+ public String getDisplayName() {
+ return DISPLAY_NAME;
+ }
+
+ @Override
+ public String getCategory() {
+ return "general";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferencePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferencePanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferencePanel.java
new file mode 100644
index 0000000..4677c0c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferencePanel.java
@@ -0,0 +1,300 @@
+/*
+* 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 io.github.taverna_extras.component.ui.preference;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN;
+import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.URL_PATTERN;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.awt.event.MouseEvent;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.helper.Helper;
+
+public class ComponentPreferencePanel extends JPanel {
+ private static final String BAD_URL_MESSAGE = "Invalid URL";
+ private static final String SET_URL_MESSAGE = "Set the URL of the profile";
+ private static final String HELP_LABEL = "Help";
+ private static final String RESET_LABEL = "Reset";
+ private static final String APPLY_LABEL = "Apply";
+ private static final String ADD_REMOTE_TITLE = "Add Remote Component Registry";
+ private static final String ADD_LOCAL_TITLE = "Add Local Component Registry";
+ private static final String ADD_REMOTE_LABEL = "Add remote registry";
+ private static final String ADD_LOCAL_LABEL = "Add local registry";
+ private static final String REMOVE_LABEL = "Remove registry";
+ private static final String TITLE = "Component registry management";
+ private static final String VALIDATION_MESSAGE = "Set the registry name";
+ private static final String EXCEPTION_MESSAGE = "Unable to access registry at ";
+ private static final String EXCEPTION_TITLE = "Component registry problem";
+ private static final String INVALID_NAME = "Invalid registry name";
+ private static final String DUPLICATE = "Duplicate registry name";
+ private static final long serialVersionUID = 1310173658718093383L;
+
+ private final Logger logger = getLogger(ComponentPreferencePanel.class);
+
+ private ComponentFactory factory;
+ private ComponentPreference prefs;
+ private RegistryTableModel tableModel = new RegistryTableModel();
+
+ @SuppressWarnings("serial")
+ private JTable registryTable = new JTable(tableModel) {
+ @Override
+ public String getToolTipText(MouseEvent me) {
+ int row = rowAtPoint(me.getPoint());
+ if (row >= 0)
+ return tableModel.getRowTooltipText(row);
+ return super.getToolTipText(me);
+ }
+ };
+
+ public ComponentPreferencePanel(ComponentFactory componentFactory,
+ ComponentPreference preferences) {
+ super(new GridBagLayout());
+ factory = componentFactory;
+ prefs = preferences;
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ // Title describing what kind of settings we are configuring here
+ JTextArea descriptionText = new JTextArea(TITLE);
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+ gbc.anchor = WEST;
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.gridwidth = 1;
+ gbc.weightx = 1.0;
+ gbc.weighty = 0.0;
+ gbc.fill = HORIZONTAL;
+ add(descriptionText, gbc);
+
+ gbc.gridy++;
+ gbc.insets = new Insets(10, 0, 0, 0);
+
+ registryTable.getColumnModel().getColumn(0).setPreferredWidth(20);
+ registryTable.setAutoResizeMode(AUTO_RESIZE_LAST_COLUMN);
+ registryTable.setSelectionMode(SINGLE_SELECTION);
+ JScrollPane scrollPane = new JScrollPane(registryTable);
+ // registryTable.setFillsViewportHeight(true);
+
+ gbc.weighty = 1.0;
+ gbc.fill = BOTH;
+
+ add(scrollPane, gbc);
+
+ // Add buttons panel
+ gbc.gridx = 0;
+ gbc.gridy++;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.gridwidth = 1;
+ gbc.fill = HORIZONTAL;
+ gbc.anchor = CENTER;
+ gbc.insets = new Insets(10, 0, 0, 0);
+ add(createRegistryButtonPanel(), gbc);
+
+ // Add buttons panel
+ gbc.gridx = 0;
+ gbc.gridy++;
+ gbc.weightx = 0.0;
+ gbc.weighty = 0.0;
+ gbc.gridwidth = 1;
+ gbc.fill = HORIZONTAL;
+ gbc.anchor = CENTER;
+ gbc.insets = new Insets(10, 0, 0, 0);
+ add(createButtonPanel(), gbc);
+
+ setFields();
+ }
+
+ /**
+ * Create the buttons for managing the list of registries.
+ * @return
+ */
+ @SuppressWarnings("serial")
+ private Component createRegistryButtonPanel() {
+ JPanel panel = new JPanel();
+ panel.add(new DeselectingButton(new AbstractAction(REMOVE_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ remove();
+ }
+ }));
+ panel.add(new DeselectingButton(new AbstractAction(ADD_LOCAL_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ addLocal();
+ }
+ }));
+ panel.add(new DeselectingButton(new AbstractAction(ADD_REMOTE_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ addRemote();
+ }
+ }));
+ return panel;
+ }
+
+ /**
+ * Create the panel to contain the buttons
+ *
+ * @return
+ */
+ @SuppressWarnings("serial")
+ private JPanel createButtonPanel() {
+ final JPanel panel = new JPanel();
+ panel.add(new DeselectingButton(new AbstractAction(HELP_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ Helper.showHelp(panel);
+ }
+ }));
+ panel.add(new DeselectingButton(new AbstractAction(RESET_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ setFields();
+ }
+ }));
+ panel.add(new DeselectingButton(new AbstractAction(APPLY_LABEL) {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ applySettings();
+ setFields();
+ }
+ }));
+ return panel;
+ }
+
+ void remove() {
+ int selectedRow = registryTable.getSelectedRow();
+ if (selectedRow != -1)
+ tableModel.removeRow(selectedRow);
+ }
+
+ void addLocal() {
+ // Run the GUI
+ LocalRegistryPanel inputPanel = new LocalRegistryPanel();
+ ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+ ADD_LOCAL_TITLE, inputPanel);
+ vuid.addTextComponentValidation(inputPanel.getRegistryNameField(),
+ VALIDATION_MESSAGE, tableModel.getRegistryMap().keySet(),
+ DUPLICATE, "[\\p{L}\\p{Digit}_.]+", INVALID_NAME);
+ vuid.setSize(new Dimension(400, 250));
+ if (!vuid.show(ComponentPreferencePanel.this))
+ return;
+
+ // Add the local registry
+ String location = inputPanel.getLocationField().getText();
+ File newDir = new File(location);
+ try {
+ tableModel.insertRegistry(inputPanel.getRegistryNameField()
+ .getText(), getLocalRegistry(newDir));
+ } catch (MalformedURLException e) {
+ logger.error("bad url provided by user", e);
+ showMessageDialog(null, EXCEPTION_MESSAGE + location,
+ EXCEPTION_TITLE, ERROR_MESSAGE);
+ } catch (ComponentException e) {
+ logger.error("problem creating local registry", e);
+ showMessageDialog(null, EXCEPTION_MESSAGE + location,
+ EXCEPTION_TITLE, ERROR_MESSAGE);
+ }
+ }
+
+ void addRemote() {
+ RemoteRegistryPanel inputPanel = new RemoteRegistryPanel();
+ ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+ ADD_REMOTE_TITLE, inputPanel);
+ vuid.addTextComponentValidation(inputPanel.getRegistryNameField(),
+ VALIDATION_MESSAGE, tableModel.getRegistryMap().keySet(),
+ DUPLICATE, "[\\p{L}\\p{Digit}_.]+", INVALID_NAME);
+ vuid.addTextComponentValidation(inputPanel.getLocationField(),
+ SET_URL_MESSAGE, null, "", URL_PATTERN, BAD_URL_MESSAGE);
+ vuid.setSize(new Dimension(400, 250));
+ if (!vuid.show(ComponentPreferencePanel.this))
+ return;
+
+ String location = inputPanel.getLocationField().getText();
+ try {
+ tableModel.insertRegistry(inputPanel.getRegistryNameField()
+ .getText(), getRemoteRegistry(location));
+ } catch (MalformedURLException e) {
+ logger.error("bad url provided by user", e);
+ showMessageDialog(null, EXCEPTION_MESSAGE + location,
+ EXCEPTION_TITLE, ERROR_MESSAGE);
+ } catch (ComponentException e) {
+ showMessageDialog(null, EXCEPTION_MESSAGE + location,
+ EXCEPTION_TITLE, ERROR_MESSAGE);
+ logger.error("problem creating remote registry", e);
+ }
+ }
+
+ Registry getLocalRegistry(File location) throws ComponentException,
+ MalformedURLException {
+ return factory.getRegistry(location.toURI().toURL());
+ }
+
+ Registry getRemoteRegistry(String location) throws MalformedURLException,
+ ComponentException {
+ URL url = new URL(location);
+ if (url.getProtocol() == null || url.getProtocol().equals("file"))
+ throw new MalformedURLException(
+ "may not use relative or local URLs for locating registry");
+ return factory.getRegistry(url);
+ }
+
+ private void applySettings() {
+ prefs.setRegistryMap(tableModel.getRegistryMap());
+ }
+
+ private void setFields() {
+ tableModel.setRegistryMap(prefs.getRegistryMap());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferenceUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferenceUIFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferenceUIFactory.java
new file mode 100644
index 0000000..03ae030
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/ComponentPreferenceUIFactory.java
@@ -0,0 +1,61 @@
+/*
+* 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 io.github.taverna_extras.component.ui.preference;
+
+import javax.swing.JPanel;
+import org.apache.taverna.configuration.Configurable;
+import org.apache.taverna.configuration.ConfigurationUIFactory;
+
+/**
+ * @author alanrw
+ */
+public class ComponentPreferenceUIFactory implements ConfigurationUIFactory {
+ public static final String DISPLAY_NAME = "Components";
+
+ private JPanel configPanel;//FIXME beaninject
+ private ComponentPreference prefs;// FIXME beaninject
+
+ public ComponentPreferenceUIFactory() {
+ super();
+ }
+
+ public void setConfigPanel(JPanel configPanel) {
+ this.configPanel = configPanel;
+ }
+
+ public void setPreferences(ComponentPreference pref) {
+ this.prefs = pref;
+ }
+
+ @Override
+ public boolean canHandle(String uuid) {
+ return uuid.equals(prefs.getUUID());
+ }
+
+ @Override
+ public Configurable getConfigurable() {
+ return prefs;
+ }
+
+ @Override
+ public JPanel getConfigurationPanel() {
+ return configPanel;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/LocalRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/LocalRegistryPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/LocalRegistryPanel.java
new file mode 100644
index 0000000..b9ba05e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/LocalRegistryPanel.java
@@ -0,0 +1,132 @@
+/*
+* 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 io.github.taverna_extras.component.ui.preference;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JFileChooser.DIRECTORIES_ONLY;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author alanrw
+ *
+ */
+public class LocalRegistryPanel extends JPanel {
+ private static final String BROWSE_LABEL = "Browse";
+ private static final String LOCATION_LABEL = "Location:";
+ private static final String NAME_LABEL = "Name:";
+ private static final long serialVersionUID = 732945735813617327L;
+
+ private final Logger logger = getLogger(LocalRegistryPanel.class);
+
+ private JTextField registryNameField = new JTextField(20);
+ private JTextField locationField = new JTextField(20);
+
+ public LocalRegistryPanel() {
+ super(new GridBagLayout());
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 20;
+ add(new JLabel(NAME_LABEL), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = HORIZONTAL;
+ add(registryNameField, constraints);
+
+ constraints.gridy++;
+ constraints.gridx = 0;
+ constraints.ipadx = 20;
+ constraints.fill = NONE;
+ add(new JLabel(LOCATION_LABEL), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = HORIZONTAL;
+ add(locationField, constraints);
+
+ constraints.gridy++;
+ constraints.gridx = 0;
+ constraints.ipadx = 20;
+ constraints.fill = NONE;
+ add(new DeselectingButton(new AbstractAction(BROWSE_LABEL) {
+ private static final long serialVersionUID = -8676803966947261009L;
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ pickDirectory();
+ }
+ }), constraints);
+ }
+
+ private void pickDirectory() {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setFileSelectionMode(DIRECTORIES_ONLY);
+ int returnVal = chooser.showOpenDialog(LocalRegistryPanel.this);
+ try {
+ if (returnVal == APPROVE_OPTION)
+ locationField.setText(chooser.getSelectedFile()
+ .getCanonicalPath());
+ } catch (IOException e) {
+ logger.error("unexpected filesystem problem", e);
+ }
+ }
+
+ /**
+ * @return the registryNameField
+ */
+ public JTextField getRegistryNameField() {
+ return registryNameField;
+ }
+
+ /**
+ * @return the locationField
+ */
+ public JTextField getLocationField() {
+ return locationField;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RegistryTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RegistryTableModel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RegistryTableModel.java
new file mode 100644
index 0000000..c3b5f04
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RegistryTableModel.java
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.preference;
+
+import static java.lang.String.format;
+
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import javax.swing.table.DefaultTableModel;
+
+import io.github.taverna_extras.component.api.Registry;
+
+/**
+ * @author alanrw
+ *
+ */
+public class RegistryTableModel extends DefaultTableModel {
+ private static final long serialVersionUID = -7789666945764974370L;
+ private SortedMap<String, Registry> registryMap = new TreeMap<String, Registry>();
+
+ public RegistryTableModel() {
+ super(new String[] { "Registry name", "Registry location" }, 0);
+ }
+
+ public void setRegistryMap(SortedMap<String, Registry> registries) {
+ registryMap.clear();
+ registryMap.putAll(registries);
+ updateRows();
+ }
+
+ public void updateRows() {
+ super.setRowCount(0);
+ for (Entry<String, Registry> entry : registryMap.entrySet())
+ super.addRow(new Object[] { entry.getKey(),
+ entry.getValue().getRegistryBaseString() });
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ return false;
+ }
+
+ public String getRowTooltipText(int row) {
+ Registry registry = registryMap.get(getValueAt(row, 0));
+ return format("This is a %s registry.", registry.getRegistryTypeName());
+ }
+
+ @Override
+ public void removeRow(int row) {
+ String key = (String) getValueAt(row, 0);
+ registryMap.remove(key);
+ super.removeRow(row);
+ }
+
+ public void insertRegistry(String name, Registry newRegistry) {
+ registryMap.put(name, newRegistry);
+ updateRows();
+ }
+
+ /**
+ * @return the registryMap
+ */
+ public SortedMap<String, Registry> getRegistryMap() {
+ return registryMap;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RemoteRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RemoteRegistryPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RemoteRegistryPanel.java
new file mode 100644
index 0000000..1f98933
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/preference/RemoteRegistryPanel.java
@@ -0,0 +1,94 @@
+/*
+* 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 io.github.taverna_extras.component.ui.preference;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * @author alanrw
+ *
+ */
+public class RemoteRegistryPanel extends JPanel {
+ private static final String LOCATION_LABEL = "Location:";
+ private static final String NAME_LABEL = "Name:";
+ private static final long serialVersionUID = 8833815753329010062L;
+
+ private JTextField registryNameField = new JTextField(20);
+ private JTextField locationField = new JTextField(20);
+
+ public RemoteRegistryPanel() {
+ super(new GridBagLayout());
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 20;
+ add(new JLabel(NAME_LABEL), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = HORIZONTAL;
+ add(registryNameField, constraints);
+
+ constraints.gridy++;
+ constraints.gridx = 0;
+ constraints.ipadx = 20;
+ constraints.fill = NONE;
+ add(new JLabel(LOCATION_LABEL), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = HORIZONTAL;
+ add(locationField, constraints);
+ }
+
+ /**
+ * @return the registryNameField
+ */
+ public JTextField getRegistryNameField() {
+ return registryNameField;
+ }
+
+ /**
+ * @return the locationField
+ */
+ public JTextField getLocationField() {
+ return locationField;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceDesc.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceDesc.java
new file mode 100644
index 0000000..03b2eda
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceDesc.java
@@ -0,0 +1,174 @@
+/*
+* 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 io.github.taverna_extras.component.ui.serviceprovider;
+
+import static java.util.Arrays.asList;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+
+public class ComponentServiceDesc extends ServiceDescription {
+ private static Logger logger = getLogger(ComponentServiceDesc.class);
+
+ private Version.ID identification;
+ private final ComponentPreference preference;
+ private final ComponentFactory factory;
+ private final ComponentServiceIcon iconProvider;
+
+ public ComponentServiceDesc(ComponentPreference preference,
+ ComponentFactory factory, ComponentServiceIcon iconProvider,
+ Version.ID identification) {
+ this.preference = preference;
+ this.factory = factory;
+ this.identification = identification;
+ this.iconProvider = iconProvider;
+ }
+
+ /**
+ * The configuration bean which is to be used for configuring the
+ * instantiated activity. This is built from the component identifier.
+ */
+ @Override
+ public Configuration getActivityConfiguration() {
+ Configuration config = new Configuration();
+ installActivityConfiguration(config);
+ return config;
+ }
+
+ /**
+ * Make the given activity be configured to be using the component that this
+ * class identifies.
+ */
+ public void installActivityConfiguration(Activity activity) {
+ installActivityConfiguration(activity.getConfiguration());
+ }
+
+ /**
+ * Update the given configuration to have the fields for the component that
+ * this class identifies.
+ */
+ public void installActivityConfiguration(Configuration config) {
+ ObjectNode c = config.getJsonAsObjectNode();
+ ID id = getIdentification();
+ c.put(REGISTRY_BASE, id.getRegistryBase().toExternalForm());
+ c.put(FAMILY_NAME, id.getFamilyName());
+ c.put(COMPONENT_NAME, id.getComponentName());
+ c.put(COMPONENT_VERSION, id.getComponentVersion());
+ config.setJson(c);
+ }
+
+ /**
+ * An icon to represent this service description in the service palette.
+ */
+ @Override
+ public Icon getIcon() {
+ return iconProvider.getIcon();
+ }
+
+ /**
+ * The display name that will be shown in service palette and will be used
+ * as a template for processor name when added to workflow.
+ */
+ @Override
+ public String getName() {
+ return getIdentification().getComponentName();
+ }
+
+ /**
+ * The path to this service description in the service palette. Folders will
+ * be created for each element of the returned path.
+ */
+ @Override
+ public List<String> getPath() {
+ return asList("Components",
+ preference.getRegistryName(identification.getRegistryBase()),
+ identification.getFamilyName());
+ }
+
+ /**
+ * Returns a list of data values uniquely identifying this component
+ * description (i.e., no duplicates).
+ */
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ return Arrays.asList(identification.getRegistryBase(),
+ identification.getFamilyName(),
+ identification.getComponentName());
+ }
+
+ @Override
+ public String toString() {
+ return "Component " + getName();
+ }
+
+ /**
+ * @return the identification
+ */
+ public Version.ID getIdentification() {
+ return identification;
+ }
+
+ /**
+ * @param identification
+ * the identification to set
+ */
+ public void setIdentification(Version.ID identification) {
+ this.identification = identification;
+ }
+
+ public URL getHelpURL() {
+ try {
+ return factory.getVersion(getIdentification()).getHelpURL();
+ } catch (ComponentException e) {
+ logger.error(
+ "failed to get component in order to determine its help URL",
+ e);
+ return null;
+ }
+ }
+
+ @Override
+ public URI getActivityType() {
+ return ACTIVITY_URI;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceIcon.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceIcon.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceIcon.java
new file mode 100644
index 0000000..16e0d5f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceIcon.java
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.serviceprovider;
+
+import static io.github.taverna_extras.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+public class ComponentServiceIcon implements ActivityIconSPI {
+ private static class Init {
+ private static Icon icon = new ImageIcon(
+ ComponentServiceIcon.class.getResource("/brick.png"));
+ }
+
+ @Override
+ public int canProvideIconScore(URI activityType) {
+ if (activityType.equals(COMPONENT_ACTIVITY_URI))
+ return DEFAULT_ICON + 1;
+ return NO_ICON;
+ }
+
+ @Override
+ public Icon getIcon(URI activityType) {
+ return Init.icon;
+ }
+
+ public Icon getIcon() {
+ return Init.icon;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProvider.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProvider.java
new file mode 100644
index 0000000..d5350d0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProvider.java
@@ -0,0 +1,236 @@
+/*
+* 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 io.github.taverna_extras.component.ui.serviceprovider;
+
+import static java.util.Arrays.asList;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+
+import javax.swing.Icon;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.taverna.servicedescriptions.AbstractConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ComponentServiceProvider extends
+ AbstractConfigurableServiceProvider implements
+ CustomizedConfigurePanelProvider {
+ static final URI providerId = URI
+ .create("http://taverna.sf.net/2012/service-provider/component");
+ private static Logger logger = getLogger(ComponentServiceProvider.class);
+
+ private final ComponentFactory factory;
+ private final ComponentPreference prefs;
+ private final ComponentServiceIcon iconProvider;
+ private final Utils utils;
+
+ public ComponentServiceProvider(ComponentFactory factory,
+ ComponentPreference prefs, ComponentServiceIcon iconProvider,
+ Utils utils) {
+ super(makeConfig(null, null));
+ this.factory = factory;
+ this.prefs = prefs;
+ this.iconProvider = iconProvider;
+ this.utils = utils;
+ }
+
+ private static class Conf {
+ URL registryBase;
+ String familyName;
+
+ Conf(Configuration config) throws MalformedURLException {
+ ObjectNode node = config.getJsonAsObjectNode();
+ JsonNode item = node.get(REGISTRY_BASE);
+ if (item != null && !item.isNull())
+ registryBase = URI.create(item.textValue()).toURL();
+ item = node.get(FAMILY_NAME);
+ if (item != null && !item.isNull())
+ familyName = item.textValue();
+ }
+ }
+
+ /**
+ * Do the actual search for services. Return using the callBack parameter.
+ */
+ @Override
+ public void findServiceDescriptionsAsync(
+ FindServiceDescriptionsCallBack callBack) {
+ Conf config;
+
+ Registry registry;
+ try {
+ config = new Conf(getConfiguration());
+ registry = factory.getRegistry(config.registryBase);
+ } catch (ComponentException | MalformedURLException e) {
+ logger.error("failed to get registry API", e);
+ callBack.fail("Unable to read components", e);
+ return;
+ }
+
+ try {
+ List<ComponentServiceDesc> results = new ArrayList<>();
+ for (Family family : registry.getComponentFamilies()) {
+ // TODO get check on family name in there
+ if (family.getName().equals(config.familyName))
+ for (Component component : family.getComponents())
+ try {
+ SortedMap<Integer, Version> versions = component
+ .getComponentVersionMap();
+ ComponentServiceDesc newDesc = new ComponentServiceDesc(
+ prefs, factory, iconProvider, versions.get(
+ versions.lastKey()).getID());
+ results.add(newDesc);
+ } catch (Exception e) {
+ logger.error("problem getting service descriptor",
+ e);
+ }
+ callBack.partialResults(results);
+ callBack.finished();
+ }
+ } catch (ComponentException e) {
+ logger.error("problem querying registry", e);
+ callBack.fail("Unable to read components", e);
+ }
+ }
+
+ /**
+ * Icon for service provider
+ */
+ @Override
+ public Icon getIcon() {
+ return iconProvider.getIcon();
+ }
+
+ /**
+ * Name of service provider, appears in right click for 'Remove service
+ * provider'
+ */
+ @Override
+ public String getName() {
+ return "Component service";
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public String getId() {
+ return providerId.toASCIIString();
+ }
+
+ @Override
+ protected List<? extends Object> getIdentifyingData() {
+ try {
+ Conf config = new Conf(getConfiguration());
+ return asList(config.registryBase.toString(), config.familyName);
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void createCustomizedConfigurePanel(
+ CustomizedConfigureCallBack callBack) {
+ RegistryAndFamilyChooserPanel panel = new RegistryAndFamilyChooserPanel(prefs);
+
+ if (showConfirmDialog(null, panel, "Component family import",
+ OK_CANCEL_OPTION) != OK_OPTION)
+ return;
+
+ Registry registry = panel.getChosenRegistry();
+ Family family = panel.getChosenFamily();
+ if (registry == null || family == null)
+ return;
+ callBack.newProviderConfiguration(makeConfig(
+ registry.getRegistryBaseString(), family.getName()));
+ }
+
+ private static Configuration makeConfig(String registryUrl,
+ String familyName) {
+ ObjectNode cfg = JsonNodeFactory.instance.objectNode();
+ cfg.put(REGISTRY_BASE, registryUrl);
+ cfg.put(FAMILY_NAME, familyName);
+ Configuration conf = new Configuration();
+ conf.setJson(cfg);
+ conf.setType(providerId);
+ return conf;
+ }
+
+ @Override
+ public ServiceDescriptionProvider newInstance() {
+ return new ComponentServiceProvider(factory, prefs, iconProvider, utils);
+ }
+
+ @Override
+ public URI getType() {
+ return ACTIVITY_URI;
+ }
+
+ @Override
+ public void setType(URI type) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean accept(Visitor visitor) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void refreshProvidedComponent(Version.ID ident) {
+ try {
+ utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
+ ident).getConfiguration());
+ } catch (Exception e) {
+ logger.error("Unable to refresh service panel", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProviderConfig.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProviderConfig.java
new file mode 100644
index 0000000..72b7458
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/ComponentServiceProviderConfig.java
@@ -0,0 +1,88 @@
+/*
+* 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 io.github.taverna_extras.component.ui.serviceprovider;
+
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider.providerId;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public class ComponentServiceProviderConfig {
+ private URL registryBase;
+ private String familyName;
+
+ public ComponentServiceProviderConfig() {
+ }
+
+ public ComponentServiceProviderConfig(Family family) {
+ registryBase = family.getComponentRegistry().getRegistryBase();
+ familyName = family.getName();
+ }
+
+ public ComponentServiceProviderConfig(Version.ID ident) {
+ registryBase = ident.getRegistryBase();
+ familyName = ident.getFamilyName();
+ }
+
+ /**
+ * @return the registryBase
+ */
+ public URL getRegistryBase() {
+ return registryBase;
+ }
+
+ /**
+ * @param registryBase
+ * the registryBase to set
+ */
+ public void setRegistryBase(URL registryBase) {
+ this.registryBase = registryBase;
+ }
+
+ /**
+ * @return the familyName
+ */
+ public String getFamilyName() {
+ return familyName;
+ }
+
+ /**
+ * @param familyName
+ * the familyName to set
+ */
+ public void setFamilyName(String familyName) {
+ this.familyName = familyName;
+ }
+
+ public Configuration getConfiguration() {
+ Configuration c = new Configuration();
+ c.getJsonAsObjectNode().put(REGISTRY_BASE,
+ registryBase.toExternalForm());
+ c.getJsonAsObjectNode().put(FAMILY_NAME, familyName);
+ c.setType(providerId);
+ return c;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/Service.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/Service.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/Service.java
new file mode 100644
index 0000000..32c606e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/serviceprovider/Service.java
@@ -0,0 +1,27 @@
+/*
+* 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 io.github.taverna_extras.component.ui.serviceprovider;
+
+import java.net.URI;
+
+public interface Service {
+ URI COMPONENT_ACTIVITY_URI = URI
+ .create("http://ns.taverna.org.uk/2010/activity/component");
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentFileType.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentFileType.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentFileType.java
new file mode 100644
index 0000000..ba4801e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentFileType.java
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.util;
+
+import org.apache.taverna.workbench.file.FileType;
+
+/**
+ * The type of components.
+ *
+ * @author alanrw
+ */
+public class ComponentFileType extends FileType {
+ // TODO Change mimetype for sculf2?
+ static final String COMPONENT_MIMETYPE = "application/vnd.taverna.component";
+
+ private ComponentFileType() {
+ }
+
+ @Override
+ public String getDescription() {
+ return "Taverna component";
+ }
+
+ // Not really used
+ @Override
+ public String getExtension() {
+ return "component";
+ }
+
+ @Override
+ public String getMimeType() {
+ return COMPONENT_MIMETYPE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentHealthCheck.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentHealthCheck.java
new file mode 100644
index 0000000..a3585f4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/ComponentHealthCheck.java
@@ -0,0 +1,86 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.util;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Visitor;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor;
+import org.apache.taverna.visit.VisitKind;
+import org.apache.taverna.visit.VisitReport;
+
+public class ComponentHealthCheck extends VisitKind {
+ public static final int NO_PROBLEM = 0;
+ public static final int OUT_OF_DATE = 10;
+ public static final int NON_SHAREABLE = 20;
+ public static final int FAILS_PROFILE = 30;
+ private static Logger logger = getLogger(ComponentHealthCheck.class);
+ private static final String OUTDATED_MSG = "Component out of date";
+
+ private ComponentFactory factory;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public List<Object> checkForOutdatedComponents(WorkflowBundle bundle) {
+ UpgradeChecker uc = new UpgradeChecker();
+ bundle.accept(uc);
+ return uc.warnings;
+ }
+
+ private class UpgradeChecker extends DefaultDispatchingVisitor {
+ ComponentFactory factory;
+ List<Object> warnings = new ArrayList<>();
+
+ @Override
+ public void visitActivity(Activity activity) {
+ ComponentActivityConfigurationBean config = new ComponentActivityConfigurationBean(
+ activity.getConfiguration().getJson(), factory);
+ Version v;
+ try {
+ v = config.getVersion();
+ } catch (ComponentException e) {
+ logger.error("failed to get component description", e);
+ warnings.add(e);//FIXME Just putting the exception in here isn't good
+ return;
+ }
+ visitComponent(activity, v);
+ }
+ protected void visitComponent(Activity activity, Version version) {
+ int latest = version.getComponent().getComponentVersionMap().lastKey();
+ if (latest > version.getVersionNumber())
+ warnings.add(new VisitReport(ComponentHealthCheck.this,
+ activity, OUTDATED_MSG, OUT_OF_DATE,
+ VisitReport.Status.WARNING));
+ }
+ }
+}
[23/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
new file mode 100644
index 0000000..1052960
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
@@ -0,0 +1,58 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileCopyMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_PROFILE_COPY_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileCopy");
+
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+
+ public ComponentProfileCopyMenuAction() {
+ super(COMPONENT_PROFILE_SECTION, 250, COMPONENT_PROFILE_COPY_URI);
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentProfileCopyAction(prefs, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteAction.java
new file mode 100644
index 0000000..00f809d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteAction.java
@@ -0,0 +1,113 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.profile;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.border.TitledBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileDeleteAction extends AbstractAction {
+ private static final long serialVersionUID = -5697971204434020559L;
+ private static final Logger log = getLogger(ComponentProfileDeleteAction.class);
+ private static final String DELETE_PROFILE = "Delete profile...";
+
+ private final ComponentPreference prefs;
+
+ public ComponentProfileDeleteAction(ComponentPreference prefs,
+ ComponentServiceIcon icon) {
+ super(DELETE_PROFILE, icon.getIcon());
+ // FIXME Should we switch this on?
+ setEnabled(false);
+ this.prefs = prefs;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ JPanel overallPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
+ registryPanel.setBorder(new TitledBorder("Registry"));
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(registryPanel, gbc);
+
+ ProfileChooserPanel profilePanel = new ProfileChooserPanel(
+ registryPanel);
+ profilePanel.setBorder(new TitledBorder("Profile"));
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.weighty = 1;
+ overallPanel.add(profilePanel, gbc);
+
+ int answer = showConfirmDialog(null, overallPanel,
+ "Delete Component Profile", OK_CANCEL_OPTION);
+ try {
+ if (answer == OK_OPTION)
+ doDelete(profilePanel.getChosenProfile());
+ } catch (ComponentException e) {
+ log.error("failed to delete profile", e);
+ showMessageDialog(null,
+ "Unable to delete profile: " + e.getMessage(),
+ "Registry Exception", ERROR_MESSAGE);
+ }
+ }
+
+ private void doDelete(Profile profile) throws ComponentException {
+ if (profile == null) {
+ showMessageDialog(null, "Unable to determine profile",
+ "Component Profile Problem", ERROR_MESSAGE);
+ return;
+ }
+ profile.delete();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
new file mode 100644
index 0000000..be6e6d6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
@@ -0,0 +1,58 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileDeleteMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_PROFILE_DELETE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileDelete");
+
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+
+ public ComponentProfileDeleteMenuAction() {
+ super(COMPONENT_PROFILE_SECTION, 300, COMPONENT_PROFILE_DELETE_URI);
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentProfileDeleteAction(prefs, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportAction.java
new file mode 100644
index 0000000..d63133d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportAction.java
@@ -0,0 +1,181 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.filechooser.FileNameExtensionFilter;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileImportAction extends AbstractAction {
+ private static final long serialVersionUID = -3796754761286943970L;
+ private static final Logger log = getLogger(ComponentProfileImportAction.class);
+ private static final String IMPORT_PROFILE = "Import profile...";
+ private static final JFileChooser chooser = new JFileChooser();
+
+ private final ComponentFactory factory;
+ private final ComponentPreference prefs;
+
+ public ComponentProfileImportAction(ComponentFactory factory,
+ ComponentPreference prefs, ComponentServiceIcon icon) {
+ super(IMPORT_PROFILE, icon.getIcon());
+ this.factory = factory;
+ this.prefs = prefs;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ JPanel overallPanel = new JPanel();
+ overallPanel.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(registryPanel, gbc);
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.gridwidth = 1;
+ gbc.weightx = 0;
+ overallPanel.add(new JLabel("Profile URL or local file path:"), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ final JTextField profileLocation = new JTextField(30);
+ overallPanel.add(profileLocation, gbc);
+ gbc.gridx = 0;
+ gbc.weightx = 0;
+ gbc.gridy++;
+ JButton browseButton = new DeselectingButton(new AbstractAction(
+ "Browse") {
+ private static final long serialVersionUID = 1574330610799117697L;
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ FileNameExtensionFilter filter = new FileNameExtensionFilter(
+ "XML files", "xml");
+ chooser.setFileFilter(filter);
+ int returnVal = chooser.showOpenDialog(null);
+ if (returnVal == APPROVE_OPTION)
+ profileLocation.setText(chooser.getSelectedFile().toURI()
+ .toString());
+ }
+ });
+ overallPanel.add(browseButton, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ gbc.weighty = 1;
+ gbc.gridy++;
+ SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(registryPanel);
+ overallPanel.add(permissionPanel, gbc);
+
+ gbc.gridy++;
+ LicenseChooserPanel licensePanel = new LicenseChooserPanel();
+ registryPanel.addObserver(licensePanel);
+ overallPanel.add(licensePanel, gbc);
+
+ int answer = showConfirmDialog(null, overallPanel,
+ "Import Component Profile", OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doImport(registryPanel.getChosenRegistry(),
+ profileLocation.getText(),
+ permissionPanel.getChosenPermission(),
+ licensePanel.getChosenLicense());
+ }
+
+ private void doImport(Registry chosenRegistry, String profileLocation,
+ SharingPolicy permission, License license) {
+ if (profileLocation == null || profileLocation.isEmpty()) {
+ showMessageDialog(null, "Profile location cannot be blank",
+ "Invalid URL", ERROR_MESSAGE);
+ return;
+ }
+ if (chosenRegistry == null) {
+ showMessageDialog(null, "Unable to determine registry",
+ "Component Registry Problem", ERROR_MESSAGE);
+ return;
+ }
+ try {
+ Profile newProfile = factory.getProfile(new URL(profileLocation));
+ String newName = newProfile.getName();
+ for (Profile p : chosenRegistry.getComponentProfiles())
+ if (p.getName().equals(newName)) {
+ showMessageDialog(null, newName + " is already used",
+ "Duplicate profile name", ERROR_MESSAGE);
+ return;
+ }
+ chosenRegistry.addComponentProfile(newProfile, license,
+ permission);
+ } catch (MalformedURLException e) {
+ showMessageDialog(null, profileLocation + " is not a valid URL",
+ "Invalid URL", ERROR_MESSAGE);
+ } catch (ComponentException e) {
+ log.error("import profile failed", e);
+ showMessageDialog(null,
+ "Unable to save profile: " + e.getMessage(),
+ "Registry Exception", ERROR_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportMenuAction.java
new file mode 100644
index 0000000..7c060b8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileImportMenuAction.java
@@ -0,0 +1,64 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileImportMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_PROFILE_IMPORT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileImport");
+
+ private ComponentFactory factory;
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+
+ public ComponentProfileImportMenuAction() {
+ super(COMPONENT_PROFILE_SECTION, 200, COMPONENT_PROFILE_IMPORT_URI);
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentProfileImportAction(factory, prefs, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileMenuSection.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileMenuSection.java
new file mode 100644
index 0000000..b7e9ff6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileMenuSection.java
@@ -0,0 +1,40 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentProfileMenuSection extends AbstractMenuSection {
+
+ public static final URI COMPONENT_PROFILE_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileSection");
+
+ public ComponentProfileMenuSection() {
+ super(COMPONENT, 200, COMPONENT_PROFILE_SECTION);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageAction.java
new file mode 100644
index 0000000..a0cc5ab
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageAction.java
@@ -0,0 +1,52 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.registry;
+
+import static io.github.taverna_extras.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+
+//import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+
+/**
+ * @author alanrw
+ */
+public class ComponentRegistryManageAction extends AbstractAction {
+ private static final long serialVersionUID = 8993945811345164194L;
+ private static final String MANAGE_REGISTRY = "Manage registries...";
+
+ private final T2ConfigurationFrame configFrame;
+
+ public ComponentRegistryManageAction(T2ConfigurationFrame configFrame,
+ ComponentServiceIcon icon) {
+ super(MANAGE_REGISTRY, icon.getIcon());
+ this.configFrame = configFrame;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ configFrame.showConfiguration(DISPLAY_NAME);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
new file mode 100644
index 0000000..28a8926
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.registry;
+
+import static io.github.taverna_extras.component.ui.menu.registry.ComponentRegistryMenuSection.COMPONENT_REGISTRY_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+
+/**
+ * @author alanrw
+ */
+public class ComponentRegistryManageMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_REGISTRY_MANAGE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentRegistryManage");
+
+ private T2ConfigurationFrame configFrame;
+ private ComponentServiceIcon icon;
+
+ public ComponentRegistryManageMenuAction() {
+ super(COMPONENT_REGISTRY_SECTION, 100, COMPONENT_REGISTRY_MANAGE_URI);
+ }
+
+ public void setConfigurationFrame(T2ConfigurationFrame configFrame) {
+ this.configFrame = configFrame;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentRegistryManageAction(configFrame, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryMenuSection.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryMenuSection.java
new file mode 100644
index 0000000..c651770
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/registry/ComponentRegistryMenuSection.java
@@ -0,0 +1,37 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.registry;
+
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author alanrw
+ */
+public class ComponentRegistryMenuSection extends AbstractMenuSection {
+ public static final URI COMPONENT_REGISTRY_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentRegistrySection");
+
+ public ComponentRegistryMenuSection() {
+ super(COMPONENT, 100, COMPONENT_REGISTRY_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChoiceMessage.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChoiceMessage.java
new file mode 100644
index 0000000..50a2027
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChoiceMessage.java
@@ -0,0 +1,50 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+
+/**
+ * @author alanrw
+ */
+public class ComponentChoiceMessage {
+ private final Component chosenComponent;
+ private final Family componentFamily;
+
+ public ComponentChoiceMessage(Family componentFamily, Component chosenComponent) {
+ this.componentFamily = componentFamily;
+ this.chosenComponent = chosenComponent;
+ }
+
+ /**
+ * @return the chosenComponent
+ */
+ public Component getChosenComponent() {
+ return chosenComponent;
+ }
+
+ /**
+ * @return the componentFamily
+ */
+ public Family getComponentFamily() {
+ return componentFamily;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChooserPanel.java
new file mode 100644
index 0000000..a8ceaf0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentChooserPanel.java
@@ -0,0 +1,233 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class ComponentChooserPanel extends JPanel implements
+ Observable<ComponentChoiceMessage>, Observer {
+ private static final String NAME_LABEL = "Component name:";
+ private static final long serialVersionUID = -4459660016225074302L;
+ private static Logger logger = getLogger(ComponentChooserPanel.class);
+
+ private final List<Observer<ComponentChoiceMessage>> observers = new ArrayList<>();
+ private final JComboBox<String> componentChoice = new JComboBox<>();
+ private final SortedMap<String, Component> componentMap = new TreeMap<>();
+ private final RegistryAndFamilyChooserPanel registryAndFamilyChooserPanel;
+
+ public ComponentChooserPanel(ComponentPreference prefs, FamilyChooserPanel familyPanel) {
+ this(prefs);
+ familyPanel.addObserver(new Observer<FamilyChoiceMessage>() {
+ @Override
+ public void notify(Observable<FamilyChoiceMessage> sender,
+ FamilyChoiceMessage message) throws Exception {
+ try {
+ updateComponentModel();
+ } catch (Exception e) {
+ logger.error("problem when component/family was selected",
+ e);
+ }
+ }
+ });
+ }
+
+ public ComponentChooserPanel(ComponentPreference prefs) {
+ super(new GridBagLayout());
+ registryAndFamilyChooserPanel = new RegistryAndFamilyChooserPanel(prefs);
+
+ componentChoice.setPrototypeDisplayValue(LONG_STRING);
+
+ updateComponentModel();
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ gbc.fill = HORIZONTAL;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ add(registryAndFamilyChooserPanel, gbc);
+
+ gbc.gridy = 1;
+ gbc.gridwidth = 1;
+ gbc.weightx = 0;
+ add(new JLabel(NAME_LABEL), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ add(componentChoice, gbc);
+ registryAndFamilyChooserPanel.addObserver(this);
+
+ componentChoice.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED) {
+ updateToolTipText();
+ notifyObservers();
+ }
+ }
+ });
+ }
+
+ protected void updateToolTipText() {
+ Component chosenComponent = componentMap.get(componentChoice
+ .getSelectedItem());
+ if (chosenComponent == null)
+ componentChoice.setToolTipText(null);
+ else
+ componentChoice.setToolTipText(chosenComponent.getDescription());
+ }
+
+ private void notifyObservers() {
+ ComponentChoiceMessage message = new ComponentChoiceMessage(
+ registryAndFamilyChooserPanel.getChosenFamily(),
+ getChosenComponent());
+ for (Observer<ComponentChoiceMessage> o : getObservers())
+ try {
+ o.notify(ComponentChooserPanel.this, message);
+ } catch (Exception e) {
+ logger.error(
+ "observer had problem with component selection message",
+ e);
+ }
+ }
+
+ private void updateComponentModel() {
+ componentMap.clear();
+ componentChoice.removeAllItems();
+ componentChoice.setToolTipText(null);
+ notifyObservers();
+ componentChoice.addItem("Reading components");
+ componentChoice.setEnabled(false);
+ new ComponentUpdater().execute();
+ }
+
+ public Component getChosenComponent() {
+ if (componentMap.isEmpty())
+ return null;
+ return componentMap.get(componentChoice.getSelectedItem());
+ }
+
+ @Override
+ public void notify(Observable sender, Object message) {
+ try {
+ if (message instanceof FamilyChoiceMessage)
+ updateComponentModel();
+ else if (message instanceof ProfileChoiceMessage)
+ registryAndFamilyChooserPanel.notify(null,
+ (ProfileChoiceMessage) message);
+ } catch (Exception e) {
+ logger.error("problem when component/family was selected", e);
+ }
+ }
+
+ @Override
+ public void addObserver(Observer<ComponentChoiceMessage> observer) {
+ observers.add(observer);
+ Component chosenComponent = getChosenComponent();
+ ComponentChoiceMessage message = new ComponentChoiceMessage(
+ registryAndFamilyChooserPanel.getChosenFamily(),
+ chosenComponent);
+ try {
+ observer.notify(this, message);
+ } catch (Exception e) {
+ logger.error("failed to notify about addition of observer", e);
+ }
+ }
+
+ @Override
+ public List<Observer<ComponentChoiceMessage>> getObservers() {
+ return observers;
+ }
+
+ @Override
+ public void removeObserver(Observer<ComponentChoiceMessage> observer) {
+ observers.remove(observer);
+ }
+
+ public Registry getChosenRegistry() {
+ return registryAndFamilyChooserPanel.getChosenRegistry();
+ }
+
+ public Family getChosenFamily() {
+ return registryAndFamilyChooserPanel.getChosenFamily();
+ }
+
+ private class ComponentUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ Family chosenFamily = registryAndFamilyChooserPanel
+ .getChosenFamily();
+ if (chosenFamily != null)
+ for (Component component : chosenFamily.getComponents())
+ componentMap.put(component.getName(), component);
+
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ componentChoice.removeAllItems();
+ try {
+ get();
+ for (String componentName : componentMap.keySet())
+ componentChoice.addItem(componentName);
+ if (!componentMap.isEmpty()) {
+ componentChoice.setSelectedItem(componentMap.firstKey());
+ updateToolTipText();
+ } else
+ componentChoice.addItem("No components available");
+ } catch (InterruptedException | ExecutionException e) {
+ logger.error(e);
+ componentChoice.addItem("Unable to read components");
+ }
+ notifyObservers();
+ componentChoice.setEnabled(!componentMap.isEmpty());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentListCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentListCellRenderer.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentListCellRenderer.java
new file mode 100644
index 0000000..24d15d4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentListCellRenderer.java
@@ -0,0 +1,62 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.panel;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+
+/**
+ * @author alanrw
+ */
+public class ComponentListCellRenderer<T> implements ListCellRenderer<T> {
+ private static DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
+
+ @Override
+ public java.awt.Component getListCellRendererComponent(
+ JList<? extends T> list, T value, int index, boolean isSelected,
+ boolean cellHasFocus) {
+ return defaultRenderer.getListCellRendererComponent(list,
+ convertValueToString(value), index, isSelected, cellHasFocus);
+ }
+
+ private static String convertValueToString(Object value) {
+ if (value instanceof Registry)
+ return ((Registry) value).getRegistryBase().toString();
+ if (value instanceof Family)
+ return ((Family) value).getName();
+ if (value instanceof Component)
+ return ((Component) value).getName();
+ if (value instanceof Version)
+ return ((Version) value).getVersionNumber().toString();
+ if (value instanceof Integer)
+ return ((Integer) value).toString();
+ if (value instanceof String)
+ return (String) value;
+ if (value == null)
+ return "null";
+ return "Spaceholder for " + value.getClass().getName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentVersionChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentVersionChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentVersionChooserPanel.java
new file mode 100644
index 0000000..956af9c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ComponentVersionChooserPanel.java
@@ -0,0 +1,186 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class ComponentVersionChooserPanel extends JPanel implements
+ Observer<ComponentChoiceMessage> {
+ private static final long serialVersionUID = 5125907010496468219L;
+ private static Logger logger = getLogger(ComponentVersionChooserPanel.class);
+
+ private final JComboBox<String> componentVersionChoice;
+ private final SortedMap<Integer, Version> componentVersionMap;
+ private final ComponentChooserPanel componentChooserPanel;
+
+ public ComponentVersionChooserPanel(ComponentPreference prefs) {
+ super(new GridBagLayout());
+ componentVersionMap = new TreeMap<>();
+ componentChooserPanel = new ComponentChooserPanel(prefs);
+ componentVersionChoice = new JComboBox<>();
+ componentVersionChoice.setPrototypeDisplayValue(SHORT_STRING);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ gbc.fill = HORIZONTAL;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ add(componentChooserPanel, gbc);
+ componentChooserPanel.addObserver(this);
+
+ gbc.gridy = 1;
+ gbc.gridwidth = 1;
+ gbc.weightx = 0;
+ gbc.fill = NONE;
+ add(new JLabel("Component version:"), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ add(componentVersionChoice, gbc);
+ componentVersionChoice.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED)
+ updateToolTipText();
+ }
+ });
+ }
+
+ protected void updateToolTipText() {
+ Version chosenComponentVersion = getChosenComponentVersion();
+ componentVersionChoice
+ .setToolTipText(chosenComponentVersion == null ? null
+ : chosenComponentVersion.getDescription());
+ }
+
+ private void updateComponentVersionModel() {
+ componentVersionMap.clear();
+ componentVersionChoice.removeAllItems();
+ componentVersionChoice.setToolTipText(null);
+ componentVersionChoice.addItem("Reading component versions");
+ componentVersionChoice.setEnabled(false);
+ new ComponentVersionUpdater().execute();
+ }
+
+ public Version getChosenComponentVersion() {
+ if (componentVersionMap.isEmpty())
+ return null;
+ try {
+ return componentVersionMap.get(new Integer(componentVersionChoice
+ .getSelectedItem().toString()));
+ } catch (NumberFormatException nfe) {
+ // Not a number, no version chosen
+ return null;
+ }
+ }
+
+ @Override
+ public void notify(Observable<ComponentChoiceMessage> sender,
+ ComponentChoiceMessage message) {
+ try {
+ updateComponentVersionModel();
+ } catch (RuntimeException e) {
+ logger.error("problem updating view from component version", e);
+ }
+ }
+
+ public Registry getChosenRegistry() {
+ return componentChooserPanel.getChosenRegistry();
+ }
+
+ public Family getChosenFamily() {
+ return componentChooserPanel.getChosenFamily();
+ }
+
+ public Component getChosenComponent() {
+ return componentChooserPanel.getChosenComponent();
+ }
+
+ private class ComponentVersionUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ Component chosenComponent = componentChooserPanel
+ .getChosenComponent();
+ if (chosenComponent != null)
+ for (Version version : chosenComponent.getComponentVersionMap()
+ .values()) {
+ Integer versionNumber = version.getVersionNumber();
+ componentVersionMap.put(versionNumber, version);
+ }
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ componentVersionChoice.removeAllItems();
+ try {
+ get();
+ for (Integer versionNumber : componentVersionMap.keySet())
+ componentVersionChoice.addItem(versionNumber.toString());
+
+ if (!componentVersionMap.isEmpty()) {
+ componentVersionChoice.setSelectedItem(componentVersionMap
+ .lastKey());
+ updateToolTipText();
+ } else
+ componentVersionChoice.addItem("No versions available");
+ } catch (InterruptedException | ExecutionException e) {
+ componentVersionChoice.addItem("Unable to read versions");
+ logger.error(e);
+ }
+
+ componentVersionChoice.setEnabled(!componentVersionMap.isEmpty());
+ }
+ }
+
+ public ComponentChooserPanel getComponentChooserPanel() {
+ return componentChooserPanel;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChoiceMessage.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChoiceMessage.java
new file mode 100644
index 0000000..109b125
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChoiceMessage.java
@@ -0,0 +1,40 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import io.github.taverna_extras.component.api.Family;
+
+/**
+ * @author alanrw
+ */
+public class FamilyChoiceMessage {
+ private final Family chosenFamily;
+
+ public FamilyChoiceMessage(Family chosenFamily) {
+ this.chosenFamily = chosenFamily;
+ }
+
+ /**
+ * @return the chosenFamily
+ */
+ public Family getChosenFamily() {
+ return chosenFamily;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChooserPanel.java
new file mode 100644
index 0000000..499d1a4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/FamilyChooserPanel.java
@@ -0,0 +1,235 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class FamilyChooserPanel extends JPanel implements
+ Observer<ProfileChoiceMessage>, Observable<FamilyChoiceMessage> {
+ private static final String FAMILY_LABEL = "Component family:";
+ private static final String READING_MSG = "Reading families";
+ private static final long serialVersionUID = -2608831126562927778L;
+ private static Logger logger = getLogger(FamilyChooserPanel.class);
+
+ private final List<Observer<FamilyChoiceMessage>> observers = new ArrayList<>();
+ private final JComboBox<String> familyBox = new JComboBox<>();
+ // private JTextArea familyDescription = new JTextArea(10,60);
+ private final SortedMap<String, Family> familyMap = new TreeMap<>();
+ private Registry chosenRegistry = null;
+ private Profile profileFilter = null;
+
+ public FamilyChooserPanel(RegistryChooserPanel registryPanel) {
+ this();
+ registryPanel.addObserver(new Observer<RegistryChoiceMessage>() {
+ @Override
+ public void notify(Observable<RegistryChoiceMessage> sender,
+ RegistryChoiceMessage message) throws Exception {
+ try {
+ chosenRegistry = message.getChosenRegistry();
+ updateList();
+ } catch (RuntimeException e) {
+ logger.error("failed to update list after registry choice",
+ e);
+ }
+ }
+ });
+ }
+
+ public FamilyChooserPanel() {
+ super(new GridBagLayout());
+ familyBox.setPrototypeDisplayValue(LONG_STRING);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = NONE;
+ this.add(new JLabel(FAMILY_LABEL), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = BOTH;
+ this.add(familyBox, gbc);
+ familyBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED) {
+ updateDescription();
+ notifyObservers();
+ }
+ }
+ });
+
+ familyBox.setEditable(false);
+ }
+
+ protected void updateDescription() {
+ Family chosenFamily = getChosenFamily();
+ if (chosenFamily != null)
+ familyBox.setToolTipText(chosenFamily.getDescription());
+ else
+ familyBox.setToolTipText(null);
+ }
+
+ private void updateList() {
+ familyMap.clear();
+ familyBox.removeAllItems();
+ familyBox.setToolTipText(null);
+ notifyObservers();
+ familyBox.addItem(READING_MSG);
+ familyBox.setEnabled(false);
+ new FamilyUpdater().execute();
+ }
+
+ private void notifyObservers() {
+ Family chosenFamily = getChosenFamily();
+ FamilyChoiceMessage message = new FamilyChoiceMessage(chosenFamily);
+ for (Observer<FamilyChoiceMessage> o : getObservers())
+ try {
+ o.notify(this, message);
+ } catch (Exception e) {
+ logger.error("failed to notify about change of state of panel",
+ e);
+ }
+ }
+
+ public Family getChosenFamily() {
+ if (familyBox.getSelectedIndex() < 0)
+ return null;
+ return familyMap.get(familyBox.getSelectedItem());
+ }
+
+ @Override
+ public void addObserver(Observer<FamilyChoiceMessage> observer) {
+ observers.add(observer);
+ Family chosenFamily = getChosenFamily();
+ FamilyChoiceMessage message = new FamilyChoiceMessage(chosenFamily);
+ try {
+ observer.notify(this, message);
+ } catch (Exception e) {
+ logger.error("failed to notify about family choice", e);
+ }
+ }
+
+ @Override
+ public List<Observer<FamilyChoiceMessage>> getObservers() {
+ return observers;
+ }
+
+ @Override
+ public void removeObserver(Observer<FamilyChoiceMessage> observer) {
+ observers.remove(observer);
+ }
+
+ @Override
+ public void notify(Observable<ProfileChoiceMessage> sender,
+ ProfileChoiceMessage message) throws Exception {
+ try {
+ profileFilter = message.getChosenProfile();
+ updateList();
+ } catch (RuntimeException e) {
+ logger.error("failed to update list after profile choice", e);
+ }
+ }
+
+ private void updateFamiliesFromRegistry() throws ComponentException {
+ for (Family f : chosenRegistry.getComponentFamilies()) {
+ if (profileFilter == null) {
+ familyMap.put(f.getName(), f);
+ continue;
+ }
+ Profile componentProfile;
+ try {
+ componentProfile = f.getComponentProfile();
+ } catch (ComponentException | RuntimeException e) {
+ logger.error("failed to get profile of component", e);
+ componentProfile = null;
+ }
+ if (componentProfile != null) {
+ String id = componentProfile.getId();
+ if ((profileFilter == null) || id.equals(profileFilter.getId()))
+ familyMap.put(f.getName(), f);
+ } else
+ logger.info("Ignoring " + f.getName());
+ }
+ }
+
+ private class FamilyUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ if (chosenRegistry != null)
+ updateFamiliesFromRegistry();
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ familyBox.removeAllItems();
+ try {
+ get();
+ for (String name : familyMap.keySet())
+ familyBox.addItem(name);
+ if (!familyMap.isEmpty()) {
+ String firstKey = familyMap.firstKey();
+ familyBox.setSelectedItem(firstKey);
+ updateDescription();
+ } else
+ familyBox.addItem("No families available");
+ } catch (InterruptedException | ExecutionException e) {
+ familyBox.addItem("Unable to read families");
+ logger.error(e);
+ }
+
+ notifyObservers();
+ familyBox.setEnabled(!familyMap.isEmpty());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/LicenseChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/LicenseChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/LicenseChooserPanel.java
new file mode 100644
index 0000000..faacc35
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/LicenseChooserPanel.java
@@ -0,0 +1,187 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class LicenseChooserPanel extends JPanel implements
+ Observer<RegistryChoiceMessage> {
+ private static final long serialVersionUID = 2175274929391537032L;
+ private static final Logger logger = getLogger(LicenseChooserPanel.class);
+
+ private JComboBox<String> licenseBox = new JComboBox<>();
+ private SortedMap<String, License> licenseMap = new TreeMap<>();
+ private Registry registry;
+
+ public LicenseChooserPanel() {
+ super();
+ licenseBox.setPrototypeDisplayValue(LONG_STRING);
+ this.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = NONE;
+ this.add(new JLabel("License:"), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = BOTH;
+ this.add(licenseBox, gbc);
+
+ licenseBox.setEditable(false);
+ licenseBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED)
+ setLicense(licenseMap.get(licenseBox.getSelectedItem()));
+ }
+ });
+ }
+
+ protected void setLicense(License license) {
+ if (license != null)
+ licenseBox.setToolTipText("<html>" + license.getDescription()
+ + "</html>");
+ else
+ licenseBox.setToolTipText(null);
+ }
+
+ @Override
+ public void notify(Observable<RegistryChoiceMessage> sender,
+ RegistryChoiceMessage message) throws Exception {
+ try {
+ registry = message.getChosenRegistry();
+ updateLicenseModel();
+ } catch (Exception e) {
+ logger.error("failure when handling license choice", e);
+ }
+ }
+
+ private void updateLicenseModel() {
+ licenseMap.clear();
+ licenseBox.removeAllItems();
+ licenseBox.setToolTipText(null);
+ licenseBox.addItem("Reading licenses");
+ licenseBox.setEnabled(false);
+ new LicenseUpdater().execute();
+ }
+
+ public License getChosenLicense() {
+ if (licenseBox.getSelectedIndex() < 0)
+ return null;
+ Object selectedItem = licenseBox.getSelectedItem();
+ return licenseMap.get(selectedItem);
+ }
+
+ private class LicenseUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ List<License> licenses;
+ if (registry == null)
+ return null;
+ try {
+ licenses = registry.getLicenses();
+ if (licenses == null)
+ return null;
+ } catch (ComponentException e) {
+ logger.error("failure when reading licenses from registry", e);
+ throw e;
+ } catch (NullPointerException e) {
+ logger.error("unexpected exception when reading licenses", e);
+ throw e;
+ }
+ for (License license : licenses)
+ try {
+ String name = license.getName();
+ licenseMap.put(name, license);
+ } catch (NullPointerException e) {
+ logger.error("could not get name of license", e);
+ }
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ licenseBox.removeAllItems();
+ try {
+ get();
+ } catch (InterruptedException | ExecutionException e1) {
+ logger.error(e1);
+ licenseBox.addItem("Unable to read licenses");
+ licenseBox.setEnabled(false);
+ return;
+ }
+ for (String name : licenseMap.keySet())
+ licenseBox.addItem(name);
+ if (licenseMap.isEmpty()) {
+ licenseBox.addItem("No licenses available");
+ licenseBox.setEnabled(false);
+ return;
+ }
+
+ String firstKey = licenseMap.firstKey();
+ License preferredLicense = null;
+ try {
+ preferredLicense = registry.getPreferredLicense();
+ } catch (ComponentException e) {
+ logger.error("failed to get preferred license", e);
+ }
+ if (preferredLicense != null) {
+ licenseBox.setSelectedItem(preferredLicense.getName());
+ setLicense(preferredLicense);
+ } else {
+ licenseBox.setSelectedItem(firstKey);
+ setLicense(licenseMap.get(firstKey));
+ }
+ licenseBox.setEnabled(true);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/PrefixPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/PrefixPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/PrefixPanel.java
new file mode 100644
index 0000000..53d89c4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/PrefixPanel.java
@@ -0,0 +1,96 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static javax.swing.BorderFactory.createEtchedBorder;
+import static javax.swing.BorderFactory.createTitledBorder;
+import static javax.swing.border.TitledBorder.CENTER;
+import static javax.swing.border.TitledBorder.TOP;
+
+import java.awt.BorderLayout;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableModel;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class PrefixPanel extends JPanel {
+ private DefaultTableModel prefixModel = new DefaultTableModel(10, 2) {
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ // all cells false
+ return false;
+ };
+ };
+
+ private JTable prefixTable = new JTable(prefixModel);
+
+ public PrefixPanel(ProfileChooserPanel profilePanel) {
+ this();
+ profilePanel.addObserver(new Observer<ProfileChoiceMessage>() {
+ @Override
+ public void notify(Observable<ProfileChoiceMessage> sender,
+ ProfileChoiceMessage message) throws Exception {
+ profileChanged(message.getChosenProfile());
+ }
+ });
+ }
+
+ public PrefixPanel() {
+ super(new BorderLayout());
+ prefixModel.setColumnIdentifiers(new String[] { "Prefix", "URL" });
+ add(new JScrollPane(prefixTable), BorderLayout.CENTER);
+ setBorder(createTitledBorder(createEtchedBorder(), "Prefixes", CENTER,
+ TOP));
+ }
+
+ public TreeMap<String, String> getPrefixMap() {
+ TreeMap<String, String> result = new TreeMap<>();
+ for (int i = 0; i < prefixModel.getRowCount(); i++)
+ result.put((String) prefixModel.getValueAt(i, 0),
+ (String) prefixModel.getValueAt(i, 1));
+ return result;
+ }
+
+ private void profileChanged(Profile newProfile) throws ComponentException {
+ prefixModel.setRowCount(0);
+ if (newProfile != null)
+ for (Entry<String, String> entry : newProfile.getPrefixMap()
+ .entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ if (!value.endsWith("#"))
+ value += "#";
+ prefixModel.addRow(new String[] { key, value });
+ }
+ validate();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChoiceMessage.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChoiceMessage.java
new file mode 100644
index 0000000..432cf44
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChoiceMessage.java
@@ -0,0 +1,40 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import io.github.taverna_extras.component.api.profile.Profile;
+
+/**
+ * @author alanrw
+ */
+public class ProfileChoiceMessage {
+ private final Profile chosenProfile;
+
+ public ProfileChoiceMessage(Profile chosenProfile) {
+ this.chosenProfile = chosenProfile;
+ }
+
+ /**
+ * @return the chosenProfile
+ */
+ public Profile getChosenProfile() {
+ return chosenProfile;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChooserPanel.java
new file mode 100644
index 0000000..f8b0148
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/ProfileChooserPanel.java
@@ -0,0 +1,219 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class ProfileChooserPanel extends JPanel implements
+ Observer<RegistryChoiceMessage>, Observable<ProfileChoiceMessage> {
+ private static final String READING_MSG = "Reading profiles";
+ private static final String PROFILE_LABEL = "Profile:";
+ private static final long serialVersionUID = 2175274929391537032L;
+ private static Logger logger = getLogger(ProfileChooserPanel.class);
+
+ private final List<Observer<ProfileChoiceMessage>> observers = new ArrayList<>();
+ private final JComboBox<String> profileBox = new JComboBox<>();
+ private final SortedMap<String, Profile> profileMap = new TreeMap<>();
+
+ private Registry registry;
+
+ public ProfileChooserPanel(RegistryChooserPanel registryPanel) {
+ this();
+ registryPanel.addObserver(new Observer<RegistryChoiceMessage>() {
+ @Override
+ public void notify(Observable<RegistryChoiceMessage> sender,
+ RegistryChoiceMessage message) throws Exception {
+ try {
+ registry = message.getChosenRegistry();
+ updateProfileModel();
+ } catch (Exception e) {
+ logger.error("failure when notifying about chosen registry", e);
+ }
+ }
+ });
+ }
+
+ public ProfileChooserPanel() {
+ super();
+ profileBox.setPrototypeDisplayValue(LONG_STRING);
+ this.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = NONE;
+ this.add(new JLabel(PROFILE_LABEL), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = BOTH;
+ this.add(profileBox, gbc);
+ profileBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED)
+ setProfile(profileMap.get(profileBox.getSelectedItem()));
+ }
+ });
+
+ profileBox.setEditable(false);
+ }
+
+ @Override
+ public void notify(Observable<RegistryChoiceMessage> sender,
+ RegistryChoiceMessage message) throws Exception {
+ try {
+ registry = message.getChosenRegistry();
+ updateProfileModel();
+ } catch (Exception e) {
+ logger.error("failure when notifying about chosen registry", e);
+ }
+ }
+
+ private void updateProfileModel() {
+ profileMap.clear();
+ profileBox.removeAllItems();
+ profileBox.setToolTipText(null);
+ profileBox.addItem(READING_MSG);
+ profileBox.setEnabled(false);
+ new ProfileUpdater().execute();
+ }
+
+ private void setProfile(Profile componentProfile) {
+ if (componentProfile != null)
+ profileBox.setToolTipText(componentProfile.getDescription());
+ else
+ profileBox.setToolTipText(null);
+
+ Profile chosenProfile = getChosenProfile();
+ ProfileChoiceMessage message = new ProfileChoiceMessage(chosenProfile);
+ for (Observer<ProfileChoiceMessage> o : getObservers())
+ try {
+ o.notify(this, message);
+ } catch (Exception e) {
+ logger.error("failure when notifying about profile choice", e);
+ }
+ }
+
+ public Profile getChosenProfile() {
+ if (profileBox.getSelectedIndex() < 0)
+ return null;
+
+ return profileMap.get(profileBox.getSelectedItem());
+ }
+
+ private class ProfileUpdater extends SwingWorker<String, Object> {
+ @Override
+ protected String doInBackground() throws Exception {
+ if (registry == null)
+ return null;
+ List<Profile> componentProfiles;
+ try {
+ componentProfiles = registry.getComponentProfiles();
+ } catch (ComponentException e) {
+ logger.error("failed to get profiles", e);
+ throw e;
+ } catch (NullPointerException e) {
+ logger.error("failed to get profiles", e);
+ throw e;
+ }
+ for (Profile profile : componentProfiles)
+ try {
+ profileMap.put(profile.getName(), profile);
+ } catch (NullPointerException e) {
+ logger.error("failure getting profile name", e);
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ profileBox.removeAllItems();
+ try {
+ get();
+ for (String name : profileMap.keySet())
+ profileBox.addItem(name);
+ if (!profileMap.isEmpty()) {
+ String firstKey = profileMap.firstKey();
+ profileBox.setSelectedItem(firstKey);
+ setProfile(profileMap.get(firstKey));
+ } else
+ profileBox.addItem("No profiles available");
+ } catch (InterruptedException | ExecutionException e) {
+ logger.error(e);
+ profileBox.addItem("Unable to read profiles");
+ }
+ profileBox.setEnabled(!profileMap.isEmpty());
+ }
+ }
+
+ @Override
+ public void addObserver(Observer<ProfileChoiceMessage> observer) {
+ observers.add(observer);
+ ProfileChoiceMessage message = new ProfileChoiceMessage(getChosenProfile());
+ try {
+ observer.notify(this, message);
+ } catch (Exception e) {
+ logger.error("failure when notifying about profile choice", e);
+ }
+ }
+
+ @Override
+ public void removeObserver(Observer<ProfileChoiceMessage> observer) {
+ observers.remove(observer);
+ }
+
+ @Override
+ public List<Observer<ProfileChoiceMessage>> getObservers() {
+ return observers;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
new file mode 100644
index 0000000..1d393c5
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
@@ -0,0 +1,98 @@
+/*
+* 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 io.github.taverna_extras.component.ui.panel;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+
+/**
+ * @author alanrw
+ */
+public class RegistryAndFamilyChooserComponentEntryPanel extends JPanel {
+ private static final long serialVersionUID = -6675545311458594678L;
+ private static final String T2FLOW = ".t2flow";
+ private static final String WFBUNDLE = ".wfbundle";
+
+ private JTextField componentNameField = new JTextField(20);
+ private RegistryAndFamilyChooserPanel registryAndFamilyChooserPanel;
+
+ public RegistryAndFamilyChooserComponentEntryPanel(ComponentPreference prefs) {
+ super(new GridBagLayout());
+ registryAndFamilyChooserPanel = new RegistryAndFamilyChooserPanel(prefs);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ this.add(registryAndFamilyChooserPanel, gbc);
+ gbc.gridy = 1;
+
+ gbc.gridwidth = 1;
+ gbc.gridx = 0;
+ gbc.weightx = 0;
+ gbc.fill = GridBagConstraints.NONE;
+ this.add(new JLabel("Component name:"), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ this.add(componentNameField, gbc);
+ }
+
+ public String getComponentName() {
+ return componentNameField.getText();
+ }
+
+ public void setComponentName(String name) {
+ componentNameField.setText(name);
+ }
+
+ public Version.ID getComponentVersionIdentification() {
+ String componentName = getComponentName();
+ Family familyChoice = registryAndFamilyChooserPanel.getChosenFamily();
+ Registry registry = registryAndFamilyChooserPanel.getChosenRegistry();
+
+ if (familyChoice == null || registry == null || componentName == null
+ || componentName.isEmpty())
+ return null;
+
+ return new Version.Identifier(registry.getRegistryBase(),
+ familyChoice.getName(), trim(componentName), -1);
+ }
+
+ private static String trim(String name) {
+ if (name.endsWith(WFBUNDLE))
+ return name.substring(0, name.length() - WFBUNDLE.length());
+ else if (name.endsWith(T2FLOW))
+ return name.substring(0, name.length() - T2FLOW.length());
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserPanel.java
new file mode 100644
index 0000000..bc24dca
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/panel/RegistryAndFamilyChooserPanel.java
@@ -0,0 +1,102 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.panel;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.JPanel;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class RegistryAndFamilyChooserPanel extends JPanel implements
+ Observer<ProfileChoiceMessage>, Observable<FamilyChoiceMessage> {
+ private static Logger logger = getLogger(RegistryAndFamilyChooserPanel.class);
+ private static final long serialVersionUID = -535518473593617735L;
+ final RegistryChooserPanel registryPanel;
+ final FamilyChooserPanel familyPanel;
+
+ public RegistryAndFamilyChooserPanel(ComponentPreference prefs) {
+ super(new GridBagLayout());
+ registryPanel = new RegistryChooserPanel(prefs);
+ familyPanel = new FamilyChooserPanel(registryPanel);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ add(registryPanel, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.weighty = 1;
+ add(familyPanel, gbc);
+ }
+
+ public Registry getChosenRegistry() {
+ return registryPanel.getChosenRegistry();
+ }
+
+ public Family getChosenFamily() {
+ return familyPanel.getChosenFamily();
+ }
+
+ @Override
+ public void addObserver(Observer<FamilyChoiceMessage> observer) {
+ familyPanel.addObserver(observer);
+ }
+
+ @Override
+ public List<Observer<FamilyChoiceMessage>> getObservers() {
+ return familyPanel.getObservers();
+ }
+
+ @Override
+ public void removeObserver(Observer<FamilyChoiceMessage> observer) {
+ familyPanel.removeObserver(observer);
+ }
+
+ @Override
+ public void notify(Observable<ProfileChoiceMessage> sender,
+ ProfileChoiceMessage message) {
+ try {
+ familyPanel.notify(sender, message);
+ } catch (Exception e) {
+ logger.error("problem handling notification about profile choice",
+ e);
+ }
+ }
+}
[17/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
deleted file mode 100644
index 2d8295a..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
-import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileCopyAction extends AbstractAction {
- private static final long serialVersionUID = 6332253931049645259L;
- private static final Logger log = getLogger(ComponentProfileCopyAction.class);
- private static final String COPY_PROFILE = "Copy profile...";
-
- private final ComponentPreference prefs;
-
- public ComponentProfileCopyAction(ComponentPreference prefs,
- ComponentServiceIcon iconProvider) {
- super(COPY_PROFILE, iconProvider.getIcon());
- this.prefs = prefs;
- }
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- JPanel overallPanel = new JPanel();
- overallPanel.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- RegistryChooserPanel sourceRegistryPanel = new RegistryChooserPanel(prefs);
- sourceRegistryPanel.setBorder(new TitledBorder("Source registry"));
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.fill = GridBagConstraints.BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(sourceRegistryPanel, gbc);
-
- ProfileChooserPanel profilePanel = new ProfileChooserPanel(sourceRegistryPanel);
- profilePanel.setBorder(new TitledBorder("Source profile"));
-
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weighty = 1;
- overallPanel.add(profilePanel, gbc);
-
- RegistryChooserPanel targetRegistryPanel = new RegistryChooserPanel(prefs);
- targetRegistryPanel.setBorder(new TitledBorder("Target registry"));
- gbc.gridy = 2;
- overallPanel.add(targetRegistryPanel, gbc);
-
- gbc.gridx = 0;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- gbc.weighty = 1;
- gbc.gridy++;
- SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(targetRegistryPanel);
- overallPanel.add(permissionPanel, gbc);
-
- gbc.gridy++;
- LicenseChooserPanel licensePanel = new LicenseChooserPanel();
- targetRegistryPanel.addObserver(licensePanel);
- overallPanel.add(licensePanel, gbc);
-
- int answer = showConfirmDialog(null, overallPanel,
- "Copy Component Profile", OK_CANCEL_OPTION);
- try {
- if (answer == OK_OPTION)
- doCopy(sourceRegistryPanel.getChosenRegistry(),
- profilePanel.getChosenProfile(),
- targetRegistryPanel.getChosenRegistry(),
- permissionPanel.getChosenPermission(),
- licensePanel.getChosenLicense());
- } catch (ComponentException e) {
- log.error("failed to copy profile", e);
- showMessageDialog(null, "Unable to save profile: " + e.getMessage(),
- "Registry Exception", ERROR_MESSAGE);
- }
- }
-
- private void doCopy(Registry sourceRegistry, Profile sourceProfile,
- Registry targetRegistry, SharingPolicy permission, License license)
- throws ComponentException {
- if (sourceRegistry == null) {
- showMessageDialog(null, "Unable to determine source registry",
- "Component Registry Problem", ERROR_MESSAGE);
- return;
- }
- if (targetRegistry == null) {
- showMessageDialog(null, "Unable to determine target registry",
- "Component Registry Problem", ERROR_MESSAGE);
- return;
- }
- if (sourceRegistry.equals(targetRegistry)) {
- showMessageDialog(null, "Cannot copy to the same registry",
- "Copy Problem", ERROR_MESSAGE);
- return;
- }
- if (sourceProfile == null) {
- showMessageDialog(null, "Unable to determine source profile",
- "Component Profile Problem", ERROR_MESSAGE);
- return;
- }
- for (Profile p : targetRegistry.getComponentProfiles()) {
- if (p.getName().equals(sourceProfile.getName())) {
- showMessageDialog(null,
- "Target registry already contains a profile named "
- + sourceProfile.getName(), "Copy Problem",
- ERROR_MESSAGE);
- return;
- }
- String sourceId = sourceProfile.getId();
- if (sourceId == null) {
- showMessageDialog(null,
- "Source profile \"" + sourceProfile.getName()
- + "\" has no id ", "Copy Problem",
- ERROR_MESSAGE);
- return;
- }
- String id = p.getId();
- if (sourceId.equals(id)) {
- showMessageDialog(null,
- "Target registry already contains a profile with id "
- + sourceId, "Copy Problem", ERROR_MESSAGE);
- return;
- }
- }
- targetRegistry.addComponentProfile(sourceProfile, license, permission);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
deleted file mode 100644
index 1052960..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileCopyMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_PROFILE_COPY_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileCopy");
-
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
-
- public ComponentProfileCopyMenuAction() {
- super(COMPONENT_PROFILE_SECTION, 250, COMPONENT_PROFILE_COPY_URI);
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentProfileCopyAction(prefs, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
deleted file mode 100644
index 00f809d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileDeleteAction extends AbstractAction {
- private static final long serialVersionUID = -5697971204434020559L;
- private static final Logger log = getLogger(ComponentProfileDeleteAction.class);
- private static final String DELETE_PROFILE = "Delete profile...";
-
- private final ComponentPreference prefs;
-
- public ComponentProfileDeleteAction(ComponentPreference prefs,
- ComponentServiceIcon icon) {
- super(DELETE_PROFILE, icon.getIcon());
- // FIXME Should we switch this on?
- setEnabled(false);
- this.prefs = prefs;
- }
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- JPanel overallPanel = new JPanel(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
- registryPanel.setBorder(new TitledBorder("Registry"));
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(registryPanel, gbc);
-
- ProfileChooserPanel profilePanel = new ProfileChooserPanel(
- registryPanel);
- profilePanel.setBorder(new TitledBorder("Profile"));
-
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weighty = 1;
- overallPanel.add(profilePanel, gbc);
-
- int answer = showConfirmDialog(null, overallPanel,
- "Delete Component Profile", OK_CANCEL_OPTION);
- try {
- if (answer == OK_OPTION)
- doDelete(profilePanel.getChosenProfile());
- } catch (ComponentException e) {
- log.error("failed to delete profile", e);
- showMessageDialog(null,
- "Unable to delete profile: " + e.getMessage(),
- "Registry Exception", ERROR_MESSAGE);
- }
- }
-
- private void doDelete(Profile profile) throws ComponentException {
- if (profile == null) {
- showMessageDialog(null, "Unable to determine profile",
- "Component Profile Problem", ERROR_MESSAGE);
- return;
- }
- profile.delete();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
deleted file mode 100644
index be6e6d6..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileDeleteMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_PROFILE_DELETE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileDelete");
-
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
-
- public ComponentProfileDeleteMenuAction() {
- super(COMPONENT_PROFILE_SECTION, 300, COMPONENT_PROFILE_DELETE_URI);
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentProfileDeleteAction(prefs, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
deleted file mode 100644
index d63133d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.filechooser.FileNameExtensionFilter;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileImportAction extends AbstractAction {
- private static final long serialVersionUID = -3796754761286943970L;
- private static final Logger log = getLogger(ComponentProfileImportAction.class);
- private static final String IMPORT_PROFILE = "Import profile...";
- private static final JFileChooser chooser = new JFileChooser();
-
- private final ComponentFactory factory;
- private final ComponentPreference prefs;
-
- public ComponentProfileImportAction(ComponentFactory factory,
- ComponentPreference prefs, ComponentServiceIcon icon) {
- super(IMPORT_PROFILE, icon.getIcon());
- this.factory = factory;
- this.prefs = prefs;
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- JPanel overallPanel = new JPanel();
- overallPanel.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(registryPanel, gbc);
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.gridwidth = 1;
- gbc.weightx = 0;
- overallPanel.add(new JLabel("Profile URL or local file path:"), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- final JTextField profileLocation = new JTextField(30);
- overallPanel.add(profileLocation, gbc);
- gbc.gridx = 0;
- gbc.weightx = 0;
- gbc.gridy++;
- JButton browseButton = new DeselectingButton(new AbstractAction(
- "Browse") {
- private static final long serialVersionUID = 1574330610799117697L;
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- FileNameExtensionFilter filter = new FileNameExtensionFilter(
- "XML files", "xml");
- chooser.setFileFilter(filter);
- int returnVal = chooser.showOpenDialog(null);
- if (returnVal == APPROVE_OPTION)
- profileLocation.setText(chooser.getSelectedFile().toURI()
- .toString());
- }
- });
- overallPanel.add(browseButton, gbc);
-
- gbc.gridx = 0;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- gbc.weighty = 1;
- gbc.gridy++;
- SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(registryPanel);
- overallPanel.add(permissionPanel, gbc);
-
- gbc.gridy++;
- LicenseChooserPanel licensePanel = new LicenseChooserPanel();
- registryPanel.addObserver(licensePanel);
- overallPanel.add(licensePanel, gbc);
-
- int answer = showConfirmDialog(null, overallPanel,
- "Import Component Profile", OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doImport(registryPanel.getChosenRegistry(),
- profileLocation.getText(),
- permissionPanel.getChosenPermission(),
- licensePanel.getChosenLicense());
- }
-
- private void doImport(Registry chosenRegistry, String profileLocation,
- SharingPolicy permission, License license) {
- if (profileLocation == null || profileLocation.isEmpty()) {
- showMessageDialog(null, "Profile location cannot be blank",
- "Invalid URL", ERROR_MESSAGE);
- return;
- }
- if (chosenRegistry == null) {
- showMessageDialog(null, "Unable to determine registry",
- "Component Registry Problem", ERROR_MESSAGE);
- return;
- }
- try {
- Profile newProfile = factory.getProfile(new URL(profileLocation));
- String newName = newProfile.getName();
- for (Profile p : chosenRegistry.getComponentProfiles())
- if (p.getName().equals(newName)) {
- showMessageDialog(null, newName + " is already used",
- "Duplicate profile name", ERROR_MESSAGE);
- return;
- }
- chosenRegistry.addComponentProfile(newProfile, license,
- permission);
- } catch (MalformedURLException e) {
- showMessageDialog(null, profileLocation + " is not a valid URL",
- "Invalid URL", ERROR_MESSAGE);
- } catch (ComponentException e) {
- log.error("import profile failed", e);
- showMessageDialog(null,
- "Unable to save profile: " + e.getMessage(),
- "Registry Exception", ERROR_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
deleted file mode 100644
index 7c060b8..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * @author alanrw
- */
-public class ComponentProfileImportMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_PROFILE_IMPORT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileImport");
-
- private ComponentFactory factory;
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
-
- public ComponentProfileImportMenuAction() {
- super(COMPONENT_PROFILE_SECTION, 200, COMPONENT_PROFILE_IMPORT_URI);
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentProfileImportAction(factory, prefs, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
deleted file mode 100644
index b7e9ff6..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.profile;
-
-import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentProfileMenuSection extends AbstractMenuSection {
-
- public static final URI COMPONENT_PROFILE_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentProfileSection");
-
- public ComponentProfileMenuSection() {
- super(COMPONENT, 200, COMPONENT_PROFILE_SECTION);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
deleted file mode 100644
index a0cc5ab..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.registry;
-
-import static io.github.taverna_extras.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-
-//import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-
-/**
- * @author alanrw
- */
-public class ComponentRegistryManageAction extends AbstractAction {
- private static final long serialVersionUID = 8993945811345164194L;
- private static final String MANAGE_REGISTRY = "Manage registries...";
-
- private final T2ConfigurationFrame configFrame;
-
- public ComponentRegistryManageAction(T2ConfigurationFrame configFrame,
- ComponentServiceIcon icon) {
- super(MANAGE_REGISTRY, icon.getIcon());
- this.configFrame = configFrame;
- }
-
- @Override
- public void actionPerformed(ActionEvent evt) {
- configFrame.showConfiguration(DISPLAY_NAME);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
deleted file mode 100644
index 28a8926..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.registry;
-
-import static io.github.taverna_extras.component.ui.menu.registry.ComponentRegistryMenuSection.COMPONENT_REGISTRY_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-
-/**
- * @author alanrw
- */
-public class ComponentRegistryManageMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_REGISTRY_MANAGE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentRegistryManage");
-
- private T2ConfigurationFrame configFrame;
- private ComponentServiceIcon icon;
-
- public ComponentRegistryManageMenuAction() {
- super(COMPONENT_REGISTRY_SECTION, 100, COMPONENT_REGISTRY_MANAGE_URI);
- }
-
- public void setConfigurationFrame(T2ConfigurationFrame configFrame) {
- this.configFrame = configFrame;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- public boolean isEnabled() {
- return true;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentRegistryManageAction(configFrame, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
deleted file mode 100644
index c651770..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.registry;
-
-import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author alanrw
- */
-public class ComponentRegistryMenuSection extends AbstractMenuSection {
- public static final URI COMPONENT_REGISTRY_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentRegistrySection");
-
- public ComponentRegistryMenuSection() {
- super(COMPONENT, 100, COMPONENT_REGISTRY_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
deleted file mode 100644
index 50a2027..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-
-/**
- * @author alanrw
- */
-public class ComponentChoiceMessage {
- private final Component chosenComponent;
- private final Family componentFamily;
-
- public ComponentChoiceMessage(Family componentFamily, Component chosenComponent) {
- this.componentFamily = componentFamily;
- this.chosenComponent = chosenComponent;
- }
-
- /**
- * @return the chosenComponent
- */
- public Component getChosenComponent() {
- return chosenComponent;
- }
-
- /**
- * @return the componentFamily
- */
- public Family getComponentFamily() {
- return componentFamily;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
deleted file mode 100644
index a8ceaf0..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class ComponentChooserPanel extends JPanel implements
- Observable<ComponentChoiceMessage>, Observer {
- private static final String NAME_LABEL = "Component name:";
- private static final long serialVersionUID = -4459660016225074302L;
- private static Logger logger = getLogger(ComponentChooserPanel.class);
-
- private final List<Observer<ComponentChoiceMessage>> observers = new ArrayList<>();
- private final JComboBox<String> componentChoice = new JComboBox<>();
- private final SortedMap<String, Component> componentMap = new TreeMap<>();
- private final RegistryAndFamilyChooserPanel registryAndFamilyChooserPanel;
-
- public ComponentChooserPanel(ComponentPreference prefs, FamilyChooserPanel familyPanel) {
- this(prefs);
- familyPanel.addObserver(new Observer<FamilyChoiceMessage>() {
- @Override
- public void notify(Observable<FamilyChoiceMessage> sender,
- FamilyChoiceMessage message) throws Exception {
- try {
- updateComponentModel();
- } catch (Exception e) {
- logger.error("problem when component/family was selected",
- e);
- }
- }
- });
- }
-
- public ComponentChooserPanel(ComponentPreference prefs) {
- super(new GridBagLayout());
- registryAndFamilyChooserPanel = new RegistryAndFamilyChooserPanel(prefs);
-
- componentChoice.setPrototypeDisplayValue(LONG_STRING);
-
- updateComponentModel();
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.anchor = WEST;
- gbc.fill = HORIZONTAL;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- add(registryAndFamilyChooserPanel, gbc);
-
- gbc.gridy = 1;
- gbc.gridwidth = 1;
- gbc.weightx = 0;
- add(new JLabel(NAME_LABEL), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- add(componentChoice, gbc);
- registryAndFamilyChooserPanel.addObserver(this);
-
- componentChoice.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED) {
- updateToolTipText();
- notifyObservers();
- }
- }
- });
- }
-
- protected void updateToolTipText() {
- Component chosenComponent = componentMap.get(componentChoice
- .getSelectedItem());
- if (chosenComponent == null)
- componentChoice.setToolTipText(null);
- else
- componentChoice.setToolTipText(chosenComponent.getDescription());
- }
-
- private void notifyObservers() {
- ComponentChoiceMessage message = new ComponentChoiceMessage(
- registryAndFamilyChooserPanel.getChosenFamily(),
- getChosenComponent());
- for (Observer<ComponentChoiceMessage> o : getObservers())
- try {
- o.notify(ComponentChooserPanel.this, message);
- } catch (Exception e) {
- logger.error(
- "observer had problem with component selection message",
- e);
- }
- }
-
- private void updateComponentModel() {
- componentMap.clear();
- componentChoice.removeAllItems();
- componentChoice.setToolTipText(null);
- notifyObservers();
- componentChoice.addItem("Reading components");
- componentChoice.setEnabled(false);
- new ComponentUpdater().execute();
- }
-
- public Component getChosenComponent() {
- if (componentMap.isEmpty())
- return null;
- return componentMap.get(componentChoice.getSelectedItem());
- }
-
- @Override
- public void notify(Observable sender, Object message) {
- try {
- if (message instanceof FamilyChoiceMessage)
- updateComponentModel();
- else if (message instanceof ProfileChoiceMessage)
- registryAndFamilyChooserPanel.notify(null,
- (ProfileChoiceMessage) message);
- } catch (Exception e) {
- logger.error("problem when component/family was selected", e);
- }
- }
-
- @Override
- public void addObserver(Observer<ComponentChoiceMessage> observer) {
- observers.add(observer);
- Component chosenComponent = getChosenComponent();
- ComponentChoiceMessage message = new ComponentChoiceMessage(
- registryAndFamilyChooserPanel.getChosenFamily(),
- chosenComponent);
- try {
- observer.notify(this, message);
- } catch (Exception e) {
- logger.error("failed to notify about addition of observer", e);
- }
- }
-
- @Override
- public List<Observer<ComponentChoiceMessage>> getObservers() {
- return observers;
- }
-
- @Override
- public void removeObserver(Observer<ComponentChoiceMessage> observer) {
- observers.remove(observer);
- }
-
- public Registry getChosenRegistry() {
- return registryAndFamilyChooserPanel.getChosenRegistry();
- }
-
- public Family getChosenFamily() {
- return registryAndFamilyChooserPanel.getChosenFamily();
- }
-
- private class ComponentUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- Family chosenFamily = registryAndFamilyChooserPanel
- .getChosenFamily();
- if (chosenFamily != null)
- for (Component component : chosenFamily.getComponents())
- componentMap.put(component.getName(), component);
-
- return null;
- }
-
- @Override
- protected void done() {
- componentChoice.removeAllItems();
- try {
- get();
- for (String componentName : componentMap.keySet())
- componentChoice.addItem(componentName);
- if (!componentMap.isEmpty()) {
- componentChoice.setSelectedItem(componentMap.firstKey());
- updateToolTipText();
- } else
- componentChoice.addItem("No components available");
- } catch (InterruptedException | ExecutionException e) {
- logger.error(e);
- componentChoice.addItem("Unable to read components");
- }
- notifyObservers();
- componentChoice.setEnabled(!componentMap.isEmpty());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
deleted file mode 100644
index 24d15d4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-
-/**
- * @author alanrw
- */
-public class ComponentListCellRenderer<T> implements ListCellRenderer<T> {
- private static DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
-
- @Override
- public java.awt.Component getListCellRendererComponent(
- JList<? extends T> list, T value, int index, boolean isSelected,
- boolean cellHasFocus) {
- return defaultRenderer.getListCellRendererComponent(list,
- convertValueToString(value), index, isSelected, cellHasFocus);
- }
-
- private static String convertValueToString(Object value) {
- if (value instanceof Registry)
- return ((Registry) value).getRegistryBase().toString();
- if (value instanceof Family)
- return ((Family) value).getName();
- if (value instanceof Component)
- return ((Component) value).getName();
- if (value instanceof Version)
- return ((Version) value).getVersionNumber().toString();
- if (value instanceof Integer)
- return ((Integer) value).toString();
- if (value instanceof String)
- return (String) value;
- if (value == null)
- return "null";
- return "Spaceholder for " + value.getClass().getName();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
deleted file mode 100644
index 956af9c..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class ComponentVersionChooserPanel extends JPanel implements
- Observer<ComponentChoiceMessage> {
- private static final long serialVersionUID = 5125907010496468219L;
- private static Logger logger = getLogger(ComponentVersionChooserPanel.class);
-
- private final JComboBox<String> componentVersionChoice;
- private final SortedMap<Integer, Version> componentVersionMap;
- private final ComponentChooserPanel componentChooserPanel;
-
- public ComponentVersionChooserPanel(ComponentPreference prefs) {
- super(new GridBagLayout());
- componentVersionMap = new TreeMap<>();
- componentChooserPanel = new ComponentChooserPanel(prefs);
- componentVersionChoice = new JComboBox<>();
- componentVersionChoice.setPrototypeDisplayValue(SHORT_STRING);
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.anchor = WEST;
- gbc.fill = HORIZONTAL;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- add(componentChooserPanel, gbc);
- componentChooserPanel.addObserver(this);
-
- gbc.gridy = 1;
- gbc.gridwidth = 1;
- gbc.weightx = 0;
- gbc.fill = NONE;
- add(new JLabel("Component version:"), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- add(componentVersionChoice, gbc);
- componentVersionChoice.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED)
- updateToolTipText();
- }
- });
- }
-
- protected void updateToolTipText() {
- Version chosenComponentVersion = getChosenComponentVersion();
- componentVersionChoice
- .setToolTipText(chosenComponentVersion == null ? null
- : chosenComponentVersion.getDescription());
- }
-
- private void updateComponentVersionModel() {
- componentVersionMap.clear();
- componentVersionChoice.removeAllItems();
- componentVersionChoice.setToolTipText(null);
- componentVersionChoice.addItem("Reading component versions");
- componentVersionChoice.setEnabled(false);
- new ComponentVersionUpdater().execute();
- }
-
- public Version getChosenComponentVersion() {
- if (componentVersionMap.isEmpty())
- return null;
- try {
- return componentVersionMap.get(new Integer(componentVersionChoice
- .getSelectedItem().toString()));
- } catch (NumberFormatException nfe) {
- // Not a number, no version chosen
- return null;
- }
- }
-
- @Override
- public void notify(Observable<ComponentChoiceMessage> sender,
- ComponentChoiceMessage message) {
- try {
- updateComponentVersionModel();
- } catch (RuntimeException e) {
- logger.error("problem updating view from component version", e);
- }
- }
-
- public Registry getChosenRegistry() {
- return componentChooserPanel.getChosenRegistry();
- }
-
- public Family getChosenFamily() {
- return componentChooserPanel.getChosenFamily();
- }
-
- public Component getChosenComponent() {
- return componentChooserPanel.getChosenComponent();
- }
-
- private class ComponentVersionUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- Component chosenComponent = componentChooserPanel
- .getChosenComponent();
- if (chosenComponent != null)
- for (Version version : chosenComponent.getComponentVersionMap()
- .values()) {
- Integer versionNumber = version.getVersionNumber();
- componentVersionMap.put(versionNumber, version);
- }
- return null;
- }
-
- @Override
- protected void done() {
- componentVersionChoice.removeAllItems();
- try {
- get();
- for (Integer versionNumber : componentVersionMap.keySet())
- componentVersionChoice.addItem(versionNumber.toString());
-
- if (!componentVersionMap.isEmpty()) {
- componentVersionChoice.setSelectedItem(componentVersionMap
- .lastKey());
- updateToolTipText();
- } else
- componentVersionChoice.addItem("No versions available");
- } catch (InterruptedException | ExecutionException e) {
- componentVersionChoice.addItem("Unable to read versions");
- logger.error(e);
- }
-
- componentVersionChoice.setEnabled(!componentVersionMap.isEmpty());
- }
- }
-
- public ComponentChooserPanel getComponentChooserPanel() {
- return componentChooserPanel;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
deleted file mode 100644
index 109b125..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import io.github.taverna_extras.component.api.Family;
-
-/**
- * @author alanrw
- */
-public class FamilyChoiceMessage {
- private final Family chosenFamily;
-
- public FamilyChoiceMessage(Family chosenFamily) {
- this.chosenFamily = chosenFamily;
- }
-
- /**
- * @return the chosenFamily
- */
- public Family getChosenFamily() {
- return chosenFamily;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
deleted file mode 100644
index 499d1a4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class FamilyChooserPanel extends JPanel implements
- Observer<ProfileChoiceMessage>, Observable<FamilyChoiceMessage> {
- private static final String FAMILY_LABEL = "Component family:";
- private static final String READING_MSG = "Reading families";
- private static final long serialVersionUID = -2608831126562927778L;
- private static Logger logger = getLogger(FamilyChooserPanel.class);
-
- private final List<Observer<FamilyChoiceMessage>> observers = new ArrayList<>();
- private final JComboBox<String> familyBox = new JComboBox<>();
- // private JTextArea familyDescription = new JTextArea(10,60);
- private final SortedMap<String, Family> familyMap = new TreeMap<>();
- private Registry chosenRegistry = null;
- private Profile profileFilter = null;
-
- public FamilyChooserPanel(RegistryChooserPanel registryPanel) {
- this();
- registryPanel.addObserver(new Observer<RegistryChoiceMessage>() {
- @Override
- public void notify(Observable<RegistryChoiceMessage> sender,
- RegistryChoiceMessage message) throws Exception {
- try {
- chosenRegistry = message.getChosenRegistry();
- updateList();
- } catch (RuntimeException e) {
- logger.error("failed to update list after registry choice",
- e);
- }
- }
- });
- }
-
- public FamilyChooserPanel() {
- super(new GridBagLayout());
- familyBox.setPrototypeDisplayValue(LONG_STRING);
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = NONE;
- this.add(new JLabel(FAMILY_LABEL), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = BOTH;
- this.add(familyBox, gbc);
- familyBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED) {
- updateDescription();
- notifyObservers();
- }
- }
- });
-
- familyBox.setEditable(false);
- }
-
- protected void updateDescription() {
- Family chosenFamily = getChosenFamily();
- if (chosenFamily != null)
- familyBox.setToolTipText(chosenFamily.getDescription());
- else
- familyBox.setToolTipText(null);
- }
-
- private void updateList() {
- familyMap.clear();
- familyBox.removeAllItems();
- familyBox.setToolTipText(null);
- notifyObservers();
- familyBox.addItem(READING_MSG);
- familyBox.setEnabled(false);
- new FamilyUpdater().execute();
- }
-
- private void notifyObservers() {
- Family chosenFamily = getChosenFamily();
- FamilyChoiceMessage message = new FamilyChoiceMessage(chosenFamily);
- for (Observer<FamilyChoiceMessage> o : getObservers())
- try {
- o.notify(this, message);
- } catch (Exception e) {
- logger.error("failed to notify about change of state of panel",
- e);
- }
- }
-
- public Family getChosenFamily() {
- if (familyBox.getSelectedIndex() < 0)
- return null;
- return familyMap.get(familyBox.getSelectedItem());
- }
-
- @Override
- public void addObserver(Observer<FamilyChoiceMessage> observer) {
- observers.add(observer);
- Family chosenFamily = getChosenFamily();
- FamilyChoiceMessage message = new FamilyChoiceMessage(chosenFamily);
- try {
- observer.notify(this, message);
- } catch (Exception e) {
- logger.error("failed to notify about family choice", e);
- }
- }
-
- @Override
- public List<Observer<FamilyChoiceMessage>> getObservers() {
- return observers;
- }
-
- @Override
- public void removeObserver(Observer<FamilyChoiceMessage> observer) {
- observers.remove(observer);
- }
-
- @Override
- public void notify(Observable<ProfileChoiceMessage> sender,
- ProfileChoiceMessage message) throws Exception {
- try {
- profileFilter = message.getChosenProfile();
- updateList();
- } catch (RuntimeException e) {
- logger.error("failed to update list after profile choice", e);
- }
- }
-
- private void updateFamiliesFromRegistry() throws ComponentException {
- for (Family f : chosenRegistry.getComponentFamilies()) {
- if (profileFilter == null) {
- familyMap.put(f.getName(), f);
- continue;
- }
- Profile componentProfile;
- try {
- componentProfile = f.getComponentProfile();
- } catch (ComponentException | RuntimeException e) {
- logger.error("failed to get profile of component", e);
- componentProfile = null;
- }
- if (componentProfile != null) {
- String id = componentProfile.getId();
- if ((profileFilter == null) || id.equals(profileFilter.getId()))
- familyMap.put(f.getName(), f);
- } else
- logger.info("Ignoring " + f.getName());
- }
- }
-
- private class FamilyUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- if (chosenRegistry != null)
- updateFamiliesFromRegistry();
- return null;
- }
-
- @Override
- protected void done() {
- familyBox.removeAllItems();
- try {
- get();
- for (String name : familyMap.keySet())
- familyBox.addItem(name);
- if (!familyMap.isEmpty()) {
- String firstKey = familyMap.firstKey();
- familyBox.setSelectedItem(firstKey);
- updateDescription();
- } else
- familyBox.addItem("No families available");
- } catch (InterruptedException | ExecutionException e) {
- familyBox.addItem("Unable to read families");
- logger.error(e);
- }
-
- notifyObservers();
- familyBox.setEnabled(!familyMap.isEmpty());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
deleted file mode 100644
index faacc35..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.Registry;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class LicenseChooserPanel extends JPanel implements
- Observer<RegistryChoiceMessage> {
- private static final long serialVersionUID = 2175274929391537032L;
- private static final Logger logger = getLogger(LicenseChooserPanel.class);
-
- private JComboBox<String> licenseBox = new JComboBox<>();
- private SortedMap<String, License> licenseMap = new TreeMap<>();
- private Registry registry;
-
- public LicenseChooserPanel() {
- super();
- licenseBox.setPrototypeDisplayValue(LONG_STRING);
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = NONE;
- this.add(new JLabel("License:"), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = BOTH;
- this.add(licenseBox, gbc);
-
- licenseBox.setEditable(false);
- licenseBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED)
- setLicense(licenseMap.get(licenseBox.getSelectedItem()));
- }
- });
- }
-
- protected void setLicense(License license) {
- if (license != null)
- licenseBox.setToolTipText("<html>" + license.getDescription()
- + "</html>");
- else
- licenseBox.setToolTipText(null);
- }
-
- @Override
- public void notify(Observable<RegistryChoiceMessage> sender,
- RegistryChoiceMessage message) throws Exception {
- try {
- registry = message.getChosenRegistry();
- updateLicenseModel();
- } catch (Exception e) {
- logger.error("failure when handling license choice", e);
- }
- }
-
- private void updateLicenseModel() {
- licenseMap.clear();
- licenseBox.removeAllItems();
- licenseBox.setToolTipText(null);
- licenseBox.addItem("Reading licenses");
- licenseBox.setEnabled(false);
- new LicenseUpdater().execute();
- }
-
- public License getChosenLicense() {
- if (licenseBox.getSelectedIndex() < 0)
- return null;
- Object selectedItem = licenseBox.getSelectedItem();
- return licenseMap.get(selectedItem);
- }
-
- private class LicenseUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- List<License> licenses;
- if (registry == null)
- return null;
- try {
- licenses = registry.getLicenses();
- if (licenses == null)
- return null;
- } catch (ComponentException e) {
- logger.error("failure when reading licenses from registry", e);
- throw e;
- } catch (NullPointerException e) {
- logger.error("unexpected exception when reading licenses", e);
- throw e;
- }
- for (License license : licenses)
- try {
- String name = license.getName();
- licenseMap.put(name, license);
- } catch (NullPointerException e) {
- logger.error("could not get name of license", e);
- }
- return null;
- }
-
- @Override
- protected void done() {
- licenseBox.removeAllItems();
- try {
- get();
- } catch (InterruptedException | ExecutionException e1) {
- logger.error(e1);
- licenseBox.addItem("Unable to read licenses");
- licenseBox.setEnabled(false);
- return;
- }
- for (String name : licenseMap.keySet())
- licenseBox.addItem(name);
- if (licenseMap.isEmpty()) {
- licenseBox.addItem("No licenses available");
- licenseBox.setEnabled(false);
- return;
- }
-
- String firstKey = licenseMap.firstKey();
- License preferredLicense = null;
- try {
- preferredLicense = registry.getPreferredLicense();
- } catch (ComponentException e) {
- logger.error("failed to get preferred license", e);
- }
- if (preferredLicense != null) {
- licenseBox.setSelectedItem(preferredLicense.getName());
- setLicense(preferredLicense);
- } else {
- licenseBox.setSelectedItem(firstKey);
- setLicense(licenseMap.get(firstKey));
- }
- licenseBox.setEnabled(true);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
deleted file mode 100644
index 53d89c4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static javax.swing.BorderFactory.createEtchedBorder;
-import static javax.swing.BorderFactory.createTitledBorder;
-import static javax.swing.border.TitledBorder.CENTER;
-import static javax.swing.border.TitledBorder.TOP;
-
-import java.awt.BorderLayout;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class PrefixPanel extends JPanel {
- private DefaultTableModel prefixModel = new DefaultTableModel(10, 2) {
- @Override
- public boolean isCellEditable(int row, int column) {
- // all cells false
- return false;
- };
- };
-
- private JTable prefixTable = new JTable(prefixModel);
-
- public PrefixPanel(ProfileChooserPanel profilePanel) {
- this();
- profilePanel.addObserver(new Observer<ProfileChoiceMessage>() {
- @Override
- public void notify(Observable<ProfileChoiceMessage> sender,
- ProfileChoiceMessage message) throws Exception {
- profileChanged(message.getChosenProfile());
- }
- });
- }
-
- public PrefixPanel() {
- super(new BorderLayout());
- prefixModel.setColumnIdentifiers(new String[] { "Prefix", "URL" });
- add(new JScrollPane(prefixTable), BorderLayout.CENTER);
- setBorder(createTitledBorder(createEtchedBorder(), "Prefixes", CENTER,
- TOP));
- }
-
- public TreeMap<String, String> getPrefixMap() {
- TreeMap<String, String> result = new TreeMap<>();
- for (int i = 0; i < prefixModel.getRowCount(); i++)
- result.put((String) prefixModel.getValueAt(i, 0),
- (String) prefixModel.getValueAt(i, 1));
- return result;
- }
-
- private void profileChanged(Profile newProfile) throws ComponentException {
- prefixModel.setRowCount(0);
- if (newProfile != null)
- for (Entry<String, String> entry : newProfile.getPrefixMap()
- .entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- if (!value.endsWith("#"))
- value += "#";
- prefixModel.addRow(new String[] { key, value });
- }
- validate();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
deleted file mode 100644
index 432cf44..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import io.github.taverna_extras.component.api.profile.Profile;
-
-/**
- * @author alanrw
- */
-public class ProfileChoiceMessage {
- private final Profile chosenProfile;
-
- public ProfileChoiceMessage(Profile chosenProfile) {
- this.chosenProfile = chosenProfile;
- }
-
- /**
- * @return the chosenProfile
- */
- public Profile getChosenProfile() {
- return chosenProfile;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
deleted file mode 100644
index f8b0148..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class ProfileChooserPanel extends JPanel implements
- Observer<RegistryChoiceMessage>, Observable<ProfileChoiceMessage> {
- private static final String READING_MSG = "Reading profiles";
- private static final String PROFILE_LABEL = "Profile:";
- private static final long serialVersionUID = 2175274929391537032L;
- private static Logger logger = getLogger(ProfileChooserPanel.class);
-
- private final List<Observer<ProfileChoiceMessage>> observers = new ArrayList<>();
- private final JComboBox<String> profileBox = new JComboBox<>();
- private final SortedMap<String, Profile> profileMap = new TreeMap<>();
-
- private Registry registry;
-
- public ProfileChooserPanel(RegistryChooserPanel registryPanel) {
- this();
- registryPanel.addObserver(new Observer<RegistryChoiceMessage>() {
- @Override
- public void notify(Observable<RegistryChoiceMessage> sender,
- RegistryChoiceMessage message) throws Exception {
- try {
- registry = message.getChosenRegistry();
- updateProfileModel();
- } catch (Exception e) {
- logger.error("failure when notifying about chosen registry", e);
- }
- }
- });
- }
-
- public ProfileChooserPanel() {
- super();
- profileBox.setPrototypeDisplayValue(LONG_STRING);
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = NONE;
- this.add(new JLabel(PROFILE_LABEL), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = BOTH;
- this.add(profileBox, gbc);
- profileBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED)
- setProfile(profileMap.get(profileBox.getSelectedItem()));
- }
- });
-
- profileBox.setEditable(false);
- }
-
- @Override
- public void notify(Observable<RegistryChoiceMessage> sender,
- RegistryChoiceMessage message) throws Exception {
- try {
- registry = message.getChosenRegistry();
- updateProfileModel();
- } catch (Exception e) {
- logger.error("failure when notifying about chosen registry", e);
- }
- }
-
- private void updateProfileModel() {
- profileMap.clear();
- profileBox.removeAllItems();
- profileBox.setToolTipText(null);
- profileBox.addItem(READING_MSG);
- profileBox.setEnabled(false);
- new ProfileUpdater().execute();
- }
-
- private void setProfile(Profile componentProfile) {
- if (componentProfile != null)
- profileBox.setToolTipText(componentProfile.getDescription());
- else
- profileBox.setToolTipText(null);
-
- Profile chosenProfile = getChosenProfile();
- ProfileChoiceMessage message = new ProfileChoiceMessage(chosenProfile);
- for (Observer<ProfileChoiceMessage> o : getObservers())
- try {
- o.notify(this, message);
- } catch (Exception e) {
- logger.error("failure when notifying about profile choice", e);
- }
- }
-
- public Profile getChosenProfile() {
- if (profileBox.getSelectedIndex() < 0)
- return null;
-
- return profileMap.get(profileBox.getSelectedItem());
- }
-
- private class ProfileUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- if (registry == null)
- return null;
- List<Profile> componentProfiles;
- try {
- componentProfiles = registry.getComponentProfiles();
- } catch (ComponentException e) {
- logger.error("failed to get profiles", e);
- throw e;
- } catch (NullPointerException e) {
- logger.error("failed to get profiles", e);
- throw e;
- }
- for (Profile profile : componentProfiles)
- try {
- profileMap.put(profile.getName(), profile);
- } catch (NullPointerException e) {
- logger.error("failure getting profile name", e);
- }
-
- return null;
- }
-
- @Override
- protected void done() {
- profileBox.removeAllItems();
- try {
- get();
- for (String name : profileMap.keySet())
- profileBox.addItem(name);
- if (!profileMap.isEmpty()) {
- String firstKey = profileMap.firstKey();
- profileBox.setSelectedItem(firstKey);
- setProfile(profileMap.get(firstKey));
- } else
- profileBox.addItem("No profiles available");
- } catch (InterruptedException | ExecutionException e) {
- logger.error(e);
- profileBox.addItem("Unable to read profiles");
- }
- profileBox.setEnabled(!profileMap.isEmpty());
- }
- }
-
- @Override
- public void addObserver(Observer<ProfileChoiceMessage> observer) {
- observers.add(observer);
- ProfileChoiceMessage message = new ProfileChoiceMessage(getChosenProfile());
- try {
- observer.notify(this, message);
- } catch (Exception e) {
- logger.error("failure when notifying about profile choice", e);
- }
- }
-
- @Override
- public void removeObserver(Observer<ProfileChoiceMessage> observer) {
- observers.remove(observer);
- }
-
- @Override
- public List<Observer<ProfileChoiceMessage>> getObservers() {
- return observers;
- }
-}
[14/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/BaseProfileLocator.java
new file mode 100644
index 0000000..989f411
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/BaseProfileLocator.java
@@ -0,0 +1,154 @@
+package io.github.taverna_extras.component.profile;
+/*
+ * 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.
+ */
+
+import static java.util.Locale.UK;
+import static org.apache.commons.httpclient.HttpStatus.SC_OK;
+import static org.apache.commons.io.FileUtils.writeStringToFile;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.params.HttpClientParams;
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import org.apache.taverna.configuration.app.ApplicationConfiguration;
+
+public class BaseProfileLocator {
+ private static final String BASE_PROFILE_PATH = "BaseProfile.xml";
+ private static final String BASE_PROFILE_URI = "http://build.mygrid.org.uk/taverna/BaseProfile.xml";
+ private static final int TIMEOUT = 5000;
+ private static final String pattern = "EEE, dd MMM yyyy HH:mm:ss z";
+ private static final SimpleDateFormat format = new SimpleDateFormat(
+ pattern, UK);
+
+ private Logger logger = getLogger(BaseProfileLocator.class);
+ private ApplicationConfiguration appConfig;
+ private ComponentProfileImpl profile;
+
+ private void locateBaseProfile() {
+ File baseProfileFile = getBaseProfileFile();
+ @SuppressWarnings("unused")
+ boolean load = false;
+ Long remoteBaseProfileTime = null;
+ long localBaseProfileTime = -1;
+
+ HttpClientParams params = new HttpClientParams();
+ params.setConnectionManagerTimeout(TIMEOUT);
+ params.setSoTimeout(TIMEOUT);
+ HttpClient client = new HttpClient(params);
+
+ try {
+ remoteBaseProfileTime = getRemoteBaseProfileTimestamp(client);
+ logger.info("NoticeTime is " + remoteBaseProfileTime);
+ } catch (URISyntaxException e) {
+ logger.error("URI problem", e);
+ } catch (IOException e) {
+ logger.info("Could not read base profile", e);
+ } catch (ParseException e) {
+ logger.error("Could not parse last-modified time", e);
+ }
+ if (baseProfileFile.exists())
+ localBaseProfileTime = baseProfileFile.lastModified();
+
+ try {
+ if ((remoteBaseProfileTime != null)
+ && (remoteBaseProfileTime > localBaseProfileTime)) {
+ profile = new ComponentProfileImpl(null, new URL(BASE_PROFILE_URI),
+ null);
+ writeStringToFile(baseProfileFile, profile.getXML());
+ }
+ } catch (MalformedURLException e) {
+ logger.error("URI problem", e);
+ profile = null;
+ } catch (ComponentException e) {
+ logger.error("Component Registry problem", e);
+ profile = null;
+ } catch (IOException e) {
+ logger.error("Unable to write profile", e);
+ profile = null;
+ }
+
+ try {
+ if ((profile == null) && baseProfileFile.exists())
+ profile = new ComponentProfileImpl(null, baseProfileFile.toURI()
+ .toURL(), null);
+ } catch (Exception e) {
+ logger.error("URI problem", e);
+ profile = null;
+ }
+ }
+
+ private long parseTime(String timestamp) throws ParseException {
+ timestamp = timestamp.trim();
+ if (timestamp.endsWith(" GMT"))
+ timestamp = timestamp.substring(0, timestamp.length() - 3)
+ + " +0000";
+ else if (timestamp.endsWith(" BST"))
+ timestamp = timestamp.substring(0, timestamp.length() - 3)
+ + " +0100";
+ return format.parse(timestamp).getTime();
+ }
+
+ private long getRemoteBaseProfileTimestamp(HttpClient client)
+ throws URISyntaxException, IOException, HttpException,
+ ParseException {
+ URI baseProfileURI = new URI(BASE_PROFILE_URI);
+ HttpMethod method = new GetMethod(baseProfileURI.toString());
+ int statusCode = client.executeMethod(method);
+ if (statusCode != SC_OK) {
+ logger.warn("HTTP status " + statusCode + " while getting "
+ + baseProfileURI);
+ return -1;
+ }
+ Header h = method.getResponseHeader("Last-Modified");
+ if (h == null)
+ return -1;
+ return parseTime(h.getValue());
+ }
+
+ private File getBaseProfileFile() {
+ File config = new File(appConfig.getApplicationHomeDir().toFile(), "conf");
+ if (!config.exists())
+ config.mkdir();
+ return new File(config, BASE_PROFILE_PATH);
+ }
+
+ public synchronized ComponentProfileImpl getProfile() {
+ if (profile == null)
+ locateBaseProfile();
+ return profile;
+ }
+
+ public void setAppConfig(ApplicationConfiguration appConfig) {
+ this.appConfig = appConfig;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ComponentProfileImpl.java
new file mode 100644
index 0000000..6c7a5b0
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ComponentProfileImpl.java
@@ -0,0 +1,683 @@
+package io.github.taverna_extras.component.profile;
+/*
+ * 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.
+ */
+
+import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
+import static java.lang.System.identityHashCode;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyMap;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.ActivityProfile;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.api.profile.PortProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import io.github.taverna_extras.component.api.profile.doc.Activity;
+import io.github.taverna_extras.component.api.profile.doc.Ontology;
+import io.github.taverna_extras.component.api.profile.doc.Port;
+import io.github.taverna_extras.component.api.profile.doc.Profile;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
+
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.ontology.OntProperty;
+import static org.apache.taverna.workflowmodel.health.HealthCheck.NO_PROBLEM;
+import org.apache.taverna.workflowmodel.health.RemoteHealthChecker;
+
+/**
+ * A ComponentProfile specifies the inputs, outputs and semantic annotations
+ * that a Component must contain.
+ *
+ * @author David Withers
+ */
+public class ComponentProfileImpl implements
+ io.github.taverna_extras.component.api.profile.Profile {
+ private static final Logger logger = getLogger(ComponentProfileImpl.class);
+ private static final Map<String, OntModel> ontologyModels = new HashMap<>();
+ private static final JAXBContext jaxbContext;
+ private BaseProfileLocator base;
+ static {
+ try {
+ jaxbContext = JAXBContext.newInstance(Profile.class);
+ } catch (JAXBException e) {
+ // Should never happen! Represents a critical error
+ throw new Error(
+ "Failed to initialize profile deserialization engine", e);
+ }
+ }
+ private io.github.taverna_extras.component.api.profile.Profile parent;
+ private Profile profileDoc;
+ private ExceptionHandling exceptionHandling;
+ private Registry parentRegistry = null;
+ private final Object lock = new Object();
+ private Exception loaderException = null;
+ protected volatile boolean loaded = false;
+
+ public ComponentProfileImpl(URL profileURL, BaseProfileLocator base)
+ throws ComponentException {
+ this(null, profileURL, base);
+ }
+
+ public ComponentProfileImpl(String profileString, BaseProfileLocator base)
+ throws ComponentException {
+ this(null, profileString, base);
+ }
+
+ public ComponentProfileImpl(Registry registry, URI profileURI,
+ BaseProfileLocator base) throws ComponentException,
+ MalformedURLException {
+ this(registry, profileURI.toURL(), base);
+ }
+
+ public ComponentProfileImpl(Registry registry, URL profileURL,
+ BaseProfileLocator base) throws ComponentException {
+ logger.info("Loading profile in " + identityHashCode(this) + " from "
+ + profileURL);
+ this.base = base;
+ try {
+ URL url = profileURL;
+ if (url.getProtocol().startsWith("http"))
+ url = new URI(url.getProtocol(), url.getAuthority(),
+ url.getPath(), url.getQuery(), url.getRef()).toURL();
+ loadProfile(this, url, base);
+ } catch (MalformedURLException e) {
+ logger.warn("Malformed URL? " + profileURL);
+ } catch (URISyntaxException e) {
+ logger.warn("Malformed URL? " + profileURL);
+ }
+ parentRegistry = registry;
+ }
+
+ public ComponentProfileImpl(Registry registry, String profileString,
+ BaseProfileLocator base) throws ComponentException {
+ logger.info("Loading profile in " + identityHashCode(this)
+ + " from string");
+ this.base = base;
+ loadProfile(this, profileString, base);
+ this.parentRegistry = registry;
+ }
+
+ private static void loadProfile(final ComponentProfileImpl profile,
+ final Object source, BaseProfileLocator base) {
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ Date start = new Date();
+ if (source instanceof URL)
+ loadProfileFromURL(profile, (URL) source);
+ else if (source instanceof String)
+ loadProfileFromString(profile, (String) source);
+ else
+ throw new IllegalArgumentException(
+ "Bad type of profile source: " + source.getClass());
+ Date end = new Date();
+ logger.info("Loaded profile in " + identityHashCode(profile)
+ + " (in " + (end.getTime() - start.getTime())
+ + " msec)");
+ }
+ };
+ if (base.getProfile() == null)
+ // Must load the base profile synchronously, to avoid deadlock
+ r.run();
+ else
+ new Thread(r).start();
+ }
+
+ private static void loadProfileFromURL(ComponentProfileImpl profile, URL source) {
+ try {
+ URLConnection conn = source.openConnection();
+ try {
+ conn.addRequestProperty("Accept", "application/xml,*/*;q=0.1");
+ } catch (Exception e) {
+ }
+ try (InputStream is = conn.getInputStream()) {
+ profile.profileDoc = jaxbContext.createUnmarshaller()
+ .unmarshal(new StreamSource(is), Profile.class)
+ .getValue();
+ }
+ } catch (FileNotFoundException e) {
+ profile.loaderException = e;
+ logger.warn("URL not readable: " + source);
+ } catch (Exception e) {
+ profile.loaderException = e;
+ logger.warn("Failed to load profile.", e);
+ }
+ synchronized (profile.lock) {
+ profile.loaded = true;
+ profile.lock.notifyAll();
+ }
+ }
+
+ private static void loadProfileFromString(ComponentProfileImpl profile,
+ String source) {
+ try {
+ profile.profileDoc = jaxbContext
+ .createUnmarshaller()
+ .unmarshal(new StreamSource(new StringReader(source)),
+ Profile.class).getValue();
+ } catch (Exception e) {
+ profile.loaderException = e;
+ logger.warn("Failed to load profile.", e);
+ }
+ synchronized (profile.lock) {
+ profile.loaded = true;
+ profile.lock.notifyAll();
+ }
+ }
+
+ @Override
+ public Registry getComponentRegistry() {
+ return parentRegistry;
+ }
+
+ @Override
+ public String getXML() throws ComponentException {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ jaxbContext.createMarshaller().marshal(getProfileDocument(),
+ stringWriter);
+ return stringWriter.toString();
+ } catch (JAXBException e) {
+ throw new ComponentException("Unable to serialize profile.", e);
+ }
+ }
+
+ @Override
+ public Profile getProfileDocument() throws ComponentException {
+ try {
+ synchronized (lock) {
+ while (!loaded)
+ lock.wait();
+ if (loaderException != null) {
+ if (loaderException instanceof FileNotFoundException)
+ throw new ComponentException(
+ "Profile not found/readable: "
+ + loaderException.getMessage(),
+ loaderException);
+ throw new ComponentException(
+ "Problem loading profile definition: "
+ + loaderException.getMessage(),
+ loaderException);
+ }
+ return profileDoc;
+ }
+ } catch (InterruptedException e) {
+ logger.info("Interrupted during wait for lock.", e);
+ return null;
+ }
+ }
+
+ @Override
+ public String getId() {
+ try {
+ return getProfileDocument().getId();
+ } catch (ComponentException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String getName() {
+ try {
+ return getProfileDocument().getName();
+ } catch (ComponentException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ try {
+ return getProfileDocument().getDescription();
+ } catch (ComponentException e) {
+ return null;
+ }
+ }
+
+ /**
+ * @return Is this the base profile?
+ */
+ private boolean isBase() {
+ if (base == null)
+ return true;
+ Object o = base.getProfile();
+ return o == null || o == this;
+ }
+
+ private synchronized io.github.taverna_extras.component.api.profile.Profile parent()
+ throws ComponentException {
+ if (parent == null) {
+ try {
+ if (!isBase() && getProfileDocument().getExtends() != null
+ && parentRegistry != null) {
+ parent = parentRegistry
+ .getComponentProfile(getProfileDocument()
+ .getExtends().getProfileId());
+ if (parent != null)
+ return parent;
+ }
+ } catch (ComponentException e) {
+ }
+ parent = new EmptyProfile();
+ }
+ return parent;
+ }
+
+ @Override
+ public String getOntologyLocation(String ontologyId) {
+ String ontologyURI = null;
+ try {
+ for (Ontology ontology : getProfileDocument().getOntology())
+ if (ontology.getId().equals(ontologyId))
+ ontologyURI = ontology.getValue();
+ } catch (ComponentException e) {
+ }
+ if ((ontologyURI == null) && !isBase())
+ ontologyURI = base.getProfile().getOntologyLocation(ontologyId);
+ return ontologyURI;
+ }
+
+ private Map<String, String> internalGetPrefixMap()
+ throws ComponentException {
+ Map<String, String> result = new TreeMap<>();
+ try {
+ for (Ontology ontology : getProfileDocument().getOntology())
+ result.put(ontology.getId(), ontology.getValue());
+ } catch (ComponentException e) {
+ }
+ result.putAll(parent().getPrefixMap());
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getPrefixMap() throws ComponentException {
+ Map<String, String> result = internalGetPrefixMap();
+ if (!isBase())
+ result.putAll(base.getProfile().getPrefixMap());
+ return result;
+ }
+
+ private OntModel readOntologyFromURI(String ontologyId, String ontologyURI) {
+ logger.info("Reading ontology for " + ontologyId + " from "
+ + ontologyURI);
+ OntModel model = createOntologyModel();
+ try {
+ URL url = new URL(ontologyURI);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ // CRITICAL: must be retrieved as correct content type
+ conn.addRequestProperty("Accept",
+ "application/rdf+xml,application/xml;q=0.9");
+ try (InputStream in = conn.getInputStream()) {
+ // TODO Consider whether the encoding is handled right
+ // ontologyModel.read(in, url.toString());
+ model.read(new StringReader(IOUtils.toString(in, "UTF-8")),
+ url.toString());
+ }
+ } catch (MalformedURLException e) {
+ logger.error("Problem reading ontology " + ontologyId, e);
+ return null;
+ } catch (IOException e) {
+ logger.error("Problem reading ontology " + ontologyId, e);
+ return null;
+ } catch (NullPointerException e) {
+ // TODO Why is this different?
+ logger.error("Problem reading ontology " + ontologyId, e);
+ model = createOntologyModel();
+ }
+ return model;
+ }
+
+ private boolean isAccessible(String ontologyURI) {
+ return RemoteHealthChecker.contactEndpoint(null, ontologyURI).getResultId() == NO_PROBLEM;
+ }
+
+ @Override
+ public OntModel getOntology(String ontologyId) {
+ String ontologyURI = getOntologyLocation(ontologyId);
+ synchronized (ontologyModels) {
+ if (ontologyModels.containsKey(ontologyURI))
+ return ontologyModels.get(ontologyURI);
+ }
+
+ // Drop out of critical section while we do I/O
+ if (!isAccessible(ontologyURI)) {
+ logger.warn("Catastrophic problem contacting ontology source.");
+ // Catastrophic problem?!
+ synchronized (ontologyModels) {
+ ontologyModels.put(ontologyURI, null);
+ }
+ return null;
+ }
+ OntModel model = readOntologyFromURI(ontologyId, ontologyURI);
+
+ synchronized (ontologyModels) {
+ if (model != null && !ontologyModels.containsKey(ontologyURI)) {
+ ontologyModels.put(ontologyURI, model);
+ }
+ return ontologyModels.get(ontologyURI);
+ }
+ }
+
+ @Override
+ public List<PortProfile> getInputPortProfiles() {
+ List<PortProfile> portProfiles = new ArrayList<>();
+ try {
+ for (Port port : getProfileDocument().getComponent().getInputPort())
+ portProfiles.add(new PortProfileImpl(this, port));
+ } catch (ComponentException e) {
+ }
+ if (!isBase())
+ portProfiles.addAll(base.getProfile().getInputPortProfiles());
+ return portProfiles;
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles()
+ throws ComponentException {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ List<PortProfile> portProfiles = getInputPortProfiles();
+ portProfiles.addAll(parent().getInputPortProfiles());
+ for (PortProfile portProfile : portProfiles)
+ saProfiles.addAll(portProfile.getSemanticAnnotations());
+ if (!isBase())
+ saProfiles.addAll(base.getProfile()
+ .getInputSemanticAnnotationProfiles());
+ return getUniqueSemanticAnnotationProfiles(saProfiles);
+ }
+
+ @Override
+ public List<PortProfile> getOutputPortProfiles() {
+ List<PortProfile> portProfiles = new ArrayList<>();
+ try {
+ for (Port port : getProfileDocument().getComponent()
+ .getOutputPort())
+ portProfiles.add(new PortProfileImpl(this, port));
+ } catch (ComponentException e) {
+ }
+ if (!isBase())
+ portProfiles.addAll(base.getProfile().getOutputPortProfiles());
+ return portProfiles;
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles()
+ throws ComponentException {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ List<PortProfile> portProfiles = getOutputPortProfiles();
+ portProfiles.addAll(parent().getOutputPortProfiles());
+ for (PortProfile portProfile : portProfiles)
+ saProfiles.addAll(portProfile.getSemanticAnnotations());
+ if (!isBase())
+ saProfiles.addAll(base.getProfile()
+ .getOutputSemanticAnnotationProfiles());
+ return getUniqueSemanticAnnotationProfiles(saProfiles);
+ }
+
+ @Override
+ public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
+ List<io.github.taverna_extras.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
+ try {
+ for (Activity activity : getProfileDocument().getComponent()
+ .getActivity())
+ activityProfiles.add(new ActivityProfileImpl(this, activity));
+ } catch (ComponentException e) {
+ }
+ return activityProfiles;
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles()
+ throws ComponentException {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ List<ActivityProfile> activityProfiles = getActivityProfiles();
+ activityProfiles.addAll(parent().getActivityProfiles());
+ for (ActivityProfile activityProfile : activityProfiles)
+ saProfiles.addAll(activityProfile.getSemanticAnnotations());
+ if (!isBase())
+ saProfiles.addAll(base.getProfile()
+ .getActivitySemanticAnnotationProfiles());
+ return getUniqueSemanticAnnotationProfiles(saProfiles);
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getSemanticAnnotations()
+ throws ComponentException {
+ List<SemanticAnnotationProfile> saProfiles = getComponentProfiles();
+ saProfiles.addAll(parent().getSemanticAnnotations());
+ if (!isBase())
+ saProfiles.addAll(base.getProfile().getSemanticAnnotations());
+ return saProfiles;
+ }
+
+ private List<SemanticAnnotationProfile> getComponentProfiles() {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ try {
+ for (SemanticAnnotation semanticAnnotation : getProfileDocument()
+ .getComponent().getSemanticAnnotation())
+ saProfiles.add(new SemanticAnnotationProfileImpl(this,
+ semanticAnnotation));
+ } catch (ComponentException e) {
+ }
+ return saProfiles;
+ }
+
+ private List<SemanticAnnotationProfile> getUniqueSemanticAnnotationProfiles(
+ List<SemanticAnnotationProfile> semanticAnnotationProfiles) {
+ List<SemanticAnnotationProfile> uniqueSemanticAnnotations = new ArrayList<>();
+ Set<OntProperty> predicates = new HashSet<>();
+ for (SemanticAnnotationProfile semanticAnnotationProfile : semanticAnnotationProfiles) {
+ OntProperty prop = semanticAnnotationProfile.getPredicate();
+ if (prop != null && !predicates.contains(prop)) {
+ predicates.add(prop);
+ uniqueSemanticAnnotations.add(semanticAnnotationProfile);
+ }
+ }
+ return uniqueSemanticAnnotations;
+ }
+
+ @Override
+ public ExceptionHandling getExceptionHandling() {
+ try {
+ if (exceptionHandling == null
+ && getProfileDocument().getComponent()
+ .getExceptionHandling() != null)
+ exceptionHandling = new ExceptionHandling(getProfileDocument()
+ .getComponent().getExceptionHandling());
+ } catch (ComponentException e) {
+ }
+ return exceptionHandling;
+ }
+
+ @Override
+ public String toString() {
+ return "ComponentProfile" + "\n Name : " + getName()
+ + "\n Description : " + getDescription()
+ + "\n InputPortProfiles : " + getInputPortProfiles()
+ + "\n OutputPortProfiles : " + getOutputPortProfiles();
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + ((getId() == null) ? 0 : getId().hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ComponentProfileImpl other = (ComponentProfileImpl) obj;
+ if (!loaded || !other.loaded)
+ return false;
+ if (getId() == null)
+ return other.getId() == null;
+ return getId().equals(other.getId());
+ }
+
+ public OntClass getClass(String className) {
+ try {
+ for (Ontology ontology : getProfileDocument().getOntology()) {
+ OntModel ontModel = getOntology(ontology.getId());
+ if (ontModel != null) {
+ OntClass result = ontModel.getOntClass(className);
+ if (result != null)
+ return result;
+ }
+ }
+ } catch (ComponentException e) {
+ }
+ return null;
+ }
+
+ @Override
+ public void delete() throws ComponentException {
+ throw new ComponentException("Deletion not supported.");
+ }
+}
+
+/**
+ * A simple do-nothing implementation of a profile. Used when there's no other
+ * option for what a <i>real</i> profile extends.
+ *
+ * @author Donal Fellows
+ */
+final class EmptyProfile implements
+ io.github.taverna_extras.component.api.profile.Profile {
+ @Override
+ public String getName() {
+ return "";
+ }
+
+ @Override
+ public String getDescription() {
+ return "";
+ }
+
+ @Override
+ public Registry getComponentRegistry() {
+ return null;
+ }
+
+ @Override
+ public String getXML() throws ComponentException {
+ throw new ComponentException("No document.");
+ }
+
+ @Override
+ public Profile getProfileDocument() {
+ return new Profile();
+ }
+
+ @Override
+ public String getId() {
+ return "";
+ }
+
+ @Override
+ public String getOntologyLocation(String ontologyId) {
+ return "";
+ }
+
+ @Override
+ public Map<String, String> getPrefixMap() {
+ return emptyMap();
+ }
+
+ @Override
+ public OntModel getOntology(String ontologyId) {
+ return null;
+ }
+
+ @Override
+ public List<PortProfile> getInputPortProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<PortProfile> getOutputPortProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles() {
+ return emptyList();
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getSemanticAnnotations() {
+ return emptyList();
+ }
+
+ @Override
+ public ExceptionHandling getExceptionHandling() {
+ return null;
+ }
+
+ @Override
+ public void delete() throws ComponentException {
+ throw new ComponentException("Deletion forbidden.");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/PortProfileImpl.java
new file mode 100644
index 0000000..53a1190
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/PortProfileImpl.java
@@ -0,0 +1,58 @@
+package io.github.taverna_extras.component.profile;
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.github.taverna_extras.component.api.profile.PortProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import io.github.taverna_extras.component.api.profile.doc.Port;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
+
+/**
+ * Specifies the semantic annotations that a port must have.
+ *
+ * @author David Withers
+ */
+public class PortProfileImpl implements PortProfile {
+ private final ComponentProfileImpl componentProfile;
+ private final Port port;
+
+ public PortProfileImpl(ComponentProfileImpl componentProfile, Port port) {
+ this.componentProfile = componentProfile;
+ this.port = port;
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getSemanticAnnotations() {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ for (SemanticAnnotation annotation : port.getSemanticAnnotation())
+ saProfiles.add(new SemanticAnnotationProfileImpl(componentProfile,
+ annotation));
+ return saProfiles;
+ }
+
+ @Override
+ public String toString() {
+ return "PortProfile \n SemanticAnnotations : "
+ + getSemanticAnnotations();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/SemanticAnnotationProfileImpl.java
new file mode 100644
index 0000000..a3b5afa
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/SemanticAnnotationProfileImpl.java
@@ -0,0 +1,175 @@
+package io.github.taverna_extras.component.profile;
+/*
+ * 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.
+ */
+
+import static java.io.File.createTempFile;
+import static org.apache.commons.io.FileUtils.writeStringToFile;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
+
+import org.apache.jena.ontology.Individual;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.ontology.OntResource;
+
+/**
+ * Definition of a semantic annotation for a component element.
+ *
+ * @author David Withers
+ */
+public class SemanticAnnotationProfileImpl implements SemanticAnnotationProfile {
+ private static final Logger log = getLogger(SemanticAnnotationProfileImpl.class);
+ private final ComponentProfileImpl componentProfile;
+ private final SemanticAnnotation semanticAnnotation;
+
+ public SemanticAnnotationProfileImpl(ComponentProfileImpl componentProfile,
+ SemanticAnnotation semanticAnnotation) {
+ this.componentProfile = componentProfile;
+ this.semanticAnnotation = semanticAnnotation;
+ }
+
+ /**
+ * Returns the ontology that defines semantic annotation.
+ *
+ * @return the ontology that defines semantic annotation
+ */
+ @Override
+ public OntModel getOntology() {
+ String ontology = semanticAnnotation.getOntology();
+ if (ontology == null)
+ return null;
+ return componentProfile.getOntology(ontology);
+ }
+
+ /**
+ * Returns the predicate for the semantic annotation.
+ *
+ * @return the predicate for the semantic annotation
+ */
+ @Override
+ public OntProperty getPredicate() {
+ OntModel ontology = getOntology();
+ if (ontology == null)
+ return null;
+ String predicate = semanticAnnotation.getPredicate();
+ if (predicate == null)
+ return null;
+ if (predicate.contains("foaf")) {
+ StringWriter sw = new StringWriter();
+ ontology.writeAll(sw, null, "RDF/XML");
+ try {
+ writeStringToFile(createTempFile("foaf", null), sw.toString());
+ } catch (IOException e) {
+ log.info("failed to write foaf ontology to temporary file", e);
+ }
+ }
+
+ return ontology.getOntProperty(predicate);
+ }
+
+ @Override
+ public String getPredicateString() {
+ return semanticAnnotation.getPredicate();
+ }
+
+ @Override
+ public String getClassString() {
+ return semanticAnnotation.getClazz();
+ }
+
+ /**
+ * Returns the individual that the semantic annotation must use.
+ *
+ * May be null if no explicit individual is required.
+ *
+ * @return the individual that the semantic annotation must use
+ */
+ @Override
+ public Individual getIndividual() {
+ String individual = semanticAnnotation.getValue();
+ if (individual == null || individual.isEmpty())
+ return null;
+ return getOntology().getIndividual(individual);
+ }
+
+ /**
+ * Returns the individuals in the range of the predicate defined in the
+ * ontology.
+ *
+ * @return the individuals in the range of the predicate defined in the
+ * ontology
+ */
+ @Override
+ public List<Individual> getIndividuals() {
+ OntModel ontology = getOntology();
+ OntProperty prop = getPredicate();
+ if (ontology == null || prop == null)
+ return new ArrayList<>();
+ OntResource range = prop.getRange();
+ if (range == null)
+ return new ArrayList<>();
+ return ontology.listIndividuals(range).toList();
+ }
+
+ @Override
+ public Integer getMinOccurs() {
+ return semanticAnnotation.getMinOccurs().intValue();
+ }
+
+ @Override
+ public Integer getMaxOccurs() {
+ try {
+ return Integer.valueOf(semanticAnnotation.getMaxOccurs());
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "SemanticAnnotation " + "\n Predicate : " + getPredicate()
+ + "\n Individual : " + getIndividual() + "\n Individuals : "
+ + getIndividuals();
+ }
+
+ @Override
+ public OntClass getRangeClass() {
+ String clazz = this.getClassString();
+ if (clazz != null)
+ return componentProfile.getClass(clazz);
+
+ OntProperty prop = getPredicate();
+ if (prop == null)
+ return null;
+ OntResource range = prop.getRange();
+ if (range != null && range.isClass())
+ return range.asClass();
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ClientVersion.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ClientVersion.java
new file mode 100644
index 0000000..c9fda59
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ClientVersion.java
@@ -0,0 +1,51 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class ClientVersion {
+ private static final String DEFAULT_VERSION = "1.1.0";
+ public static final String VERSION;
+
+ private ClientVersion() {
+ }
+
+ static {
+ InputStream is = ClientVersion.class
+ .getResourceAsStream("version.properties");
+ String version = DEFAULT_VERSION;
+ if (is != null)
+ try {
+ Properties p = new Properties();
+ p.load(is);
+ version = p.getProperty("project.version", DEFAULT_VERSION);
+ } catch (IOException e) {
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ VERSION = version;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/Component.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/Component.java
new file mode 100644
index 0000000..afdf2b8
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/Component.java
@@ -0,0 +1,161 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+
+import static java.util.Collections.synchronizedSortedMap;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * A Component is a building block for creating Taverna workflows. Components
+ * and must comply with the ComponentProfile of their ComponentFamily.
+ *
+ * @author David Withers
+ */
+public abstract class Component implements
+ io.github.taverna_extras.component.api.Component {
+ private String name;
+ private String description;
+ private URL url;
+ /**
+ * Mapping from version numbers to version implementations.
+ */
+ protected SortedMap<Integer, Version> versionMap = new TreeMap<>();
+
+ protected Component(URL url) {
+ this.url = url;
+ }
+
+ protected Component(String url) {
+ try {
+ this.url = new URL(url);
+ } catch (MalformedURLException e) {
+ // nothing
+ }
+ }
+
+ protected Component(File fileDir) {
+ try {
+ this.url = fileDir.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // nothing
+ }
+ }
+
+ @Override
+ public final synchronized String getName() {
+ if (name == null)
+ name = internalGetName();
+ return name;
+ }
+
+ /**
+ * The real implementation of the name fetching. Caching already handled.
+ *
+ * @return The name of the component.
+ */
+ protected abstract String internalGetName();
+
+ @Override
+ public final synchronized String getDescription() {
+ if (description == null)
+ description = internalGetDescription();
+ return description;
+ }
+
+ /**
+ * The real implementation of the description fetching. Caching already
+ * handled.
+ *
+ * @return The description of the component.
+ */
+ protected abstract String internalGetDescription();
+
+ @Override
+ public final SortedMap<Integer, Version> getComponentVersionMap() {
+ synchronized (versionMap) {
+ checkComponentVersionMap();
+ return synchronizedSortedMap(versionMap);
+ }
+ }
+
+ private void checkComponentVersionMap() {
+ if (versionMap.isEmpty())
+ populateComponentVersionMap();
+ }
+
+ /**
+ * Create the contents of the {@link #versionMap} field.
+ */
+ protected abstract void populateComponentVersionMap();
+
+ @Override
+ public final Version getComponentVersion(Integer version)
+ throws ComponentException {
+ synchronized (versionMap) {
+ checkComponentVersionMap();
+ return versionMap.get(version);
+ }
+ }
+
+ @Override
+ public final Version addVersionBasedOn(WorkflowBundle bundle,
+ String revisionComment) throws ComponentException {
+ Version result = internalAddVersionBasedOn(bundle, revisionComment);
+ synchronized (versionMap) {
+ checkComponentVersionMap();
+ versionMap.put(result.getVersionNumber(), result);
+ }
+ return result;
+ }
+
+ /**
+ * Manufacture a new version of a component. Does not add to the overall
+ * version map.
+ *
+ * @param bundle
+ * The definition of the component.
+ * @param revisionComment
+ * The description of the version.
+ * @return The new version of the component.
+ * @throws RegistryException
+ */
+ protected abstract Version internalAddVersionBasedOn(WorkflowBundle bundle,
+ String revisionComment) throws ComponentException;
+
+ @Override
+ public final URL getComponentURL() {
+ return url;
+ }
+
+ @Override
+ public void delete() throws ComponentException {
+ getFamily().removeComponent(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentFamily.java
new file mode 100644
index 0000000..ce8a782
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentFamily.java
@@ -0,0 +1,161 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * A ComponentFamily is a collection of Components that share the same
+ * ComponentProfile.
+ *
+ * @author David Withers
+ */
+public abstract class ComponentFamily implements
+ io.github.taverna_extras.component.api.Family {
+ private Registry parentRegistry;
+ private String name;
+ private String description;
+ private Profile componentProfile;
+ private ComponentUtil util;
+
+ protected Map<String, Component> componentCache = new HashMap<>();
+
+ public ComponentFamily(Registry componentRegistry, ComponentUtil util) {
+ this.parentRegistry = componentRegistry;
+ this.util = util;
+ }
+
+ @Override
+ public Registry getComponentRegistry() {
+ return parentRegistry;
+ }
+
+ @Override
+ public final synchronized String getName() {
+ if (name == null) {
+ name = internalGetName();
+ }
+ return name;
+ }
+
+ protected abstract String internalGetName();
+
+ @Override
+ public final synchronized String getDescription() {
+ if (description == null) {
+ description = internalGetDescription();
+ }
+ return description;
+ }
+
+ protected abstract String internalGetDescription();
+
+ @Override
+ public final synchronized Profile getComponentProfile()
+ throws ComponentException {
+ if (componentProfile == null)
+ componentProfile = internalGetComponentProfile();
+ if (componentProfile == null) {
+ Profile baseProfile = util.getBaseProfile();
+ if (baseProfile != null) {
+ return baseProfile;
+ }
+ }
+ return componentProfile;
+ }
+
+ protected abstract Profile internalGetComponentProfile()
+ throws ComponentException;
+
+ @Override
+ public final List<Component> getComponents() throws ComponentException {
+ checkComponentCache();
+ return new ArrayList<>(componentCache.values());
+ }
+
+ private void checkComponentCache() throws ComponentException {
+ synchronized (componentCache) {
+ if (componentCache.isEmpty())
+ populateComponentCache();
+ }
+ }
+
+ protected abstract void populateComponentCache() throws ComponentException;
+
+ @Override
+ public final Component getComponent(String componentName)
+ throws ComponentException {
+ checkComponentCache();
+ return componentCache.get(componentName);
+ }
+
+ @Override
+ public final Version createComponentBasedOn(String componentName,
+ String description, WorkflowBundle bundle) throws ComponentException {
+ if (componentName == null)
+ throw new ComponentException("Component name must not be null");
+ if (bundle == null)
+ throw new ComponentException("workflow must not be null");
+ checkComponentCache();
+ if (componentCache.containsKey(componentName))
+ throw new ComponentException("Component name already used");
+ Version version = internalCreateComponentBasedOn(componentName,
+ description, bundle);
+ synchronized (componentCache) {
+ Component c = version.getComponent();
+ componentCache.put(componentName, c);
+ }
+ return version;
+ }
+
+ protected abstract Version internalCreateComponentBasedOn(
+ String componentName, String description, WorkflowBundle bundle)
+ throws ComponentException;
+
+ @Override
+ public final void removeComponent(Component component)
+ throws ComponentException {
+ if (component != null) {
+ checkComponentCache();
+ synchronized (componentCache) {
+ componentCache.remove(component.getName());
+ }
+ internalRemoveComponent(component);
+ }
+ }
+
+ protected abstract void internalRemoveComponent(Component component)
+ throws ComponentException;
+
+ @Override
+ public void delete() throws ComponentException {
+ getComponentRegistry().removeComponentFamily(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentImplementationCache.java
new file mode 100644
index 0000000..91846a3
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentImplementationCache.java
@@ -0,0 +1,75 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import static java.lang.System.currentTimeMillis;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class ComponentImplementationCache {
+ private class Entry {
+ WorkflowBundle implementation;
+ long timestamp;
+ }
+ private final long VALIDITY = 15 * 60 * 1000;
+ private final Logger logger = getLogger(ComponentImplementationCache.class);
+ private final Map<Version.ID, Entry> cache = new WeakHashMap<>();
+ private ComponentUtil utils;
+
+ public void setComponentUtil(ComponentUtil utils) {
+ this.utils = utils;
+ }
+
+ public WorkflowBundle getImplementation(Version.ID id) throws ComponentException {
+ long now = currentTimeMillis();
+ synchronized (id) {
+ Entry entry = cache.get(id);
+ if (entry != null && entry.timestamp >= now)
+ return entry.implementation;
+ logger.info("before calculate component version for " + id);
+ Version componentVersion;
+ try {
+ componentVersion = utils.getVersion(id);
+ } catch (RuntimeException e) {
+ if (entry != null)
+ return entry.implementation;
+ throw new ComponentException(e.getMessage(), e);
+ }
+ logger.info("calculated component version for " + id + " as "
+ + componentVersion.getVersionNumber() + "; retrieving dataflow");
+ WorkflowBundle implementation = componentVersion.getImplementation();
+ //DataflowValidationReport report = implementation.checkValidity();
+ //logger.info("component version " + id + " incomplete:"
+ // + report.isWorkflowIncomplete() + " valid:"
+ // + report.isValid());
+ entry = new Entry();
+ entry.implementation = implementation;
+ entry.timestamp = now + VALIDITY;
+ return cache.put(id, entry).implementation;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentRegistry.java
new file mode 100644
index 0000000..325da27
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentRegistry.java
@@ -0,0 +1,242 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+
+/**
+ * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
+ *
+ * @author David Withers
+ */
+public abstract class ComponentRegistry implements
+ io.github.taverna_extras.component.api.Registry {
+ protected Map<String, Family> familyCache = new HashMap<>();
+ protected List<Profile> profileCache = new ArrayList<>();
+ protected List<SharingPolicy> permissionCache = new ArrayList<>();
+ protected List<License> licenseCache = new ArrayList<>();
+
+ private URL registryBase;
+
+ protected ComponentRegistry(URL registryBase) throws ComponentException {
+ this.registryBase = registryBase;
+ }
+
+ protected ComponentRegistry(File fileDir) throws ComponentException {
+ try {
+ this.registryBase = fileDir.toURI().toURL();
+ } catch (MalformedURLException e) {
+ throw new ComponentException(e);
+ }
+ }
+
+ @Override
+ public final List<Family> getComponentFamilies() throws ComponentException {
+ checkFamilyCache();
+ return new ArrayList<Family>(familyCache.values());
+ }
+
+ private void checkFamilyCache() throws ComponentException {
+ synchronized (familyCache) {
+ if (familyCache.isEmpty())
+ populateFamilyCache();
+ }
+ }
+
+ protected abstract void populateFamilyCache() throws ComponentException;
+
+ @Override
+ public final Family getComponentFamily(String familyName)
+ throws ComponentException {
+ checkFamilyCache();
+ return familyCache.get(familyName);
+ }
+
+ @Override
+ public final Family createComponentFamily(String familyName,
+ Profile componentProfile, String description, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ if (familyName == null)
+ throw new ComponentException(
+ "Component family name must not be null");
+ if (componentProfile == null)
+ throw new ComponentException("Component profile must not be null");
+ if (getComponentFamily(familyName) != null)
+ throw new ComponentException("Component family already exists");
+
+ Family result = internalCreateComponentFamily(familyName,
+ componentProfile, description, license, sharingPolicy);
+ checkFamilyCache();
+ synchronized (familyCache) {
+ familyCache.put(familyName, result);
+ }
+ return result;
+ }
+
+ protected abstract Family internalCreateComponentFamily(String familyName,
+ Profile componentProfile, String description, License license,
+ SharingPolicy sharingPolicy) throws ComponentException;
+
+ @Override
+ public final void removeComponentFamily(Family componentFamily)
+ throws ComponentException {
+ if (componentFamily != null) {
+ checkFamilyCache();
+ synchronized (familyCache) {
+ familyCache.remove(componentFamily.getName());
+ }
+ internalRemoveComponentFamily(componentFamily);
+ }
+ }
+
+ protected abstract void internalRemoveComponentFamily(Family componentFamily)
+ throws ComponentException;
+
+ @Override
+ public final URL getRegistryBase() {
+ return registryBase;
+ }
+
+ @Override
+ public final String getRegistryBaseString() {
+ String urlString = getRegistryBase().toString();
+ if (urlString.endsWith("/"))
+ urlString = urlString.substring(0, urlString.length() - 1);
+ return urlString;
+ }
+
+ private void checkProfileCache() throws ComponentException {
+ synchronized (profileCache) {
+ if (profileCache.isEmpty())
+ populateProfileCache();
+ }
+ }
+
+ protected abstract void populateProfileCache() throws ComponentException;
+
+ @Override
+ public final List<Profile> getComponentProfiles() throws ComponentException {
+ checkProfileCache();
+ return profileCache;
+ }
+
+ @Override
+ public final Profile getComponentProfile(String id)
+ throws ComponentException {
+ // TODO use a map instead of a *linear search*...
+ for (Profile p : getComponentProfiles())
+ if (p.getId().equals(id))
+ return p;
+ return null;
+ }
+
+ @Override
+ public final Profile addComponentProfile(Profile componentProfile,
+ License license, SharingPolicy sharingPolicy)
+ throws ComponentException {
+ if (componentProfile == null) {
+ throw new ComponentException("componentProfile is null");
+ }
+ Profile result = null;
+ checkProfileCache();
+ for (Profile p : getComponentProfiles())
+ if (p.getId().equals(componentProfile.getId())) {
+ result = p;
+ break;
+ }
+
+ if (result == null) {
+ result = internalAddComponentProfile(componentProfile, license,
+ sharingPolicy);
+ synchronized (profileCache) {
+ profileCache.add(result);
+ }
+ }
+ return result;
+ }
+
+ protected abstract Profile internalAddComponentProfile(
+ Profile componentProfile, License license,
+ SharingPolicy sharingPolicy) throws ComponentException;
+
+ private void checkPermissionCache() {
+ synchronized (permissionCache) {
+ if (permissionCache.isEmpty())
+ populatePermissionCache();
+ }
+ }
+
+ protected abstract void populatePermissionCache();
+
+ @Override
+ public final List<SharingPolicy> getPermissions() throws ComponentException {
+ checkPermissionCache();
+ return permissionCache;
+ }
+
+ private void checkLicenseCache() {
+ synchronized (licenseCache) {
+ if (licenseCache.isEmpty())
+ populateLicenseCache();
+ }
+ }
+
+ protected abstract void populateLicenseCache();
+
+ @Override
+ public final List<License> getLicenses() throws ComponentException {
+ checkLicenseCache();
+ return licenseCache;
+ }
+
+ protected License getLicenseByAbbreviation(String licenseString)
+ throws ComponentException {
+ checkLicenseCache();
+ for (License l : getLicenses())
+ if (l.getAbbreviation().equals(licenseString))
+ return l;
+ return null;
+ }
+
+ @Override
+ public abstract License getPreferredLicense() throws ComponentException;
+
+ @Override
+ public abstract Set<Version.ID> searchForComponents(String prefixString,
+ String text) throws ComponentException;
+
+ @Override
+ public String toString() {
+ String[] names = getClass().getName().split("\\.");
+ return names[names.length-1] + ": " + registryBase;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentUtil.java
new file mode 100644
index 0000000..cc31f05
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentUtil.java
@@ -0,0 +1,130 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.profile.BaseProfileLocator;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
+import org.springframework.beans.factory.annotation.Required;
+
+/**
+ * @author alanrw
+ * @author dkf
+ */
+public class ComponentUtil implements ComponentFactory {
+ private NewComponentRegistryFactory netLocator;
+ private BaseProfileLocator base;
+ private LocalComponentRegistryFactory fileLocator;
+
+ private final Map<String, Registry> cache = new HashMap<>();
+
+ @Required
+ public void setNetworkLocator(NewComponentRegistryFactory locator) {
+ this.netLocator = locator;
+ }
+
+ @Required
+ public void setFileLocator(LocalComponentRegistryFactory fileLocator) {
+ this.fileLocator = fileLocator;
+ }
+
+ @Required
+ public void setBaseLocator(BaseProfileLocator base) {
+ this.base = base;
+ }
+
+ @Override
+ public Registry getRegistry(URL registryBase) throws ComponentException {
+ Registry registry = cache.get(registryBase.toString());
+ if (registry != null)
+ return registry;
+
+ if (registryBase.getProtocol().startsWith("http")) {
+ if (!netLocator.verifyBase(registryBase))
+ throw new ComponentException(
+ "Unable to establish credentials for " + registryBase);
+ registry = netLocator.getComponentRegistry(registryBase);
+ } else
+ registry = fileLocator.getComponentRegistry(registryBase);
+ cache.put(registryBase.toString(), registry);
+ return registry;
+ }
+
+ @Override
+ public Family getFamily(URL registryBase, String familyName)
+ throws ComponentException {
+ return getRegistry(registryBase).getComponentFamily(familyName);
+ }
+
+ @Override
+ public Component getComponent(URL registryBase, String familyName,
+ String componentName) throws ComponentException {
+ return getRegistry(registryBase).getComponentFamily(familyName)
+ .getComponent(componentName);
+ }
+
+ @Override
+ public Version getVersion(URL registryBase, String familyName,
+ String componentName, Integer componentVersion)
+ throws ComponentException {
+ return getRegistry(registryBase).getComponentFamily(familyName)
+ .getComponent(componentName)
+ .getComponentVersion(componentVersion);
+ }
+
+ @Override
+ public Version getVersion(Version.ID ident) throws ComponentException {
+ return getVersion(ident.getRegistryBase(), ident.getFamilyName(),
+ ident.getComponentName(), ident.getComponentVersion());
+ }
+
+ @Override
+ public Component getComponent(Version.ID ident) throws ComponentException {
+ return getComponent(ident.getRegistryBase(), ident.getFamilyName(),
+ ident.getComponentName());
+ }
+
+ @Override
+ public Profile getProfile(URL url) throws ComponentException {
+ Profile p = new ComponentProfileImpl(url, base);
+ p.getProfileDocument(); // force immediate loading
+ return p;
+ }
+
+ @Override
+ public Profile getBaseProfile() throws ComponentException {
+ return base.getProfile();
+ }
+
+ public BaseProfileLocator getBaseProfileLocator() {
+ return base;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersion.java
new file mode 100644
index 0000000..ab95218
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersion.java
@@ -0,0 +1,77 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public abstract class ComponentVersion implements
+ io.github.taverna_extras.component.api.Version {
+ private Integer versionNumber;
+ private String description;
+ private Component component;
+
+ protected ComponentVersion(Component component) {
+ this.component = component;
+ }
+
+ @Override
+ public final synchronized Integer getVersionNumber() {
+ if (versionNumber == null)
+ versionNumber = internalGetVersionNumber();
+ return versionNumber;
+ }
+
+ protected abstract Integer internalGetVersionNumber();
+
+ @Override
+ public final synchronized String getDescription() {
+ if (description == null)
+ description = internalGetDescription();
+
+ return description;
+ }
+
+ protected abstract String internalGetDescription();
+
+ @Override
+ public final synchronized WorkflowBundle getImplementation()
+ throws ComponentException {
+ // Cached in dataflow cache
+ return internalGetImplementation();
+ }
+
+ protected abstract WorkflowBundle internalGetImplementation()
+ throws ComponentException;
+
+ @Override
+ public final Component getComponent() {
+ return component;
+ }
+
+ @Override
+ public ID getID() {
+ Component c = getComponent();
+ return new ComponentVersionIdentification(c.getRegistry()
+ .getRegistryBase(), c.getFamily().getName(), c.getName(),
+ getVersionNumber());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersionIdentification.java
new file mode 100644
index 0000000..4cecab5
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/ComponentVersionIdentification.java
@@ -0,0 +1,212 @@
+
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentVersionIdentification implements
+ io.github.taverna_extras.component.api.Version.ID {
+ private static final long serialVersionUID = 1768548650702925916L;
+ private URL registryBase;
+ private String familyName;
+ private String componentName;
+ private Integer componentVersion;
+
+ public ComponentVersionIdentification(URL registryBase, String familyName,
+ String componentName, Integer componentVersion) {
+ super();
+ this.registryBase = registryBase;
+ this.familyName = familyName;
+ this.componentName = componentName;
+ this.componentVersion = componentVersion;
+ }
+
+ public ComponentVersionIdentification(Registry registry, Family family,
+ io.github.taverna_extras.component.api.Component component, Integer version) {
+ this(registry.getRegistryBase(), family.getName(), component.getName(), version);
+ }
+
+ public ComponentVersionIdentification(Version.ID toBeCopied) {
+ this.registryBase = toBeCopied.getRegistryBase();
+ this.familyName = toBeCopied.getFamilyName();
+ this.componentName = toBeCopied.getComponentName();
+ this.componentVersion = toBeCopied.getComponentVersion();
+ }
+
+ /**
+ * @return the registryBase
+ */
+ @Override
+ public URL getRegistryBase() {
+ return registryBase;
+ }
+
+ /**
+ * @return the familyName
+ */
+ @Override
+ public String getFamilyName() {
+ return familyName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ @Override
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @return the componentVersion
+ */
+ @Override
+ public Integer getComponentVersion() {
+ return componentVersion;
+ }
+
+ /**
+ * @param componentVersion
+ * the componentVersion to set
+ */
+ public void setComponentVersion(Integer componentVersion) {
+ this.componentVersion = componentVersion;
+ }
+
+ /**
+ * @param registryBase
+ * the registryBase to set
+ */
+ public void setRegistryBase(URL registryBase) {
+ this.registryBase = registryBase;
+ }
+
+ /**
+ * @param familyName
+ * the familyName to set
+ */
+ public void setFamilyName(String familyName) {
+ this.familyName = familyName;
+ }
+
+ /**
+ * @param componentName
+ * the componentName to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((componentName == null) ? 0 : componentName.hashCode());
+ result = prime
+ * result
+ + ((componentVersion == null) ? 0 : componentVersion.hashCode());
+ result = prime * result
+ + ((familyName == null) ? 0 : familyName.hashCode());
+ result = prime * result
+ + ((registryBase == null) ? 0 : registryBase.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ComponentVersionIdentification other = (ComponentVersionIdentification) obj;
+ if (componentName == null) {
+ if (other.componentName != null)
+ return false;
+ } else if (!componentName.equals(other.componentName))
+ return false;
+ if (componentVersion == null) {
+ if (other.componentVersion != null)
+ return false;
+ } else if (!componentVersion.equals(other.componentVersion))
+ return false;
+ if (familyName == null) {
+ if (other.familyName != null)
+ return false;
+ } else if (!familyName.equals(other.familyName))
+ return false;
+ if (registryBase == null) {
+ if (other.registryBase != null)
+ return false;
+ } else if (!registryBase.toString().equals(other.registryBase.toString()))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getComponentName() + " V. " + getComponentVersion()
+ + " in family " + getFamilyName() + " on "
+ + getRegistryBase().toExternalForm();
+ }
+
+ @Override
+ public boolean mostlyEqualTo(ID id) {
+ if (this == id)
+ return true;
+ if (id == null)
+ return false;
+ if (getClass() != id.getClass())
+ return false;
+ ComponentVersionIdentification other = (ComponentVersionIdentification) id;
+ if (componentName == null) {
+ if (other.componentName != null)
+ return false;
+ } else if (!componentName.equals(other.componentName))
+ return false;
+ if (familyName == null) {
+ if (other.familyName != null)
+ return false;
+ } else if (!familyName.equals(other.familyName))
+ return false;
+ if (registryBase == null) {
+ if (other.registryBase != null)
+ return false;
+ } else if (!registryBase.toString().equals(other.registryBase.toString()))
+ return false;
+ return true;
+ }
+
+ @Override
+ public boolean mostlyEqualTo(io.github.taverna_extras.component.api.Component c) {
+ return mostlyEqualTo(new ComponentVersionIdentification(c.getRegistry(), c.getFamily(), c, 0));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponent.java
new file mode 100644
index 0000000..697f57f
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponent.java
@@ -0,0 +1,149 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+
+import static org.apache.commons.io.FileUtils.readFileToString;
+import static org.apache.commons.io.FileUtils.writeStringToFile;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.NoSuchElementException;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.registry.Component;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+class LocalComponent extends Component {
+ static final String COMPONENT_FILENAME = "dataflow.t2flow";
+ private final File componentDir;
+ private final LocalComponentRegistry registry;
+ private final LocalComponentFamily family;
+ private static Logger logger = getLogger(LocalComponent.class);
+ private SystemUtils system;
+
+ public LocalComponent(File componentDir, LocalComponentRegistry registry,
+ LocalComponentFamily family, SystemUtils system) {
+ super(componentDir);
+ this.system = system;
+ this.componentDir = componentDir;
+ this.registry = registry;
+ this.family = family;
+ }
+
+ @Override
+ protected final Version internalAddVersionBasedOn(WorkflowBundle bundle,
+ String revisionComment) throws ComponentException {
+ Integer nextVersionNumber = 1;
+ try {
+ nextVersionNumber = getComponentVersionMap().lastKey() + 1;
+ } catch (NoSuchElementException e) {
+ // This is OK
+ }
+ File newVersionDir = new File(componentDir,
+ nextVersionNumber.toString());
+ newVersionDir.mkdirs();
+ LocalComponentVersion newComponentVersion = new LocalComponentVersion(
+ this, newVersionDir, system);
+ try {
+ system.saveBundle(bundle, new File(newVersionDir,
+ COMPONENT_FILENAME));
+ } catch (Exception e) {
+ throw new ComponentException("Unable to save component version", e);
+ }
+ File revisionCommentFile = new File(newVersionDir, "description");
+ try {
+ writeStringToFile(revisionCommentFile, revisionComment, ENC);
+ } catch (IOException e) {
+ throw new ComponentException("Could not write out description", e);
+ }
+
+ return newComponentVersion;
+ }
+
+ @Override
+ protected final String internalGetName() {
+ return componentDir.getName();
+ }
+
+ @Override
+ protected final void populateComponentVersionMap() {
+ for (File subFile : componentDir.listFiles())
+ try {
+ if (subFile.isDirectory())
+ versionMap.put(Integer.valueOf(subFile.getName()),
+ new LocalComponentVersion(this, subFile, system));
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + ((componentDir == null) ? 0 : componentDir.hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ LocalComponent other = (LocalComponent) obj;
+ if (componentDir == null)
+ return (other.componentDir == null);
+ return componentDir.equals(other.componentDir);
+ }
+
+ @Override
+ protected final String internalGetDescription() {
+ File descriptionFile = new File(componentDir, "description");
+ try {
+ if (descriptionFile.isFile())
+ return readFileToString(descriptionFile);
+ } catch (IOException e) {
+ logger.error("failed to get description from " + descriptionFile, e);
+ }
+ return "";
+ }
+
+ @Override
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ @Override
+ public Family getFamily() {
+ return family;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentFamily.java
new file mode 100644
index 0000000..b9a692c
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentFamily.java
@@ -0,0 +1,155 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.commons.io.FileUtils.readFileToString;
+import static org.apache.commons.io.FileUtils.writeStringToFile;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentFamily;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+class LocalComponentFamily extends ComponentFamily {
+ private static Logger logger = getLogger(LocalComponentFamily.class);
+ private static final String PROFILE = "profile";
+
+ private final File componentFamilyDir;
+ private SystemUtils system;
+
+ public LocalComponentFamily(LocalComponentRegistry parentRegistry,
+ File componentFamilyDir, ComponentUtil util, SystemUtils system) {
+ super(parentRegistry, util);
+ this.componentFamilyDir = componentFamilyDir;
+ this.system = system;
+ }
+
+ @Override
+ protected final Profile internalGetComponentProfile()
+ throws ComponentException {
+ LocalComponentRegistry parentRegistry = (LocalComponentRegistry) getComponentRegistry();
+ File profileFile = new File(componentFamilyDir, PROFILE);
+ String profileName;
+ try {
+ profileName = readFileToString(profileFile, ENC);
+ } catch (IOException e) {
+ throw new ComponentException("Unable to read profile name", e);
+ }
+ for (Profile p : parentRegistry.getComponentProfiles())
+ if (p.getName().equals(profileName))
+ return p;
+ return null;
+ }
+
+ @Override
+ protected void populateComponentCache() throws ComponentException {
+ for (File subFile : componentFamilyDir.listFiles()) {
+ if (!subFile.isDirectory())
+ continue;
+ LocalComponent newComponent = new LocalComponent(subFile,
+ (LocalComponentRegistry) getComponentRegistry(), this,
+ system);
+ componentCache.put(newComponent.getName(), newComponent);
+ }
+ }
+
+ @Override
+ protected final String internalGetName() {
+ return componentFamilyDir.getName();
+ }
+
+ @Override
+ protected final Version internalCreateComponentBasedOn(
+ String componentName, String description, WorkflowBundle bundle)
+ throws ComponentException {
+ File newSubFile = new File(componentFamilyDir, componentName);
+ if (newSubFile.exists())
+ throw new ComponentException("Component already exists");
+ newSubFile.mkdirs();
+ File descriptionFile = new File(newSubFile, "description");
+ try {
+ writeStringToFile(descriptionFile, description, ENC);
+ } catch (IOException e) {
+ throw new ComponentException("Could not write out description", e);
+ }
+ LocalComponent newComponent = new LocalComponent(newSubFile,
+ (LocalComponentRegistry) getComponentRegistry(), this, system);
+
+ return newComponent.addVersionBasedOn(bundle, "Initial version");
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + ((componentFamilyDir == null) ? 0 : componentFamilyDir
+ .hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ LocalComponentFamily other = (LocalComponentFamily) obj;
+ if (componentFamilyDir == null)
+ return (other.componentFamilyDir == null);
+ return componentFamilyDir.equals(other.componentFamilyDir);
+ }
+
+ @Override
+ protected final String internalGetDescription() {
+ File descriptionFile = new File(componentFamilyDir, "description");
+ try {
+ if (descriptionFile.isFile())
+ return readFileToString(descriptionFile);
+ } catch (IOException e) {
+ logger.error("failed to get description from " + descriptionFile, e);
+ }
+ return "";
+ }
+
+ @Override
+ protected final void internalRemoveComponent(Component component)
+ throws ComponentException {
+ File componentDir = new File(componentFamilyDir, component.getName());
+ try {
+ deleteDirectory(componentDir);
+ } catch (IOException e) {
+ throw new ComponentException("Unable to delete component", e);
+ }
+ }
+}
[06/27] incubator-taverna-plugin-component git commit: package name
-> io.github.taverna_extras.component.*
Posted by st...@apache.org.
package name -> io.github.taverna_extras.component.*
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/commit/66649799
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/66649799
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/66649799
Branch: refs/heads/master
Commit: 666497993c6991debdef249991035bbf21eedd21
Parents: 09a209b
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Jun 29 11:50:14 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Jun 29 11:50:14 2018 +0100
----------------------------------------------------------------------
.../taverna/component/ui/ComponentAction.java | 4 +-
.../ui/ComponentActivityConfigurationBean.java | 26 ++---
.../component/ui/ComponentConstants.java | 2 +-
...bstractSemanticAnnotationContextualView.java | 8 +-
.../annotation/AnnotateSemanticsMenuAction.java | 6 +-
.../AnnotationPropertyPanelFactory.java | 6 +-
.../DatatypePropertyPanelFactory.java | 6 +-
.../DateTimePropertyPanelFactory.java | 4 +-
.../FallbackPropertyPanelFactory.java | 4 +-
.../component/ui/annotation/GreyBorder.java | 2 +-
...jectPropertyWithIndividualsPanelFactory.java | 8 +-
.../ui/annotation/PropertyPanelFactorySPI.java | 6 +-
.../SemanticAnnotationContextualView.java | 16 +--
...SemanticAnnotationContextualViewFactory.java | 6 +-
.../ui/annotation/SemanticAnnotationPanel.java | 8 +-
.../ui/annotation/SemanticAnnotationUtils.java | 8 +-
.../ui/annotation/TurtleContextualView.java | 6 +-
.../ui/annotation/TurtleInputPanel.java | 4 +-
.../annotation/UnrecognizedStatementPanel.java | 2 +-
.../annotation/UnresolveablePredicatePanel.java | 4 +-
.../ui/config/ComponentConfigurationPanel.java | 22 ++--
.../ui/config/ComponentConfigureAction.java | 4 +-
.../ComponentDataflowHealthCheckExplainer.java | 10 +-
.../ui/file/ComponentDataflowHealthChecker.java | 18 ++--
.../component/ui/file/ComponentOpener.java | 10 +-
.../component/ui/file/ComponentSaver.java | 20 ++--
.../component/ui/file/FileManagerObserver.java | 10 +-
.../component/ui/localworld/LocalWorld.java | 6 +-
.../AbstractContextComponentMenuAction.java | 4 +-
.../ui/menu/ComponentConfigureMenuAction.java | 8 +-
.../component/ui/menu/ComponentMenu.java | 2 +-
.../component/ui/menu/ComponentSection.java | 2 +-
.../ui/menu/NestedWorkflowCreationDialog.java | 4 +-
.../menu/NestedWorkflowCreatorMenuAction.java | 2 +-
...penComponentFromComponentActivityAction.java | 12 +--
...omponentFromComponentActivityMenuAction.java | 6 +-
.../ui/menu/ReplaceByComponentAction.java | 28 ++---
.../ui/menu/ReplaceByComponentMenuAction.java | 8 +-
.../component/AbstractComponentMenuAction.java | 4 +-
.../ui/menu/component/ComponentCloseAction.java | 6 +-
.../component/ComponentCloseMenuAction.java | 6 +-
.../ui/menu/component/ComponentCopyAction.java | 28 ++---
.../menu/component/ComponentCopyMenuAction.java | 8 +-
.../menu/component/ComponentCreatorSupport.java | 20 ++--
.../menu/component/ComponentDeleteAction.java | 18 ++--
.../component/ComponentDeleteMenuAction.java | 8 +-
.../ui/menu/component/ComponentMenuAction.java | 4 +-
.../ui/menu/component/ComponentMenuSection.java | 4 +-
.../ui/menu/component/ComponentMergeAction.java | 18 ++--
.../component/ComponentMergeMenuAction.java | 6 +-
.../ui/menu/component/ComponentSaveAction.java | 6 +-
.../menu/component/ComponentSaveMenuAction.java | 6 +-
.../menu/component/ComponentSearchAction.java | 24 ++---
.../component/ComponentSearchMenuAction.java | 8 +-
.../ComponentServiceCreatorAction.java | 8 +-
.../ComponentServiceCreatorMenuAction.java | 6 +-
.../ComponentWorkflowCreatorAction.java | 10 +-
.../ComponentWorkflowCreatorMenuAction.java | 6 +-
.../FileOpenFromComponentMenuAction.java | 6 +-
.../OpenWorkflowFromComponentAction.java | 20 ++--
.../family/ComponentFamilyCreateAction.java | 24 ++---
.../family/ComponentFamilyCreateMenuAction.java | 8 +-
.../family/ComponentFamilyDeleteAction.java | 22 ++--
.../family/ComponentFamilyDeleteMenuAction.java | 8 +-
.../menu/family/ComponentFamilyMenuSection.java | 4 +-
.../profile/ComponentProfileCopyAction.java | 24 ++---
.../profile/ComponentProfileCopyMenuAction.java | 8 +-
.../profile/ComponentProfileDeleteAction.java | 14 +--
.../ComponentProfileDeleteMenuAction.java | 8 +-
.../profile/ComponentProfileImportAction.java | 24 ++---
.../ComponentProfileImportMenuAction.java | 10 +-
.../profile/ComponentProfileMenuSection.java | 4 +-
.../registry/ComponentRegistryManageAction.java | 6 +-
.../ComponentRegistryManageMenuAction.java | 6 +-
.../registry/ComponentRegistryMenuSection.java | 4 +-
.../ui/panel/ComponentChoiceMessage.java | 6 +-
.../ui/panel/ComponentChooserPanel.java | 12 +--
.../ui/panel/ComponentListCellRenderer.java | 10 +-
.../ui/panel/ComponentVersionChooserPanel.java | 14 +--
.../component/ui/panel/FamilyChoiceMessage.java | 4 +-
.../component/ui/panel/FamilyChooserPanel.java | 12 +--
.../component/ui/panel/LicenseChooserPanel.java | 10 +-
.../taverna/component/ui/panel/PrefixPanel.java | 6 +-
.../ui/panel/ProfileChoiceMessage.java | 4 +-
.../component/ui/panel/ProfileChooserPanel.java | 10 +-
...stryAndFamilyChooserComponentEntryPanel.java | 10 +-
.../ui/panel/RegistryAndFamilyChooserPanel.java | 8 +-
.../ui/panel/RegistryChoiceMessage.java | 4 +-
.../ui/panel/RegistryChooserPanel.java | 8 +-
.../component/ui/panel/SearchChoicePanel.java | 14 +--
.../ui/panel/SharingPolicyChooserPanel.java | 10 +-
.../ui/preference/ComponentDefaults.java | 2 +-
.../ui/preference/ComponentPreference.java | 12 +--
.../ui/preference/ComponentPreferencePanel.java | 10 +-
.../ComponentPreferenceUIFactory.java | 2 +-
.../ui/preference/LocalRegistryPanel.java | 2 +-
.../ui/preference/RegistryTableModel.java | 4 +-
.../ui/preference/RemoteRegistryPanel.java | 2 +-
.../serviceprovider/ComponentServiceDesc.java | 22 ++--
.../serviceprovider/ComponentServiceIcon.java | 4 +-
.../ComponentServiceProvider.java | 26 ++---
.../ComponentServiceProviderConfig.java | 12 +--
.../component/ui/serviceprovider/Service.java | 2 +-
.../component/ui/util/ComponentFileType.java | 2 +-
.../component/ui/util/ComponentHealthCheck.java | 10 +-
.../apache/taverna/component/ui/util/Utils.java | 14 +--
.../ComponentActivityContextViewFactory.java | 8 +-
...itySemanticAnnotationContextViewFactory.java | 14 +--
...omponentActivitySemanticAnnotationPanel.java | 8 +-
.../ui/view/ComponentContextViewFactory.java | 6 +-
.../ui/view/ComponentContextualView.java | 6 +-
.../taverna/component/ui/view/ViewUtil.java | 12 +--
...t2.workbench.report.explainer.VisitExplainer | 2 +-
...ponent.ui.annotation.PropertyPanelFactorySPI | 10 +-
.../spring/component-activity-context.xml | 106 +++++++++----------
.../component/activity/ComponentActivity.java | 14 +--
.../ComponentActivityConfigurationBean.java | 26 ++---
.../activity/ComponentActivityFactory.java | 14 +--
.../activity/ComponentActivityLocalChecker.java | 4 +-
.../ComponentActivityUpgradeChecker.java | 8 +-
.../activity/ComponentExceptionFactory.java | 2 +-
.../activity/ComponentHealthCheck.java | 2 +-
.../ComponentImplementationException.java | 2 +-
.../component/activity/ProxyCallback.java | 8 +-
.../component/activity/package-info.java | 2 +-
.../component/profile/ActivityProfileImpl.java | 10 +-
.../component/profile/BaseProfileLocator.java | 4 +-
.../component/profile/ComponentProfileImpl.java | 40 +++----
.../component/profile/PortProfileImpl.java | 10 +-
.../profile/SemanticAnnotationProfileImpl.java | 6 +-
.../component/registry/ClientVersion.java | 2 +-
.../taverna/component/registry/Component.java | 8 +-
.../component/registry/ComponentFamily.java | 14 +--
.../registry/ComponentImplementationCache.java | 6 +-
.../component/registry/ComponentRegistry.java | 16 +--
.../component/registry/ComponentUtil.java | 24 ++---
.../component/registry/ComponentVersion.java | 8 +-
.../ComponentVersionIdentification.java | 16 +--
.../registry/local/LocalComponent.java | 16 +--
.../registry/local/LocalComponentFamily.java | 18 ++--
.../registry/local/LocalComponentRegistry.java | 22 ++--
.../local/LocalComponentRegistryFactory.java | 10 +-
.../registry/local/LocalComponentVersion.java | 10 +-
.../component/registry/standard/Client.java | 10 +-
.../registry/standard/NewComponent.java | 30 +++---
.../registry/standard/NewComponentFamily.java | 20 ++--
.../registry/standard/NewComponentLicense.java | 6 +-
.../registry/standard/NewComponentProfile.java | 14 +--
.../registry/standard/NewComponentRegistry.java | 58 +++++-----
.../standard/NewComponentRegistryFactory.java | 16 +--
.../component/registry/standard/Policy.java | 12 +--
.../registry/standard/annotations/Unused.java | 2 +-
.../standard/annotations/package-info.java | 2 +-
.../registry/standard/package-info.java | 2 +-
.../component/utils/AnnotationUtils.java | 2 +-
.../taverna/component/utils/SystemUtils.java | 6 +-
.../src/main/resources/EmptyProfile.xml | 2 +-
.../spring/component-activity-context.xml | 22 ++--
.../main/resources/NewMyExperimentSchema.xsd | 2 +-
.../taverna/component/AnnotationTest.java | 4 +-
.../component/ComponentActivityTest.java | 8 +-
.../component/registry/ComponentFamilyTest.java | 8 +-
.../registry/ComponentRegistryTest.java | 8 +-
.../component/registry/ComponentTest.java | 10 +-
.../registry/ComponentVersionTest.java | 8 +-
.../taverna/component/registry/Harness.java | 6 +-
.../local/LocalComponentFamilyTest.java | 4 +-
.../local/LocalComponentRegistryTest.java | 6 +-
.../registry/local/LocalComponentTest.java | 4 +-
.../local/LocalComponentVersionTest.java | 4 +-
.../registry/local/RegistrySupport.java | 8 +-
.../standard/NewComponentFamilyTest.java | 4 +-
.../standard/NewComponentRegistryTest.java | 12 +--
.../registry/standard/NewComponentTest.java | 4 +-
.../standard/NewComponentVersionTest.java | 4 +-
.../registry/standard/RegistrySupport.java | 20 ++--
...rity.credentialmanager.CredentialProviderSPI | 2 +-
taverna-component-repository-api/pom.xml | 2 +-
.../apache/taverna/component/api/Component.java | 2 +-
.../component/api/ComponentException.java | 2 +-
.../taverna/component/api/ComponentFactory.java | 4 +-
.../apache/taverna/component/api/Family.java | 4 +-
.../apache/taverna/component/api/License.java | 2 +-
.../apache/taverna/component/api/NamedItem.java | 2 +-
.../apache/taverna/component/api/Registry.java | 4 +-
.../taverna/component/api/SharingPolicy.java | 2 +-
.../apache/taverna/component/api/Version.java | 2 +-
.../component/api/config/ComponentConfig.java | 2 +-
.../api/config/ComponentPropertyNames.java | 2 +-
.../taverna/component/api/package-info.java | 2 +-
.../component/api/profile/ActivityProfile.java | 2 +-
.../component/api/profile/AnnotatedElement.java | 4 +-
.../api/profile/ExceptionHandling.java | 6 +-
.../api/profile/ExceptionReplacement.java | 4 +-
.../component/api/profile/HandleException.java | 4 +-
.../component/api/profile/PortProfile.java | 2 +-
.../taverna/component/api/profile/Profile.java | 10 +-
.../api/profile/SemanticAnnotationProfile.java | 2 +-
.../src/main/resources/ComponentProfile.xsd | 2 +-
199 files changed, 938 insertions(+), 938 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
index 56e82be..f359c9d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui;
+package io.github.taverna_extras.component.ui;
import static java.awt.Color.RED;
import static javax.swing.SwingUtilities.invokeLater;
@@ -26,7 +26,7 @@ import static org.apache.log4j.Logger.getLogger;
import javax.swing.AbstractAction;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.workbench.models.graph.GraphController;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
index 8d95abc..26e673e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui;
+package io.github.taverna_extras.component.ui;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.taverna.component.ui.ComponentConstants.ACTIVITY_URI;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
import java.net.MalformedURLException;
import java.net.URL;
@@ -33,12 +33,12 @@ import java.util.Arrays;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.config.ComponentPropertyNames;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.config.ComponentPropertyNames;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.configurations.Configuration;
@@ -130,7 +130,7 @@ public class ComponentActivityConfigurationBean extends Version.Identifier {
.getComponentProfile().getExceptionHandling();
if (eh != null)
result.outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (org.apache.taverna.component.api.ComponentException e) {
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
logger.error("failed to get exception handling for family", e);
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
index 65edecc..baec10f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui;
+package io.github.taverna_extras.component.ui;
import static java.net.URI.create;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
index 8a0089e..6cc48d0 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NORTHWEST;
import static java.lang.String.CASE_INSENSITIVE_ORDER;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.createSemanticAnnotation;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createSemanticAnnotation;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -47,7 +47,7 @@ import javax.swing.JSeparator;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.taverna.scufl2.api.common.AbstractNamed;
import org.apache.taverna.scufl2.api.common.Named;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
index 423bd94..1543533 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.SOUTH;
@@ -37,8 +37,8 @@ import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.lang.ui.DeselectingButton;
import org.apache.taverna.scufl2.api.activity.Activity;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
index 0f8d642..0dfaf0a 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
import static java.lang.Integer.MIN_VALUE;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.ontology.OntProperty;
import org.apache.jena.rdf.model.RDFNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
index 5a0c478..bd7ebcc 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
import static java.lang.Integer.MIN_VALUE;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.ontology.OntProperty;
import org.apache.jena.rdf.model.RDFNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
index 42b14aa..e9dbda7 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static org.apache.jena.datatypes.xsd.XSDDatatype.XSDdateTime;
import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
@@ -32,7 +32,7 @@ import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.text.DefaultCaret;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.datatypes.xsd.XSDDateTime;
import org.apache.jena.ontology.OntProperty;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
index 3075ae6..efc3b42 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import javax.swing.JComponent;
import javax.swing.JLabel;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
index e3f7445..d5e4fbe 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import java.awt.Color;
import java.awt.Component;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
index e26405c..fefe5c0 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.FlowLayout.RIGHT;
import static java.awt.GridBagConstraints.EAST;
@@ -28,7 +28,7 @@ import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
import static javax.swing.JOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.showInputDialog;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
import java.awt.Component;
import java.awt.FlowLayout;
@@ -46,8 +46,8 @@ import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.ui.localworld.LocalWorld;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.localworld.LocalWorld;
import org.apache.jena.ontology.Individual;
import org.apache.jena.ontology.OntClass;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
index 426ae81..2b8dd7d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.Color.WHITE;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
import javax.swing.JComponent;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
index f183ae8..4aa2b4e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.lang.String.format;
import static org.apache.log4j.Logger.getLogger;
@@ -26,13 +26,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.taverna.scufl2.api.common.AbstractNamed;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
index e27a218..8ec838f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import java.util.Arrays;
import java.util.List;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.common.AbstractNamed;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
index 3f3a1ee..536a87d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.NORTH;
@@ -35,8 +35,8 @@ import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
import java.awt.BorderLayout;
import java.awt.Component;
@@ -58,7 +58,7 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.ontology.OntProperty;
import org.apache.jena.rdf.model.RDFNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
index 4a209e7..68050c0 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel;
import static org.apache.log4j.Logger.getLogger;
@@ -31,9 +31,9 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.taverna.scufl2.api.annotation.Annotation;
import org.apache.taverna.scufl2.api.common.AbstractNamed;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
index 15fc0f3..8489fe6 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
@@ -17,11 +17,11 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.awt.BorderLayout.CENTER;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.findSemanticAnnotation;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getStrippedAnnotationContent;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.findSemanticAnnotation;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getStrippedAnnotationContent;
import static org.slf4j.LoggerFactory.getLogger;
import java.awt.BorderLayout;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
index 22e0a8c..7356cc9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.EAST;
import static java.awt.BorderLayout.SOUTH;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
index 2ad4ed8..67d806d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.lang.String.format;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
index 48c9b7c..a7e2c89 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.annotation;
+package io.github.taverna_extras.component.ui.annotation;
import static java.lang.String.format;
@@ -26,7 +26,7 @@ import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
index ab9e988..712b861 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.config;
+package io.github.taverna_extras.component.ui.config;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.taverna.component.ui.util.Utils.SHORT_STRING;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
@@ -40,11 +40,11 @@ import javax.swing.JComboBox;
import javax.swing.JLabel;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.panel.ComponentListCellRenderer;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentListCellRenderer;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.services.ServiceRegistry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
index ec93191..81c9d2f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.taverna.component.ui.config;
+package io.github.taverna_extras.component.ui.config;
import java.awt.Frame;
import java.awt.event.ActionEvent;
-import org.apache.taverna.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.ComponentFactory;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
index 5fcdcb1..7a2442f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
@@ -17,11 +17,11 @@
* under the License.
*/
-package org.apache.taverna.component.ui.file;
+package io.github.taverna_extras.component.ui.file;
import static java.util.Collections.sort;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static org.apache.taverna.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
import java.util.ArrayList;
import java.util.Comparator;
@@ -31,8 +31,8 @@ import java.util.Set;
import javax.swing.JComponent;
import javax.swing.JTextArea;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.ui.util.ComponentHealthCheck;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
import org.apache.taverna.visit.VisitKind;
import org.apache.taverna.visit.VisitReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
index 6904c36..7ce0c1b 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
@@ -17,22 +17,22 @@
* under the License.
*/
-package org.apache.taverna.component.ui.file;
+package io.github.taverna_extras.component.ui.file;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
-import static org.apache.taverna.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
+import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.ui.util.ComponentHealthCheck;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.visit.VisitReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
index c8f07df..f2e16e6 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.file;
+package io.github.taverna_extras.component.ui.file;
import static org.apache.log4j.Logger.getLogger;
@@ -26,10 +26,10 @@ import java.util.Date;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.Version.ID;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
index f2819f5..19b52d9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.file;
+package io.github.taverna_extras.component.ui.file;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.showConfirmDialog;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
import java.util.ArrayList;
import java.util.Arrays;
@@ -33,14 +33,14 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.scufl2.validation.ValidationReport;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
index 2eb3ba2..8ee99b9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.file;
+package io.github.taverna_extras.component.ui.file;
import static java.awt.Color.WHITE;
import static java.awt.Font.BOLD;
@@ -31,8 +31,8 @@ import java.awt.Insets;
import javax.swing.border.Border;
import org.apache.batik.swing.JSVGCanvas;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
@@ -71,9 +71,9 @@ public class FileManagerObserver implements StartupSPI {
@Override
public boolean startup() {
colours.setPreferredColour(
- "org.apache.taverna.component.registry.Component", COLOR);
+ "io.github.taverna_extras.component.registry.Component", COLOR);
colours.setPreferredColour(
- "org.apache.taverna.component.ComponentActivity", COLOR);
+ "io.github.taverna_extras.component.ComponentActivity", COLOR);
fileManager.addObserver(new Observer<FileManagerEvent>() {
@Override
public void notify(Observable<FileManagerEvent> observable,
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
index 8851644..a35ab61 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.taverna.component.ui.localworld;
+package io.github.taverna_extras.component.ui.localworld;
import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.createTurtle;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createTurtle;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
import java.io.File;
import java.io.FileInputStream;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
index 91d4930..0911a66 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
@@ -17,11 +17,11 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.net.URI;
-import org.apache.taverna.component.api.config.ComponentConfig;
+import io.github.taverna_extras.component.api.config.ComponentConfig;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.core.Processor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
index 27ddcfa..0feb63e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import static javax.swing.Action.NAME;
-import static org.apache.taverna.component.ui.ComponentConstants.ACTIVITY_URI;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.config.ComponentConfigureAction;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
import org.apache.taverna.services.ServiceRegistry;
import org.apache.taverna.workbench.activityicons.ActivityIconManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
index c499ccf..99cec65 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenu;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
index 851de06..337ee73 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenuSection;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
index cff2964..3a467fd 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.NORTH;
@@ -26,7 +26,7 @@ import static java.util.Collections.sort;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.uniqueName;
+import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.BorderLayout;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
index 6a503df..0cdb2ba 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.awt.Dialog;
import java.awt.event.ActionEvent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
index 481f2a0..2bce63a 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import static org.apache.log4j.Logger.getLogger;
@@ -25,11 +25,11 @@ import java.awt.event.ActionEvent;
import java.net.MalformedURLException;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentAction;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
index eb63f96..6f28816 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.core.Processor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
index 06e04ce..ebb51a8 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.SOUTH;
@@ -26,9 +26,9 @@ import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static org.apache.taverna.component.ui.ComponentActivityConfigurationBean.ignorableNames;
-import static org.apache.taverna.component.ui.util.Utils.uniqueName;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean.ignorableNames;
+import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
import java.awt.BorderLayout;
@@ -43,16 +43,16 @@ import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JSeparator;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.ui.panel.ComponentChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.common.Scufl2Tools;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
index 674867e..470ad40 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu;
+package io.github.taverna_extras.component.ui.menu;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.scufl2.api.core.Processor;
import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
index 8239e46..671e190 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
-import static org.apache.taverna.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenuAction;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
index 2f3c220..da22a60 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static org.apache.log4j.Logger.getLogger;
@@ -27,8 +27,8 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
import org.apache.taverna.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
index 7b99200..6c40a5f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.workbench.file.FileManager;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
index 370064c..676a6c9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -38,19 +38,19 @@ import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.ComponentChoiceMessage;
-import org.apache.taverna.component.ui.panel.ComponentChooserPanel;
-import org.apache.taverna.component.ui.panel.ProfileChoiceMessage;
-import org.apache.taverna.component.ui.panel.RegistryAndFamilyChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
index 1fb5d49..3c6db63 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
index 55b66c2..ffe26d8 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@@ -33,15 +33,15 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
[03/27] incubator-taverna-plugin-component git commit: package name
-> io.github.taverna_extras.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
index f80ae90..325da27 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -26,12 +26,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
/**
* A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
@@ -39,7 +39,7 @@ import org.apache.taverna.component.api.profile.Profile;
* @author David Withers
*/
public abstract class ComponentRegistry implements
- org.apache.taverna.component.api.Registry {
+ io.github.taverna_extras.component.api.Registry {
protected Map<String, Family> familyCache = new HashMap<>();
protected List<Profile> profileCache = new ArrayList<>();
protected List<SharingPolicy> permissionCache = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
index 3138e7d..cc31f05 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,17 +22,17 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.profile.BaseProfileLocator;
-import org.apache.taverna.component.profile.ComponentProfileImpl;
-import org.apache.taverna.component.registry.local.LocalComponentRegistryFactory;
-import org.apache.taverna.component.registry.standard.NewComponentRegistryFactory;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.profile.BaseProfileLocator;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
import org.springframework.beans.factory.annotation.Required;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
index 5950bf8..ab95218 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,13 +18,13 @@ package org.apache.taverna.component.registry;
* under the License.
*/
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
public abstract class ComponentVersion implements
- org.apache.taverna.component.api.Version {
+ io.github.taverna_extras.component.api.Version {
private Integer versionNumber;
private String description;
private Component component;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
index 77e366a..4cecab5 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
@@ -1,5 +1,5 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,17 +21,17 @@ package org.apache.taverna.component.registry;
import java.net.URL;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.Version.ID;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
/**
* @author alanrw
*
*/
public class ComponentVersionIdentification implements
- org.apache.taverna.component.api.Version.ID {
+ io.github.taverna_extras.component.api.Version.ID {
private static final long serialVersionUID = 1768548650702925916L;
private URL registryBase;
private String familyName;
@@ -48,7 +48,7 @@ public class ComponentVersionIdentification implements
}
public ComponentVersionIdentification(Registry registry, Family family,
- org.apache.taverna.component.api.Component component, Integer version) {
+ io.github.taverna_extras.component.api.Component component, Integer version) {
this(registry.getRegistryBase(), family.getName(), component.getName(), version);
}
@@ -206,7 +206,7 @@ public class ComponentVersionIdentification implements
}
@Override
- public boolean mostlyEqualTo(org.apache.taverna.component.api.Component c) {
+ public boolean mostlyEqualTo(io.github.taverna_extras.component.api.Component c) {
return mostlyEqualTo(new ComponentVersionIdentification(c.getRegistry(), c.getFamily(), c, 0));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
index c5274b7..697f57f 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,19 +22,19 @@ package org.apache.taverna.component.registry.local;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.commons.io.FileUtils.writeStringToFile;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.registry.local.LocalComponentRegistry.ENC;
+import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
import java.io.File;
import java.io.IOException;
import java.util.NoSuchElementException;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.registry.Component;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.registry.Component;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
index 0e2802e..b9a692c 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,19 +22,19 @@ import static org.apache.commons.io.FileUtils.deleteDirectory;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.commons.io.FileUtils.writeStringToFile;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.registry.local.LocalComponentRegistry.ENC;
+import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.registry.ComponentFamily;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentFamily;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
index 1fe77e0..fd0285d 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -30,16 +30,16 @@ import java.net.URI;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.profile.ComponentProfileImpl;
-import org.apache.taverna.component.registry.ComponentRegistry;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
/**
* A component registry implemented using the local file system. Note that the
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
index 9da53c6..f2625d1 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,10 +24,10 @@ import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.springframework.beans.factory.annotation.Required;
public class LocalComponentRegistryFactory {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
index a890285..976aa8b 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,16 +21,16 @@ package org.apache.taverna.component.registry.local;
import static java.lang.Integer.parseInt;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.registry.local.LocalComponent.COMPONENT_FILENAME;
+import static io.github.taverna_extras.component.registry.local.LocalComponent.COMPONENT_FILENAME;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.ComponentVersion;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentVersion;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
index 34d922c..87b99b1 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -31,7 +31,7 @@ import static java.net.URLEncoder.encode;
import static javax.xml.bind.DatatypeConverter.printBase64Binary;
import static org.apache.commons.io.IOUtils.copy;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.registry.ClientVersion.VERSION;
+import static io.github.taverna_extras.component.registry.ClientVersion.VERSION;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
@@ -58,9 +58,9 @@ import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
-import org.apache.taverna.component.registry.standard.annotations.Unused;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
+import io.github.taverna_extras.component.registry.standard.annotations.Unused;
import org.apache.taverna.security.credentialmanager.CMException;
import org.apache.taverna.security.credentialmanager.CredentialManager;
import org.apache.taverna.security.credentialmanager.UsernamePassword;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
index 7a70bc7..44de963 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,26 +19,26 @@ package org.apache.taverna.component.registry.standard;
*/
import static java.lang.String.format;
-import static org.apache.taverna.component.registry.standard.NewComponentRegistry.logger;
-import static org.apache.taverna.component.registry.standard.Policy.getPolicy;
-import static org.apache.taverna.component.utils.SystemUtils.getElementString;
-import static org.apache.taverna.component.utils.SystemUtils.getValue;
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
+import static io.github.taverna_extras.component.registry.standard.Policy.getPolicy;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
+import static io.github.taverna_extras.component.utils.SystemUtils.getValue;
import java.lang.ref.SoftReference;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.IllegalFormatException;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.registry.Component;
-import org.apache.taverna.component.registry.ComponentVersion;
-import org.apache.taverna.component.registry.api.ComponentType;
-import org.apache.taverna.component.registry.api.Description;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.registry.Component;
+import io.github.taverna_extras.component.registry.ComponentVersion;
+import io.github.taverna_extras.component.registry.api.ComponentType;
+import io.github.taverna_extras.component.registry.api.Description;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
index 911f027..1c16b1e 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,18 +18,18 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import static org.apache.taverna.component.utils.SystemUtils.getElementString;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
import java.util.List;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.registry.ComponentFamily;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.registry.api.ComponentFamilyType;
-import org.apache.taverna.component.registry.api.Description;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentFamily;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
+import io.github.taverna_extras.component.registry.api.Description;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
index 7bee937..5e08b4b 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,8 +18,8 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.registry.api.LicenseType;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.registry.api.LicenseType;
class NewComponentLicense implements License {
private NewComponentRegistry registry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
index fc1c051..372c853 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,16 +18,16 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import static org.apache.taverna.component.utils.SystemUtils.getElementString;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
import java.net.MalformedURLException;
import java.net.URL;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.profile.BaseProfileLocator;
-import org.apache.taverna.component.profile.ComponentProfileImpl;
-import org.apache.taverna.component.registry.api.ComponentProfileType;
-import org.apache.taverna.component.registry.api.Description;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.profile.BaseProfileLocator;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.api.ComponentProfileType;
+import io.github.taverna_extras.component.registry.api.Description;
/**
* Profiles managed by the new-interface component registry.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
index 29e3612..00a549e 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,8 +18,8 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.registry.standard.Policy.PRIVATE;
-import static org.apache.taverna.component.utils.SystemUtils.getElementString;
+import static io.github.taverna_extras.component.registry.standard.Policy.PRIVATE;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
import java.net.URL;
import java.nio.charset.Charset;
@@ -33,32 +33,32 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.Version.ID;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.registry.ComponentRegistry;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.registry.ComponentVersionIdentification;
-import org.apache.taverna.component.registry.api.ComponentDescriptionList;
-import org.apache.taverna.component.registry.api.ComponentFamilyList;
-import org.apache.taverna.component.registry.api.ComponentFamilyType;
-import org.apache.taverna.component.registry.api.ComponentProfileList;
-import org.apache.taverna.component.registry.api.ComponentProfileType;
-import org.apache.taverna.component.registry.api.ComponentType;
-import org.apache.taverna.component.registry.api.Content;
-import org.apache.taverna.component.registry.api.Description;
-import org.apache.taverna.component.registry.api.LicenseList;
-import org.apache.taverna.component.registry.api.LicenseType;
-import org.apache.taverna.component.registry.api.ObjectFactory;
-import org.apache.taverna.component.registry.api.Permissions;
-import org.apache.taverna.component.registry.api.PolicyList;
-import org.apache.taverna.component.utils.AnnotationUtils;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
+import io.github.taverna_extras.component.registry.api.ComponentDescriptionList;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyList;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
+import io.github.taverna_extras.component.registry.api.ComponentProfileList;
+import io.github.taverna_extras.component.registry.api.ComponentProfileType;
+import io.github.taverna_extras.component.registry.api.ComponentType;
+import io.github.taverna_extras.component.registry.api.Content;
+import io.github.taverna_extras.component.registry.api.Description;
+import io.github.taverna_extras.component.registry.api.LicenseList;
+import io.github.taverna_extras.component.registry.api.LicenseType;
+import io.github.taverna_extras.component.registry.api.ObjectFactory;
+import io.github.taverna_extras.component.registry.api.Permissions;
+import io.github.taverna_extras.component.registry.api.PolicyList;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.security.credentialmanager.CredentialManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
index 9e413ff..43dc37d 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,18 +18,18 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import static org.apache.taverna.component.registry.standard.NewComponentRegistry.jaxbContext;
-import static org.apache.taverna.component.registry.standard.NewComponentRegistry.logger;
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.jaxbContext;
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.ComponentRegistry;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.AnnotationUtils;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.apache.taverna.security.credentialmanager.CredentialManager;
import org.springframework.beans.factory.annotation.Required;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
index 74b9496..3b521af 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
@@ -1,12 +1,12 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
import static java.lang.System.identityHashCode;
-import static org.apache.taverna.component.registry.api.Privilege.DOWNLOAD;
-import static org.apache.taverna.component.registry.api.Privilege.VIEW;
+import static io.github.taverna_extras.component.registry.api.Privilege.DOWNLOAD;
+import static io.github.taverna_extras.component.registry.api.Privilege.VIEW;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.registry.api.Permissions;
-import org.apache.taverna.component.registry.api.Permissions.Permission;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.registry.api.Permissions;
+import io.github.taverna_extras.component.registry.api.Permissions.Permission;
abstract class Policy implements SharingPolicy {
public static final SharingPolicy PUBLIC = new Public();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
index c6b680d..e6a709b 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard.annotations;
+package io.github.taverna_extras.component.registry.standard.annotations;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
index 518d8a6..6a89454 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
@@ -21,4 +21,4 @@
*
* @author Donal Fellows
*/
-package org.apache.taverna.component.registry.standard.annotations;
\ No newline at end of file
+package io.github.taverna_extras.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
index 6c15ce9..89df01a 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
@@ -20,4 +20,4 @@
* This is the new interface to the myExperiment registry, a.k.a. μExperiment.
* @author Donal Fellows
*/
-package org.apache.taverna.component.registry.standard;
\ No newline at end of file
+package io.github.taverna_extras.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
index 1440c32..a3ac463 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.utils;
+package io.github.taverna_extras.component.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
index d7b622c..9a57122 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.utils;
+package io.github.taverna_extras.component.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -26,8 +26,8 @@ import java.util.List;
import javax.xml.bind.JAXBElement;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.api.Description;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.api.Description;
import org.apache.taverna.configuration.app.ApplicationConfiguration;
import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
import org.apache.taverna.platform.execution.api.WorkflowCompiler;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/resources/EmptyProfile.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/EmptyProfile.xml b/taverna-component-activity/src/main/resources/EmptyProfile.xml
index d864b4f..1ee5dc0 100644
--- a/taverna-component-activity/src/main/resources/EmptyProfile.xml
+++ b/taverna-component-activity/src/main/resources/EmptyProfile.xml
@@ -21,7 +21,7 @@
xmlns="http://ns.taverna.org.uk/2012/component/profile"
xsi:schemaLocation="http://ns.taverna.org.uk/2012/component/profile ComponentProfile.xsd">
- <id>org.apache.taverna.component.profile.empty</id>
+ <id>io.github.taverna_extras.component.profile.empty</id>
<name>Empty profile</name>
<description>A basic empty profile that does not allow additional semantic annotation</description>
<component>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml b/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml
index 0ed5382..59cdc1e 100644
--- a/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml
+++ b/taverna-component-activity/src/main/resources/META-INF/spring/component-activity-context.xml
@@ -25,16 +25,16 @@
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
<bean id="ComponentLocalHealthChecker"
- class="org.apache.taverna.component.activity.ComponentActivityLocalChecker" />
+ class="io.github.taverna_extras.component.activity.ComponentActivityLocalChecker" />
<bean id="ComponentUpgradeHealthChecker"
- class="org.apache.taverna.component.activity.ComponentActivityUpgradeChecker">
+ class="io.github.taverna_extras.component.activity.ComponentActivityUpgradeChecker">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="baseProfileLocator" class="org.apache.taverna.component.profile.BaseProfileLocator">
+ <bean id="baseProfileLocator" class="io.github.taverna_extras.component.profile.BaseProfileLocator">
<property name="appConfig" ref="app-config" />
</bean>
- <bean id="componentActivityFactory" class="org.apache.taverna.component.activity.ComponentActivityFactory">
+ <bean id="componentActivityFactory" class="io.github.taverna_extras.component.activity.ComponentActivityFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="dataflowCache" ref="cache" />
<property name="edits" ref="edits" />
@@ -42,32 +42,32 @@
</bean>
<bean id="networkRegistry"
- class="org.apache.taverna.component.registry.standard.NewComponentRegistryFactory">
+ class="io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory">
<property name="credentialManager" ref="credentialManager" />
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
<property name="annotationUtils" ref="annotationUtil" />
</bean>
<bean id="fileRegistry"
- class="org.apache.taverna.component.registry.local.LocalComponentRegistryFactory">
+ class="io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
</bean>
- <bean id="componentUtil" class="org.apache.taverna.component.registry.ComponentUtil">
+ <bean id="componentUtil" class="io.github.taverna_extras.component.registry.ComponentUtil">
<property name="networkLocator" ref="networkRegistry" />
<property name="fileLocator" ref="fileRegistry" />
<property name="baseLocator" ref="baseProfileLocator" />
</bean>
- <bean id="cache" class="org.apache.taverna.component.registry.ComponentImplementationCache">
+ <bean id="cache" class="io.github.taverna_extras.component.registry.ComponentImplementationCache">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="systemUtil" class="org.apache.taverna.component.utils.SystemUtils">
+ <bean id="systemUtil" class="io.github.taverna_extras.component.utils.SystemUtils">
<property name="appConfig" ref="app-config" />
<property name="workflowBundler" ref="workflowBundleIO" />
<property name="compilers" ref="compilers" />
</bean>
- <bean id="annotationUtil" class="org.apache.taverna.component.utils.AnnotationUtils" />
+ <bean id="annotationUtil" class="io.github.taverna_extras.component.utils.AnnotationUtils" />
<osgi:service ref="ComponentLocalHealthChecker"
interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
@@ -76,7 +76,7 @@
<osgi:service ref="componentActivityFactory"
interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
<osgi:service ref="componentUtil"
- interface="org.apache.taverna.component.api.ComponentFactory" />
+ interface="io.github.taverna_extras.component.api.ComponentFactory" />
<osgi:reference id="app-config"
interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd b/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
index 0f8e133..66e0173 100644
--- a/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
+++ b/taverna-component-activity/src/main/resources/NewMyExperimentSchema.xsd
@@ -25,7 +25,7 @@
<xs:annotation>
<xs:appinfo>
<jxb:schemaBindings>
- <jxb:package name="org.apache.taverna.component.registry.api" />
+ <jxb:package name="io.github.taverna_extras.component.registry.api" />
</jxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
index ffef8f3..6b885c3 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component;
+package io.github.taverna_extras.component;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,7 +22,7 @@ import static org.junit.Assert.*;
import java.io.IOException;
-import org.apache.taverna.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
import org.junit.Test;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
index c320146..63ce804 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component;
+package io.github.taverna_extras.component;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,9 +18,9 @@ package org.apache.taverna.component;
* under the License.
*/
-import org.apache.taverna.component.activity.ComponentActivity;
-import org.apache.taverna.component.activity.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.activity.ComponentActivityFactory;
+import io.github.taverna_extras.component.activity.ComponentActivity;
+import io.github.taverna_extras.component.activity.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.activity.ComponentActivityFactory;
public class ComponentActivityTest {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
index 07cf491..29e4473 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -25,9 +25,9 @@ import static org.junit.Assert.assertTrue;
import java.net.URL;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
index 2112de5..f5328cc 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -27,9 +27,9 @@ import static org.junit.Assert.assertTrue;
import java.net.URL;
import java.util.List;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
index 69e99b0..0ced0c8 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,10 +24,10 @@ import static org.junit.Assert.assertNull;
import java.net.URL;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
index ae7b66f..48b320b 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -23,9 +23,9 @@ import static org.junit.Assert.assertNotNull;
import java.net.URL;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
index a83af61..663704c 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,8 +20,8 @@ package org.apache.taverna.component.registry;
import java.net.URL;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
public class Harness {
public static URL componentRegistryUrl;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
index 8d43753..b5791e8 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.local;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentFamilyTest;
+import io.github.taverna_extras.component.registry.ComponentFamilyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
index 60acd13..2a57e1c 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,8 +20,8 @@ package org.apache.taverna.component.registry.local;
import static org.junit.Assert.assertSame;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.registry.ComponentRegistryTest;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentRegistryTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
index 353b81c..f82e591 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.local;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentTest;
+import io.github.taverna_extras.component.registry.ComponentTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
index 4deb722..f08425e 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.local;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentVersionTest;
+import io.github.taverna_extras.component.registry.ComponentVersionTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
index 6e1fcf4..cac3eff 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.local;
+package io.github.taverna_extras.component.registry.local;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,12 +20,12 @@ package org.apache.taverna.component.registry.local;
import static java.lang.System.getProperty;
import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.apache.taverna.component.registry.Harness.componentRegistry;
-import static org.apache.taverna.component.registry.Harness.componentRegistryUrl;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
import java.io.File;
-import org.apache.taverna.component.registry.local.LocalComponentRegistryFactory;
+import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
class RegistrySupport {
private static File testRegistry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
index 40e118f..bb06af5 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentFamilyTest;
+import io.github.taverna_extras.component.registry.ComponentFamilyTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
index a0d6912..86417d5 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -23,11 +23,11 @@ import static org.junit.Assert.assertSame;
import java.net.URL;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.registry.ComponentRegistryTest;
-import org.apache.taverna.component.registry.standard.NewComponent;
-import org.apache.taverna.component.registry.standard.NewComponentRegistry;
-import org.apache.taverna.component.registry.standard.Policy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.registry.ComponentRegistryTest;
+import io.github.taverna_extras.component.registry.standard.NewComponent;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
+import io.github.taverna_extras.component.registry.standard.Policy;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
index a8591e4..2281cb0 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentTest;
+import io.github.taverna_extras.component.registry.ComponentTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
index 5048bba..cad04eb 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import org.apache.taverna.component.registry.ComponentVersionTest;
+import io.github.taverna_extras.component.registry.ComponentVersionTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
index fe88922..a1d0fef 100644
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry.standard;
+package io.github.taverna_extras.component.registry.standard;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,18 +18,18 @@ package org.apache.taverna.component.registry.standard;
* under the License.
*/
-import static org.apache.taverna.component.registry.Harness.componentRegistry;
-import static org.apache.taverna.component.registry.Harness.componentRegistryUrl;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
import java.net.URL;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.registry.standard.NewComponent;
-import org.apache.taverna.component.registry.standard.NewComponentFamily;
-import org.apache.taverna.component.registry.standard.NewComponentRegistry;
-import org.apache.taverna.component.registry.standard.NewComponentRegistryFactory;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.standard.NewComponent;
+import io.github.taverna_extras.component.registry.standard.NewComponentFamily;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
class RegistrySupport {
static final String DEPLOYMENT = "http://aeon.cs.man.ac.uk:3006";
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI b/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
index a2a1b06..e98b9e3 100644
--- a/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
+++ b/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
@@ -1 +1 @@
-org.apache.taverna.component.registry.myexperiment.TestPasswordProvider
+io.github.taverna_extras.component.registry.myexperiment.TestPasswordProvider
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/pom.xml b/taverna-component-repository-api/pom.xml
index e5c6174..af1ac18 100644
--- a/taverna-component-repository-api/pom.xml
+++ b/taverna-component-repository-api/pom.xml
@@ -49,7 +49,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>org.apache.taverna.component.api,org.apache.taverna.component.api.profile,org.apache.taverna.component.api.profile.doc</Export-Package>
+ <Export-Package>io.github.taverna_extras.component.api,io.github.taverna_extras.component.api.profile,io.github.taverna_extras.component.api.profile.doc</Export-Package>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
index 9d0ae3a..e014fb9 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
index d440547..044903e 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
index 34f54a4..5b69b61 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,7 +20,7 @@ package org.apache.taverna.component.api;
import java.net.URL;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.Profile;
public interface ComponentFactory {
public Registry getRegistry(URL registryBase) throws ComponentException;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
index c2be81b..ca4ec54 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,7 +20,7 @@ package org.apache.taverna.component.api;
import java.util.List;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
public interface Family extends NamedItem {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
index 31c900f..2906288 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
index b82d36f..775e515 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
index 26a85c1..e6d1e23 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -23,7 +23,7 @@ import java.net.URL;
import java.util.List;
import java.util.Set;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.Profile;
public interface Registry {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
index 357db62..9965339 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
[13/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistry.java
new file mode 100644
index 0000000..fd0285d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistry.java
@@ -0,0 +1,220 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.commons.io.FileUtils.writeStringToFile;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+/**
+ * A component registry implemented using the local file system. Note that the
+ * components it contains are <i>not</i> shareable.
+ *
+ * @author alanrw
+ */
+class LocalComponentRegistry extends ComponentRegistry {
+ private static final Logger logger = getLogger(LocalComponentRegistry.class);
+ static final String ENC = "utf-8";
+ private ComponentUtil util;
+ private SystemUtils system;
+ private File baseDir;
+
+ public LocalComponentRegistry(File registryDir, ComponentUtil util,
+ SystemUtils system) throws ComponentException {
+ super(registryDir);
+ baseDir = registryDir;
+ this.util = util;
+ this.system = system;
+ }
+
+ @Override
+ public Family internalCreateComponentFamily(String name,
+ Profile componentProfile, String description, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ File newFamilyDir = new File(getComponentFamiliesDir(), name);
+ newFamilyDir.mkdirs();
+ File profileFile = new File(newFamilyDir, "profile");
+ try {
+ writeStringToFile(profileFile, componentProfile.getName(), ENC);
+ } catch (IOException e) {
+ throw new ComponentException("Could not write out profile", e);
+ }
+ File descriptionFile = new File(newFamilyDir, "description");
+ try {
+ writeStringToFile(descriptionFile, description, ENC);
+ } catch (IOException e) {
+ throw new ComponentException("Could not write out description", e);
+ }
+ return new LocalComponentFamily(this, newFamilyDir, util, system);
+ }
+
+ @Override
+ protected void populateFamilyCache() throws ComponentException {
+ File familiesDir = getComponentFamiliesDir();
+ for (File subFile : familiesDir.listFiles()) {
+ if (!subFile.isDirectory())
+ continue;
+ LocalComponentFamily newFamily = new LocalComponentFamily(this,
+ subFile, util, system);
+ familyCache.put(newFamily.getName(), newFamily);
+ }
+ }
+
+ @Override
+ protected void populateProfileCache() throws ComponentException {
+ File profilesDir = getComponentProfilesDir();
+ for (File subFile : profilesDir.listFiles())
+ if (subFile.isFile() && (!subFile.isHidden())
+ && subFile.getName().endsWith(".xml"))
+ try {
+ profileCache.add(new LocalComponentProfile(subFile));
+ } catch (MalformedURLException e) {
+ logger.error("Unable to read profile", e);
+ }
+ }
+
+ @Override
+ protected void internalRemoveComponentFamily(Family componentFamily)
+ throws ComponentException {
+ try {
+ deleteDirectory(new File(getComponentFamiliesDir(),
+ componentFamily.getName()));
+ } catch (IOException e) {
+ throw new ComponentException("Unable to delete component family", e);
+ }
+ }
+
+ private File getBaseDir() {
+ baseDir.mkdirs();
+ return baseDir;
+ }
+
+ private File getComponentFamiliesDir() {
+ File componentFamiliesDir = new File(getBaseDir(), "componentFamilies");
+ componentFamiliesDir.mkdirs();
+ return componentFamiliesDir;
+ }
+
+ private File getComponentProfilesDir() {
+ File componentProfilesDir = new File(getBaseDir(), "componentProfiles");
+ componentProfilesDir.mkdirs();
+ return componentProfilesDir;
+ }
+
+ @Override
+ public Profile internalAddComponentProfile(Profile componentProfile,
+ License license, SharingPolicy sharingPolicy)
+ throws ComponentException {
+ String name = componentProfile.getName().replaceAll("\\W+", "")
+ + ".xml";
+ String inputString = componentProfile.getXML();
+ File outputFile = new File(getComponentProfilesDir(), name);
+ try {
+ writeStringToFile(outputFile, inputString);
+ } catch (IOException e) {
+ throw new ComponentException("Unable to save profile", e);
+ }
+
+ try {
+ return new LocalComponentProfile(outputFile);
+ } catch (MalformedURLException e) {
+ throw new ComponentException("Unable to create profile", e);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + ((baseDir == null) ? 0 : baseDir.hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ LocalComponentRegistry other = (LocalComponentRegistry) obj;
+ if (baseDir == null)
+ return (other.baseDir == null);
+ return baseDir.equals(other.baseDir);
+ }
+
+ @Override
+ public void populatePermissionCache() {
+ return;
+ }
+
+ @Override
+ public void populateLicenseCache() {
+ return;
+ }
+
+ @Override
+ public License getPreferredLicense() {
+ return null;
+ }
+
+ @Override
+ public Set<Version.ID> searchForComponents(String prefixString, String text)
+ throws ComponentException {
+ throw new ComponentException("Local registries cannot be searched yet");
+ }
+
+ @Override
+ public String getRegistryTypeName() {
+ return "File System";
+ }
+
+ class LocalComponentProfile extends ComponentProfileImpl {
+ URI uri;
+
+ LocalComponentProfile(File file) throws MalformedURLException,
+ ComponentException {
+ super(LocalComponentRegistry.this, file.toURI(), util
+ .getBaseProfileLocator());
+ uri = file.toURI();
+ }
+
+ @Override
+ public String toString() {
+ return "Local Component Profile[" + uri + "]";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryFactory.java
new file mode 100644
index 0000000..f2625d1
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryFactory.java
@@ -0,0 +1,62 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.SystemUtils;
+import org.springframework.beans.factory.annotation.Required;
+
+public class LocalComponentRegistryFactory {
+ private final Map<File, Registry> registries = new HashMap<>();
+ private ComponentUtil util;
+ private SystemUtils system;
+
+ @Required
+ public void setComponentUtil(ComponentUtil util) {
+ this.util = util;
+ }
+
+ @Required
+ public void setSystemUtils(SystemUtils system) {
+ this.system = system;
+ }
+
+ public synchronized Registry getComponentRegistry(File registryDir)
+ throws ComponentException {
+ if (!registries.containsKey(registryDir))
+ registries.put(registryDir, new LocalComponentRegistry(registryDir,
+ util, system));
+ return registries.get(registryDir);
+ }
+
+ public Registry getComponentRegistry(URL componentRegistryBase)
+ throws ComponentException {
+ @SuppressWarnings("deprecation")
+ String hackedPath = URLDecoder.decode(componentRegistryBase.getPath());
+ return getComponentRegistry(new File(hackedPath));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentVersion.java
new file mode 100644
index 0000000..976aa8b
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/local/LocalComponentVersion.java
@@ -0,0 +1,108 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import static java.lang.Integer.parseInt;
+import static org.apache.commons.io.FileUtils.readFileToString;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.registry.local.LocalComponent.COMPONENT_FILENAME;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentVersion;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author alanrw
+ *
+ */
+class LocalComponentVersion extends ComponentVersion {
+ private static Logger logger = getLogger(LocalComponentVersion.class);
+
+ private final File componentVersionDir;
+ private SystemUtils system;
+
+ protected LocalComponentVersion(LocalComponent component,
+ File componentVersionDir, SystemUtils system) {
+ super(component);
+ this.componentVersionDir = componentVersionDir;
+ this.system = system;
+ }
+
+ @Override
+ protected final String internalGetDescription() {
+ File descriptionFile = new File(componentVersionDir, "description");
+ try {
+ if (descriptionFile.isFile())
+ return readFileToString(descriptionFile);
+ } catch (IOException e) {
+ logger.error("failed to get description from " + descriptionFile, e);
+ }
+ return "";
+ }
+
+ @Override
+ protected final Integer internalGetVersionNumber() {
+ return parseInt(componentVersionDir.getName());
+ }
+
+ @Override
+ protected final WorkflowBundle internalGetImplementation()
+ throws ComponentException {
+ File filename = new File(componentVersionDir, COMPONENT_FILENAME);
+ try {
+ return system.getBundle(filename);
+ } catch (Exception e) {
+ logger.error(
+ "failed to get component realization from " + filename, e);
+ throw new ComponentException("Unable to open dataflow", e);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + ((componentVersionDir == null) ? 0 : componentVersionDir
+ .hashCode());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ LocalComponentVersion other = (LocalComponentVersion) obj;
+ if (componentVersionDir == null)
+ return (other.componentVersionDir == null);
+ return componentVersionDir.equals(other.componentVersionDir);
+ }
+
+ @Override
+ public URL getHelpURL() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Client.java
new file mode 100644
index 0000000..87b99b1
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Client.java
@@ -0,0 +1,654 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static java.lang.Math.min;
+import static java.lang.String.format;
+import static java.lang.System.getProperty;
+import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
+import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
+import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
+import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
+import static java.net.HttpURLConnection.HTTP_OK;
+import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
+import static java.net.URLEncoder.encode;
+import static javax.xml.bind.DatatypeConverter.printBase64Binary;
+import static org.apache.commons.io.IOUtils.copy;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.registry.ClientVersion.VERSION;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
+import io.github.taverna_extras.component.registry.standard.annotations.Unused;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.UsernamePassword;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+class Client {
+ private static final String API_VERIFICATION_RESOURCE = "/component-profiles.xml";
+ private static final String WHOAMI = "/whoami.xml";
+ private static final String PLUGIN_USER_AGENT = "Taverna2-Component-plugin/"
+ + VERSION + " Java/" + getProperty("java.version");
+ private static final int MESSAGE_TRIM_LENGTH = 512;
+ private static final Logger logger = getLogger(Client.class);
+ private final MyExperimentConnector http;
+ private final URL registryBase;
+ private final JAXBContext jaxbContext;
+ private final CredentialManager cm;
+
+ Client(JAXBContext context, URL repository, CredentialManager cm)
+ throws ComponentException {
+ this(context, repository, true, cm);
+ }
+
+ Client(JAXBContext context, URL repository, boolean tryLogIn,
+ CredentialManager cm) throws ComponentException {
+ this.cm = cm;
+ this.registryBase = repository;
+ this.jaxbContext = context;
+ this.http = new MyExperimentConnector(tryLogIn);
+ logger.info("instantiated client connection engine to " + repository);
+ }
+
+ public boolean verify() {
+ try {
+ String url = url(API_VERIFICATION_RESOURCE);
+ logger.info("API verification: HEAD for " + url);
+ return http.HEAD(url).getCode() == HTTP_OK;
+ } catch (Exception e) {
+ logger.info("failed to connect to " + registryBase, e);
+ return false;
+ }
+ }
+
+ private String url(String uri, String... arguments)
+ throws MalformedURLException, UnsupportedEncodingException {
+ StringBuilder uriBuilder = new StringBuilder(uri);
+ for (String queryElement : arguments) {
+ String[] bits = queryElement.split("=", 2);
+ uriBuilder.append(uriBuilder.indexOf("?") < 0 ? "?" : "&")
+ .append(bits[0]).append('=')
+ .append(encode(bits[1], "UTF-8"));
+ }
+ return new URL(registryBase, uriBuilder.toString()).toString();
+ }
+
+ private Marshaller getMarshaller() throws JAXBException {
+ return jaxbContext.createMarshaller();
+ }
+
+ /**
+ * Does an HTTP GET against the configured repository.
+ *
+ * @param clazz
+ * The JAXB-annotated class that the result is supposed to be
+ * instantiated into.
+ * @param uri
+ * The path part of the URI within the repository.
+ * @param query
+ * The strings to put into the query part. Each should be in
+ * <tt>key=value</tt> form.
+ * @return The deserialized response object.
+ * @throws ComponentException
+ * If anything goes wrong.
+ */
+ public <T> T get(Class<T> clazz, String uri, String... query)
+ throws ComponentException {
+ try {
+ int redirectCounter = 0;
+
+ String url = url(uri, query);
+ ServerResponse response;
+ do {
+ if (redirectCounter++ > 5)
+ throw new ComponentException("too many redirects!");
+ logger.info("GET of " + url);
+ response = http.GET(url);
+ if (response.isFailure())
+ throw new ComponentException(
+ "Unable to perform request (%d): %s",
+ response.getCode(), response.getError());
+ } while ((url = response.getLocation()) != null);
+ return response.getResponse(clazz);
+
+ } catch (ComponentException e) {
+ throw e;
+ } catch (MalformedURLException e) {
+ throw new ComponentException("Problem constructing resource URL", e);
+ } catch (JAXBException e) {
+ throw new ComponentException("Problem when unmarshalling response",
+ e);
+ } catch (Exception e) {
+ throw new ComponentException("Problem when sending request", e);
+ }
+ }
+
+ /**
+ * Does an HTTP POST against the configured repository.
+ *
+ * @param clazz
+ * The JAXB-annotated class that the result is supposed to be
+ * instantiated into.
+ * @param elem
+ * The JAXB element to post to the resource.
+ * @param uri
+ * The path part of the URI within the repository.
+ * @param query
+ * The strings to put into the query part. Each should be in
+ * <tt>key=value</tt> form.
+ * @return The deserialized response object.
+ * @throws ComponentException
+ * If anything goes wrong.
+ */
+ public <T> T post(Class<T> clazz, JAXBElement<?> elem, String uri,
+ String... query) throws ComponentException {
+ try {
+
+ String url = url(uri, query);
+ logger.info("POST to " + url);
+ StringWriter sw = new StringWriter();
+ getMarshaller().marshal(elem, sw);
+ if (logger.isDebugEnabled())
+ logger.info("About to post XML document:\n" + sw);
+ ServerResponse response = http.POST(url, sw);
+ if (response.isFailure())
+ throw new ComponentException(
+ "Unable to perform request (%d): %s",
+ response.getCode(), response.getError());
+ if (response.getLocation() != null)
+ return get(clazz, response.getLocation());
+ return response.getResponse(clazz);
+
+ } catch (ComponentException e) {
+ throw e;
+ } catch (MalformedURLException e) {
+ throw new ComponentException("Problem constructing resource URL", e);
+ } catch (JAXBException e) {
+ throw new ComponentException("Problem when marshalling request", e);
+ } catch (Exception e) {
+ throw new ComponentException("Problem when sending request", e);
+ }
+ }
+
+ /**
+ * Does an HTTP PUT against the configured repository.
+ *
+ * @param clazz
+ * The JAXB-annotated class that the result is supposed to be
+ * instantiated into.
+ * @param elem
+ * The JAXB element to post to the resource.
+ * @param uri
+ * The path part of the URI within the repository.
+ * @param query
+ * The strings to put into the query part. Each should be in
+ * <tt>key=value</tt> form.
+ * @return The deserialized response object.
+ * @throws ComponentException
+ * If anything goes wrong.
+ */
+ @Unused
+ public <T> T put(Class<T> clazz, JAXBElement<?> elem, String uri,
+ String... query) throws ComponentException {
+ try {
+
+ String url = url(uri, query);
+ logger.info("PUT to " + url);
+ StringWriter sw = new StringWriter();
+ getMarshaller().marshal(elem, sw);
+ if (logger.isDebugEnabled())
+ logger.info("About to put XML document:\n" + sw);
+ ServerResponse response = http.PUT(url, sw);
+ if (response.isFailure())
+ throw new ComponentException(
+ "Unable to perform request (%d): %s",
+ response.getCode(), response.getError());
+ if (response.getLocation() != null)
+ return get(clazz, response.getLocation());
+ return response.getResponse(clazz);
+
+ } catch (ComponentException e) {
+ throw e;
+ } catch (MalformedURLException e) {
+ throw new ComponentException("Problem constructing resource URL", e);
+ } catch (JAXBException e) {
+ throw new ComponentException("Problem when marshalling request", e);
+ } catch (Exception e) {
+ throw new ComponentException("Problem when sending request", e);
+ }
+ }
+
+ /**
+ * Does an HTTP DELETE against the configured repository.
+ *
+ * @param uri
+ * The path part of the URI within the repository.
+ * @param query
+ * The strings to put into the query part. Each should be in
+ * <tt>key=value</tt> form.
+ * @throws ComponentException
+ * If anything goes wrong.
+ */
+ public void delete(String uri, String... query) throws ComponentException {
+ ServerResponse response;
+ try {
+
+ String url = url(uri, query);
+ logger.info("DELETE of " + url);
+ response = http.DELETE(url);
+
+ } catch (MalformedURLException e) {
+ throw new ComponentException("Problem constructing resource URL", e);
+ } catch (Exception e) {
+ throw new ComponentException("Unable to perform request", e);
+ }
+ if (response.isFailure())
+ throw new ComponentException("Unable to perform request (%d): %s",
+ response.getCode(), response.getError());
+ }
+
+ private String getCredentials(String urlString, boolean mandatory)
+ throws CMException, UnsupportedEncodingException {
+ final URI serviceURI = URI.create(urlString);
+
+ if (mandatory || cm.hasUsernamePasswordForService(serviceURI)) {
+ UsernamePassword userAndPass = cm.getUsernameAndPasswordForService(
+ serviceURI, true, null);
+ // Check for user didn't log in...
+ if (userAndPass == null)
+ return null;
+ return printBase64Binary(format("%s:%s", userAndPass.getUsername(),
+ userAndPass.getPasswordAsString()).getBytes("UTF-8"));
+ }
+ return null;
+ }
+
+ private void clearCredentials(String baseURL) throws CMException {
+ for (URI uri : cm.getServiceURIsForAllUsernameAndPasswordPairs())
+ if (uri.toString().startsWith(baseURL))
+ cm.deleteUsernameAndPasswordForService(uri);
+ }
+
+ private static Document getDocumentFromStream(InputStream inputStream)
+ throws SAXException, IOException, ParserConfigurationException {
+ DocumentBuilder db = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder();
+ Document doc;
+ try (InputStream is = new BufferedInputStream(inputStream)) {
+ if (!logger.isDebugEnabled())
+ doc = db.parse(is);
+ else {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ copy(is, baos);
+ String response = baos.toString("UTF-8");
+ logger.info("response message follows\n"
+ + response.substring(0,
+ min(MESSAGE_TRIM_LENGTH, response.length())));
+ doc = db.parse(new ByteArrayInputStream(baos.toByteArray()));
+ }
+ }
+ return doc;
+ }
+
+ class MyExperimentConnector {
+ // authentication settings (and the current user)
+ private String authString = null;
+
+ private void tryLogIn(boolean mandatory) throws ComponentException {
+ // check if the stored credentials are valid
+ ServerResponse response = null;
+ try {
+ String userPass = getCredentials(registryBase.toString(),
+ mandatory);
+ if (userPass == null)
+ logger.debug("no credentials available for " + registryBase);
+ else {
+ // set the system to the "logged in" state from INI file properties
+ authString = userPass;
+ response = GET(registryBase.toString() + WHOAMI);
+ }
+ } catch (Exception e) {
+ authString = null;
+ logger.debug("failed when verifying login credentials", e);
+ }
+
+ if (response == null || response.getCode() != HTTP_OK)
+ try {
+ if (response != null)
+ throw new ComponentException("failed to log in: "
+ + response.getError());
+ } finally {
+ try {
+ authString = null;
+ clearCredentials(registryBase.toString());
+ } catch (Exception e) {
+ logger.debug("failed to clear credentials", e);
+ }
+ }
+ if (authString != null)
+ logger.debug("logged in to repository successfully");
+ }
+
+ MyExperimentConnector(boolean tryLogIn) throws ComponentException {
+ if (tryLogIn)
+ tryLogIn(false);
+ }
+
+ // getter for the current status
+ private boolean isLoggedIn() {
+ return authString != null;
+ }
+
+ private HttpURLConnection connect(String method, String strURL)
+ throws MalformedURLException, IOException {
+ HttpURLConnection conn = (HttpURLConnection) new URL(strURL)
+ .openConnection();
+ conn.setRequestMethod(method);
+ if (method.equals("POST") || method.equals("PUT"))
+ conn.setDoOutput(true);
+ conn.setRequestProperty("User-Agent", PLUGIN_USER_AGENT);
+ if (authString != null)
+ conn.setRequestProperty("Authorization", "Basic " + authString);
+ return conn;
+ }
+
+ private boolean elevate() throws ComponentException {
+ tryLogIn(true);
+ return isLoggedIn();
+ }
+
+ /**
+ * Generic method to execute GET requests to myExperiment server.
+ *
+ * @param url
+ * The URL on myExperiment to issue GET request to.
+ * @return An object containing XML Document with server's response body
+ * and a response code. Response body XML document might be null
+ * if there was an error or the user wasn't authorised to
+ * perform a certain action. Response code will always be set.
+ * @throws Exception
+ */
+ public ServerResponse GET(String url) throws Exception {
+ if (!isLoggedIn())
+ logger.warn("not logged in");
+ return receiveServerResponse(connect("GET", url), url, true, false);
+ }
+
+ /**
+ * Generic method to execute GET requests to myExperiment server.
+ *
+ * @param url
+ * The URL on myExperiment to issue GET request to.
+ * @return An object containing XML Document with server's response body
+ * and a response code. Response body XML document might be null
+ * if there was an error or the user wasn't authorised to
+ * perform a certain action. Response code will always be set.
+ * @throws Exception
+ */
+ public ServerResponse HEAD(String url) throws Exception {
+ if (!isLoggedIn())
+ logger.warn("not logged in");
+ return receiveServerResponse(connect("HEAD", url), url, false, true);
+ }
+
+ /**
+ * Generic method to execute GET requests to myExperiment server.
+ *
+ * @param url
+ * The URL on myExperiment to POST to.
+ * @param xmlDataBody
+ * Body of the XML data to be POSTed to strURL.
+ * @return An object containing XML Document with server's response body
+ * and a response code. Response body XML document might be null
+ * if there was an error or the user wasn't authorised to
+ * perform a certain action. Response code will always be set.
+ * @throws Exception
+ */
+ public ServerResponse POST(String url, Object xmlDataBody)
+ throws Exception {
+ if (!isLoggedIn() && !elevate())
+ return null;
+
+ HttpURLConnection conn = connect("POST", url);
+ sendXmlBody(xmlDataBody, conn);
+ return receiveServerResponse(conn, url, false, false);
+ }
+
+ /**
+ * Generic method to execute DELETE requests to myExperiment server.
+ * This is only to be called when a user is logged in.
+ *
+ * @param url
+ * The URL on myExperiment to direct DELETE request to.
+ * @return An object containing XML Document with server's response body
+ * and a response code. Response body XML document might be null
+ * if there was an error or the user wasn't authorised to
+ * perform a certain action. Response code will always be set.
+ * @throws Exception
+ */
+ public ServerResponse DELETE(String url) throws Exception {
+ if (!isLoggedIn() && !elevate())
+ return null;
+ return receiveServerResponse(connect("DELETE", url), url, true,
+ false);
+ }
+
+ @Unused
+ public ServerResponse PUT(String url, Object xmlDataBody)
+ throws Exception {
+ if (!isLoggedIn() && !elevate())
+ return null;
+
+ HttpURLConnection conn = connect("PUT", url);
+ sendXmlBody(xmlDataBody, conn);
+ return receiveServerResponse(conn, url, false, false);
+ }
+
+ /**
+ * Factoring out of how to write a body.
+ *
+ * @param xmlDataBody
+ * What to write (an {@link InputStream}, a {@link Reader} or
+ * an object that will have it's {@link Object#toString()
+ * toString()} method called.
+ * @param conn
+ * Where to write it to.
+ * @throws IOException
+ * If anything goes wrong. The <code>conn</code> will be
+ * disconnected in the case of a failure.
+ */
+ private void sendXmlBody(Object xmlDataBody, HttpURLConnection conn)
+ throws IOException {
+ try {
+ conn.setRequestProperty("Content-Type", "application/xml");
+ if (xmlDataBody instanceof InputStream)
+ copy((InputStream) xmlDataBody, conn.getOutputStream());
+ else
+ try (OutputStreamWriter out = new OutputStreamWriter(
+ conn.getOutputStream())) {
+ if (xmlDataBody instanceof Reader)
+ copy((Reader) xmlDataBody, out);
+ else
+ out.write(xmlDataBody.toString());
+ }
+ } catch (IOException e) {
+ conn.disconnect();
+ throw e;
+ }
+ }
+
+ /**
+ * A common method for retrieving myExperiment server's response for all
+ * types of requests.
+ *
+ * @param conn
+ * Instance of the established URL connection to poll for
+ * server's response.
+ * @param url
+ * The URL on myExperiment with which the connection is
+ * established.
+ * @param isGETrequest
+ * Flag for identifying type of the request. True when the
+ * current connection executes GET request; false when it
+ * executes a POST request.
+ * @return An object containing XML Document with server's response body
+ * and a response code. Response body XML document might be null
+ * if there was an error or the user wasn't authorised to
+ * perform a certain action. Response code will always be set.
+ */
+ private ServerResponse receiveServerResponse(HttpURLConnection conn,
+ String url, boolean isGETrequest, boolean isHEADrequest)
+ throws Exception {
+ try {
+ switch (conn.getResponseCode()) {
+ case HTTP_OK:
+ /*
+ * data retrieval was successful - parse the response XML
+ * and return it along with response code
+ */
+ if (isHEADrequest)
+ return new ServerResponse(conn.getResponseCode(), null,
+ null);
+ return new ServerResponse(conn.getResponseCode(), null,
+ getDocumentFromStream(conn.getInputStream()));
+ case HTTP_NO_CONTENT:
+ return new ServerResponse(HTTP_OK, null, null);
+
+ case HttpURLConnection.HTTP_CREATED:
+ case HttpURLConnection.HTTP_MOVED_PERM:
+ case HttpURLConnection.HTTP_MOVED_TEMP:
+ case HttpURLConnection.HTTP_SEE_OTHER:
+ case HttpURLConnection.HTTP_USE_PROXY:
+ return new ServerResponse(conn.getResponseCode(),
+ conn.getHeaderField("Location"), null);
+
+ case HTTP_BAD_REQUEST:
+ case HTTP_FORBIDDEN:
+ /*
+ * this was a bad XML request - need full XML response to
+ * retrieve the error message from it; Java throws
+ * IOException if getInputStream() is used when non HTTP_OK
+ * response code was received - hence can use
+ * getErrorStream() straight away to fetch the error
+ * document
+ */
+ return new ServerResponse(conn.getResponseCode(), null,
+ getDocumentFromStream(conn.getErrorStream()));
+
+ case HTTP_UNAUTHORIZED:
+ // this content is not authorised for current user
+ logger.warn("non-authorised request to " + url + "\n"
+ + IOUtils.toString(conn.getErrorStream()));
+ return new ServerResponse(conn.getResponseCode(), null,
+ null);
+
+ case HTTP_NOT_FOUND:
+ if (isHEADrequest)
+ return new ServerResponse(conn.getResponseCode(), null,
+ null);
+ throw new FileNotFoundException("no such resource: " + url);
+ default:
+ // unexpected response code - raise an exception
+ throw new IOException(
+ format("Received unexpected HTTP response code (%d) while %s %s",
+ conn.getResponseCode(),
+ (isGETrequest ? "fetching data at"
+ : "posting data to"), url));
+ }
+ } finally {
+ conn.disconnect();
+ }
+ }
+
+ class ServerResponse {
+ private final int responseCode;
+ private final String responseLocation;
+ private final Document responseBody;
+
+ ServerResponse(int responseCode, String responseLocation,
+ Document responseBody) {
+ this.responseCode = responseCode;
+ this.responseBody = responseBody;
+ this.responseLocation = responseLocation;
+ }
+
+ public int getCode() {
+ return responseCode;
+ }
+
+ public boolean isFailure() {
+ return responseCode >= HTTP_BAD_REQUEST;
+ }
+
+ public String getLocation() {
+ return responseLocation;
+ }
+
+ public <T> T getResponse(Class<T> clazz) throws JAXBException {
+ return jaxbContext.createUnmarshaller()
+ .unmarshal(responseBody.getDocumentElement(), clazz)
+ .getValue();
+ }
+
+ /**
+ * Returns contents of the "reason" field of the error message.
+ */
+ public String getError() {
+ if (responseBody != null) {
+ Node reasonElement = responseBody.getDocumentElement()
+ .getElementsByTagName("reason").item(0);
+ if (reasonElement != null) {
+ String reason = reasonElement.getTextContent();
+ if (!reason.isEmpty())
+ return reason;
+ }
+ }
+ return format("unknown reason (%d)", responseCode);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponent.java
new file mode 100644
index 0000000..44de963
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponent.java
@@ -0,0 +1,239 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static java.lang.String.format;
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
+import static io.github.taverna_extras.component.registry.standard.Policy.getPolicy;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
+import static io.github.taverna_extras.component.utils.SystemUtils.getValue;
+
+import java.lang.ref.SoftReference;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.IllegalFormatException;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.registry.Component;
+import io.github.taverna_extras.component.registry.ComponentVersion;
+import io.github.taverna_extras.component.registry.api.ComponentType;
+import io.github.taverna_extras.component.registry.api.Description;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+class NewComponent extends Component {
+ static final String ELEMENTS = "title,description";
+ static final String EXTRA = "license-type,permissions";
+
+ private final SystemUtils system;
+ final NewComponentRegistry registry;
+ final NewComponentFamily family;
+ private final String id;
+ private final String title;
+ private final String description;
+ private final String resource;
+
+ NewComponent(NewComponentRegistry registry, NewComponentFamily family,
+ Description cd, SystemUtils system) throws ComponentException {
+ super(cd.getUri());
+ this.system = system;
+ this.registry = registry;
+ this.family = family;
+ id = cd.getId().trim();
+ title = getElementString(cd, "title");
+ description = getElementString(cd, "description");
+ resource = cd.getResource();
+ }
+
+ NewComponent(NewComponentRegistry registry, NewComponentFamily family,
+ ComponentType ct, SystemUtils system) {
+ super(ct.getUri());
+ this.system = system;
+ this.registry = registry;
+ this.family = family;
+ id = ct.getId().trim();
+ title = ct.getTitle().trim();
+ description = ct.getDescription().trim();
+ resource = ct.getResource();
+ }
+
+ public ComponentType getCurrent(String elements) throws ComponentException {
+ return registry.getComponentById(id, null, elements);
+ }
+
+ @Override
+ protected String internalGetName() {
+ return title;
+ }
+
+ @Override
+ protected String internalGetDescription() {
+ return description;
+ }
+
+ @Override
+ protected void populateComponentVersionMap() {
+ try {
+ for (Description d : getCurrent("versions").getVersions()
+ .getWorkflow())
+ versionMap.put(d.getVersion(), new Version(d.getVersion(),
+ getValue(d)));
+ } catch (ComponentException e) {
+ logger.warn("failed to retrieve version list: " + e.getMessage());
+ }
+ }
+
+ @Override
+ protected Version internalAddVersionBasedOn(WorkflowBundle bundle,
+ String revisionComment) throws ComponentException {
+ /*
+ * Only fetch the license and sharing policy now; user might have
+ * updated them on the site and we want to duplicate.
+ */
+ ComponentType ct = getCurrent(EXTRA);
+ License license = registry.getLicense(getValue(ct.getLicenseType())
+ .trim());
+ SharingPolicy sharingPolicy = getPolicy(ct.getPermissions());
+
+ return (Version) registry.createComponentVersionFrom(this, title,
+ revisionComment, bundle, license, sharingPolicy);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof NewComponent) {
+ NewComponent other = (NewComponent) o;
+ return registry.equals(other.registry) && id.equals(other.id);
+ }
+ return false;
+ }
+
+ public String getResourceLocation() {
+ return resource;
+ }
+
+ private static final int BASEHASH = NewComponent.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ registry.hashCode() ^ id.hashCode();
+ }
+
+ class Version extends ComponentVersion {
+ private int version;
+ private String description;
+ private String location;
+ private SoftReference<WorkflowBundle> bundleRef;
+
+ private static final String htmlPageTemplate = "%1$s/workflows/%2$s/versions/%3$s.html";
+
+ protected Version(Integer version, String description, WorkflowBundle bundle) {
+ super(NewComponent.this);
+ this.version = version;
+ this.description = description;
+ this.bundleRef = new SoftReference<>(bundle);
+ }
+
+ protected Version(Integer version, String description) {
+ super(NewComponent.this);
+ this.version = version;
+ this.description = description;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof Version) {
+ Version other = (Version) o;
+ return version == other.version
+ && NewComponent.this.equals(other.getComponent());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return NewComponent.this.hashCode() ^ (version << 16)
+ ^ (version >> 16);
+ }
+
+ @Override
+ protected Integer internalGetVersionNumber() {
+ return version;
+ }
+
+ @Override
+ protected String internalGetDescription() {
+ return description;
+ }
+
+ private String getLocationUri() throws ComponentException {
+ if (location == null)
+ location = registry.getComponentById(id, version,
+ "content-uri").getContentUri();
+ return location;
+ }
+
+ @Override
+ protected synchronized WorkflowBundle internalGetImplementation()
+ throws ComponentException {
+ if (bundleRef == null || bundleRef.get() == null) {
+ String contentUri = getLocationUri();
+ try {
+ WorkflowBundle result = system.getBundleFromUri(contentUri
+ + "?version=" + version);
+ bundleRef = new SoftReference<>(result);
+ return result;
+ } catch (Exception e) {
+ throw new ComponentException("Unable to open dataflow", e);
+ }
+ }
+ return bundleRef.get();
+ }
+
+ @Override
+ public URL getHelpURL() {
+ try {
+ return new URL(format(htmlPageTemplate,
+ registry.getRegistryBaseString(), getId(), version));
+ } catch (IllegalFormatException | MalformedURLException e) {
+ logger.error(e);
+ return null;
+ }
+ }
+ }
+
+ @Override
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ @Override
+ public Family getFamily() {
+ return family;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentFamily.java
new file mode 100644
index 0000000..1c16b1e
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentFamily.java
@@ -0,0 +1,151 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
+
+import java.util.List;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentFamily;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
+import io.github.taverna_extras.component.registry.api.Description;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * A family of components in the new-interface registry.
+ *
+ * @author Donal Fellows
+ */
+class NewComponentFamily extends ComponentFamily {
+ static final String ELEMENTS = "title,description";
+
+ private final NewComponentRegistry registry;
+ private final NewComponentProfile profile;
+ private final String id;
+ private final String name;
+ private final String description;
+ private final String uri;
+ private final String resource;
+
+ NewComponentFamily(NewComponentRegistry componentRegistry,
+ NewComponentProfile profile, Description familyDesc,
+ ComponentUtil util) throws ComponentException {
+ super(componentRegistry, util);
+ uri = familyDesc.getUri();
+ registry = componentRegistry;
+ this.profile = profile;
+ id = familyDesc.getId().trim();
+ name = getElementString(familyDesc, "title");
+ description = getElementString(familyDesc, "description");
+ resource = familyDesc.getResource();
+ }
+
+ public NewComponentFamily(NewComponentRegistry componentRegistry,
+ NewComponentProfile profile, ComponentFamilyType cft,
+ ComponentUtil util) {
+ super(componentRegistry, util);
+ uri = cft.getUri();
+ registry = componentRegistry;
+ this.profile = profile;
+ id = cft.getId();
+ name = cft.getTitle();
+ description = cft.getDescription();
+ resource = cft.getResource();
+ }
+
+ @Override
+ protected String internalGetName() {
+ return name;
+ }
+
+ @Override
+ protected String internalGetDescription() {
+ return description;
+ }
+
+ @Override
+ protected Profile internalGetComponentProfile() throws ComponentException {
+ return profile;
+ }
+
+ public List<Component> getMemberComponents() throws ComponentException {
+ return registry.listComponents(this);
+ }
+
+ @Override
+ protected void populateComponentCache() throws ComponentException {
+ for (Component c : getMemberComponents()) {
+ NewComponent component = (NewComponent) c;
+ componentCache.put(component.getName(), component);
+ }
+ }
+
+ @Override
+ protected Version internalCreateComponentBasedOn(String componentName,
+ String description, WorkflowBundle bundle) throws ComponentException {
+ if (componentName == null)
+ componentName = registry.annUtils.getTitle(bundle, "Untitled");
+ if (description == null)
+ componentName = registry.annUtils.getDescription(bundle,
+ "Undescribed");
+ return registry.createComponentFrom(this, componentName, description,
+ bundle, registry.getPreferredLicense(),
+ registry.getDefaultSharingPolicy());
+ }
+
+ @Override
+ protected void internalRemoveComponent(Component component)
+ throws ComponentException {
+ registry.deleteComponent((NewComponent) component);
+ }
+
+ String getId() {
+ return id;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof NewComponentFamily) {
+ NewComponentFamily other = (NewComponentFamily) o;
+ return registry.equals(other.registry) && id.equals(other.id);
+ }
+ return false;
+ }
+
+ private static final int BASEHASH = NewComponentFamily.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ registry.hashCode() ^ id.hashCode();
+ }
+
+ public String getResourceLocation() {
+ return resource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentLicense.java
new file mode 100644
index 0000000..5e08b4b
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentLicense.java
@@ -0,0 +1,76 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.registry.api.LicenseType;
+
+class NewComponentLicense implements License {
+ private NewComponentRegistry registry;
+ private String id;
+ private String title;
+ private String description;
+ private String abbreviation;
+
+ static final String ELEMENTS = "title,description,unique-name";
+
+ NewComponentLicense(NewComponentRegistry newComponentRegistry,
+ LicenseType lt) {
+ registry = newComponentRegistry;
+ id = lt.getId();
+ title = lt.getTitle();
+ description = lt.getDescription();
+ abbreviation = lt.getUniqueName();
+ }
+
+ String getId() {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof NewComponentLicense))
+ return false;
+ NewComponentLicense other = (NewComponentLicense) o;
+ return registry.equals(other.registry) && id.equals(other.id);
+ }
+
+ private static final int BASEHASH = NewComponentLicense.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ registry.hashCode() ^ id.hashCode();
+ }
+
+ @Override
+ public String getName() {
+ return title;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getAbbreviation() {
+ return abbreviation;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentProfile.java
new file mode 100644
index 0000000..372c853
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentProfile.java
@@ -0,0 +1,121 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.profile.BaseProfileLocator;
+import io.github.taverna_extras.component.profile.ComponentProfileImpl;
+import io.github.taverna_extras.component.registry.api.ComponentProfileType;
+import io.github.taverna_extras.component.registry.api.Description;
+
+/**
+ * Profiles managed by the new-interface component registry.
+ *
+ * @author Donal Fellows
+ */
+class NewComponentProfile extends ComponentProfileImpl {
+ private static final String LOCATION = "content-uri";
+ static final String ELEMENTS = LOCATION;
+
+ private final NewComponentRegistry registry;
+ private String id;
+ private String location;
+ private String resource;
+ private final String uri;
+
+ private static URL contentUrl(ComponentProfileType cpt)
+ throws ComponentException {
+ try {
+ return new URL(cpt.getContentUri());
+ } catch (MalformedURLException e) {
+ throw new ComponentException("bad profile location", e);
+ }
+ }
+
+ private static URL getLocationURL(Description cpd) throws ComponentException {
+ try {
+ return new URL(getElementString(cpd, LOCATION));
+ } catch (MalformedURLException e) {
+ throw new ComponentException("bad profile location", e);
+ }
+ }
+
+ NewComponentProfile(NewComponentRegistry registry,
+ ComponentProfileType profile, BaseProfileLocator base)
+ throws ComponentException {
+ super(registry, contentUrl(profile), base);
+ this.registry = registry;
+ uri = profile.getUri();
+ id = profile.getId();
+ location = profile.getContentUri();
+ resource = profile.getResource();
+ }
+
+ NewComponentProfile(NewComponentRegistry registry, Description cpd,
+ BaseProfileLocator base) throws ComponentException {
+ super(registry, getLocationURL(cpd), base);
+ this.registry = registry;
+ uri = cpd.getUri();
+ id = cpd.getId();
+ location = getElementString(cpd, LOCATION);
+ resource = cpd.getResource();
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getID() {
+ return id;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof NewComponentProfile) {
+ NewComponentProfile other = (NewComponentProfile) o;
+ return registry.equals(other.registry) && id.equals(other.id);
+ }
+ return false;
+ }
+
+ private static final int BASEHASH = NewComponentProfile.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ registry.hashCode() ^ id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "Remote Component Profile[" + location + "]";
+ }
+
+ public String getResourceLocation() {
+ return resource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistry.java
new file mode 100644
index 0000000..00a549e
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistry.java
@@ -0,0 +1,485 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.registry.standard.Policy.PRIVATE;
+import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
+
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
+import io.github.taverna_extras.component.registry.api.ComponentDescriptionList;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyList;
+import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
+import io.github.taverna_extras.component.registry.api.ComponentProfileList;
+import io.github.taverna_extras.component.registry.api.ComponentProfileType;
+import io.github.taverna_extras.component.registry.api.ComponentType;
+import io.github.taverna_extras.component.registry.api.Content;
+import io.github.taverna_extras.component.registry.api.Description;
+import io.github.taverna_extras.component.registry.api.LicenseList;
+import io.github.taverna_extras.component.registry.api.LicenseType;
+import io.github.taverna_extras.component.registry.api.ObjectFactory;
+import io.github.taverna_extras.component.registry.api.Permissions;
+import io.github.taverna_extras.component.registry.api.PolicyList;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+
+class NewComponentRegistry extends ComponentRegistry {
+ private static final String PROFILE_MIME_TYPE = "application/vnd.taverna.component-profile+xml";
+ private static final String T2FLOW_MIME_TYPE = "application/vnd.taverna.t2flow+xml";
+ static final Logger logger = getLogger(NewComponentRegistry.class);
+ static final JAXBContext jaxbContext;
+ static final Charset utf8;
+ private static final ObjectFactory objectFactory = new ObjectFactory();
+
+ // service URIs
+ private static final String COMPONENT_SERVICE = "/component.xml";
+ private static final String COMPONENT_FAMILY_SERVICE = "/component-family.xml";
+ private static final String COMPONENT_PROFILE_SERVICE = "/component-profile.xml";
+ private static final String COMPONENT_LIST = "/components.xml";
+ private static final String COMPONENT_FAMILY_LIST = "/component-families.xml";
+ private static final String COMPONENT_PROFILE_LIST = "/component-profiles.xml";
+ private static final String WORKFLOW_SERVICE = "/workflow.xml";
+ private static final String PACK_SERVICE = "/pack.xml";
+ private static final String FILE_SERVICE = "/file.xml";
+ private static final String LICENSE_LIST = "/licenses.xml";
+ private static final String POLICY_LIST = "/policies.xml";
+
+ static {
+ JAXBContext c = null;
+ Charset cs = null;
+ try {
+ c = JAXBContext.newInstance(ComponentDescriptionList.class,
+ ComponentFamilyList.class, ComponentProfileList.class,
+ ComponentType.class, ComponentFamilyType.class,
+ ComponentProfileType.class, PolicyList.class,
+ LicenseList.class);
+ cs = Charset.forName("UTF-8");
+ } catch (JAXBException e) {
+ throw new Error("failed to build context", e);
+ } catch (UnsupportedCharsetException e) {
+ throw new Error("failed to find charset", e);
+ } finally {
+ jaxbContext = c;
+ utf8 = cs;
+ }
+ }
+
+ Client client;
+ private final CredentialManager cm;
+ private final ComponentUtil util;
+ private final SystemUtils system;
+ final AnnotationUtils annUtils;
+
+ protected NewComponentRegistry(CredentialManager cm, URL registryBase,
+ ComponentUtil util, SystemUtils system, AnnotationUtils annUtils) throws ComponentException {
+ super(registryBase);
+ this.cm = cm;
+ this.util = util;
+ this.system = system;
+ this.annUtils = annUtils;
+ }
+
+ private void checkClientCreated() throws ComponentException {
+ try {
+ if (client == null)
+ client = new Client(jaxbContext, super.getRegistryBase(), cm);
+ } catch (Exception e) {
+ throw new ComponentException("Unable to access registry", e);
+ }
+ }
+
+ private List<Description> listComponentFamilies(String profileUri)
+ throws ComponentException {
+ checkClientCreated();
+ return client.get(ComponentFamilyList.class, COMPONENT_FAMILY_LIST,
+ "component-profile=" + profileUri,
+ "elements=" + NewComponentFamily.ELEMENTS).getPack();
+ }
+
+ ComponentType getComponentById(String id, Integer version, String elements)
+ throws ComponentException {
+ checkClientCreated();
+
+ if (version != null) {
+ return client.get(ComponentType.class, WORKFLOW_SERVICE,
+ "id=" + id, "version=" + version, "elements=" + elements);
+ }
+ return client.get(ComponentType.class, WORKFLOW_SERVICE, "id=" + id,
+ "elements=" + elements);
+ }
+
+ @SuppressWarnings("unused")
+ private ComponentFamilyType getComponentFamilyById(String id,
+ String elements) throws ComponentException {
+ checkClientCreated();
+
+ return client.get(ComponentFamilyType.class, PACK_SERVICE, "id=" + id,
+ "elements=" + elements);
+ }
+
+ private ComponentProfileType getComponentProfileById(String id,
+ String elements) throws ComponentException {
+ checkClientCreated();
+
+ return client.get(ComponentProfileType.class, FILE_SERVICE, "id=" + id,
+ "elements=" + elements);
+ }
+
+ @Override
+ protected void populateFamilyCache() throws ComponentException {
+ for (Profile pr : getComponentProfiles()) {
+ NewComponentProfile p = (NewComponentProfile) pr;
+ for (Description cfd : listComponentFamilies(p
+ .getResourceLocation()))
+ familyCache.put(getElementString(cfd, "title"),
+ new NewComponentFamily(this, p, cfd, util));
+ }
+ }
+
+ @Override
+ protected Family internalCreateComponentFamily(String familyName,
+ Profile componentProfile, String description, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ NewComponentProfile profile = (NewComponentProfile) componentProfile;
+
+ checkClientCreated();
+
+ return new NewComponentFamily(this, profile, client.post(
+ ComponentFamilyType.class,
+ objectFactory.createPack(makeComponentFamilyCreateRequest(
+ profile, familyName, description, license,
+ sharingPolicy)), COMPONENT_FAMILY_SERVICE, "elements="
+ + NewComponentFamily.ELEMENTS), util);
+ }
+
+ @Override
+ protected void internalRemoveComponentFamily(Family componentFamily)
+ throws ComponentException {
+ NewComponentFamily ncf = (NewComponentFamily) componentFamily;
+ checkClientCreated();
+
+ client.delete(WORKFLOW_SERVICE, "id=" + ncf.getId());
+ }
+
+ @Override
+ protected void populateProfileCache() throws ComponentException {
+ checkClientCreated();
+
+ for (Description cpd : client.get(ComponentProfileList.class,
+ COMPONENT_PROFILE_LIST,
+ "elements=" + NewComponentProfile.ELEMENTS).getFile())
+ if (cpd.getUri() != null && !cpd.getUri().isEmpty())
+ profileCache.add(new NewComponentProfile(this, cpd, util
+ .getBaseProfileLocator()));
+ }
+
+ @Override
+ protected Profile internalAddComponentProfile(Profile componentProfile,
+ License license, SharingPolicy sharingPolicy)
+ throws ComponentException {
+ if (componentProfile == null)
+ throw new ComponentException("component profile must not be null");
+ try {
+ if (componentProfile instanceof NewComponentProfile) {
+ NewComponentProfile profile = (NewComponentProfile) componentProfile;
+ if (profile.getComponentRegistry().equals(this))
+ return new NewComponentProfile(this,
+ getComponentProfileById(profile.getId(),
+ NewComponentProfile.ELEMENTS),
+ util.getBaseProfileLocator());
+ }
+ } catch (ComponentException e) {
+ // Do nothing but fall through
+ }
+ checkClientCreated();
+
+ return new NewComponentProfile(this, client.post(
+ ComponentProfileType.class, objectFactory
+ .createFile(makeComponentProfileCreateRequest(
+ componentProfile.getName(),
+ componentProfile.getDescription(),
+ componentProfile.getXML(), license,
+ sharingPolicy)), COMPONENT_PROFILE_SERVICE,
+ "elements=" + NewComponentProfile.ELEMENTS),
+ util.getBaseProfileLocator());
+ }
+
+ public Permissions getPermissions(SharingPolicy userSharingPolicy) {
+ if (userSharingPolicy == null)
+ userSharingPolicy = getDefaultSharingPolicy();
+ return ((Policy) userSharingPolicy).getPermissionsElement();
+ }
+
+ private ComponentProfileType makeComponentProfileCreateRequest(
+ String title, String description, String content, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ ComponentProfileType profile = new ComponentProfileType();
+
+ profile.setFilename(title + ".xml");
+ profile.setTitle(title);
+ profile.setTitle(description);
+ profile.setContentType(PROFILE_MIME_TYPE);
+ profile.setContent(new Content());
+ profile.getContent().setEncoding("base64");
+ profile.getContent().setType("binary");
+ profile.getContent().setValue(content.getBytes(utf8));
+ if (license == null)
+ license = getPreferredLicense();
+ profile.setLicenseType(new Description());
+ profile.getLicenseType().getContent().add(license.getAbbreviation());
+ profile.setPermissions(getPermissions(sharingPolicy));
+
+ return profile;
+ }
+
+ private ComponentFamilyType makeComponentFamilyCreateRequest(
+ NewComponentProfile profile, String familyName, String description,
+ License license, SharingPolicy sharingPolicy)
+ throws ComponentException {
+ ComponentFamilyType familyDoc = new ComponentFamilyType();
+
+ familyDoc.setComponentProfile(profile.getResourceLocation());
+ familyDoc.setDescription(description);
+ familyDoc.setTitle(familyName);
+ if (license == null)
+ license = getPreferredLicense();
+ familyDoc.setLicenseType(new Description());
+ familyDoc.getLicenseType().getContent().add(license.getAbbreviation());
+ familyDoc.setPermissions(getPermissions(sharingPolicy));
+
+ return familyDoc;
+ }
+
+ private ComponentType makeComponentVersionCreateRequest(String title,
+ String description, WorkflowBundle content, NewComponentFamily family,
+ License license, SharingPolicy sharingPolicy)
+ throws ComponentException {
+ ComponentType comp = new ComponentType();
+
+ comp.setTitle(title);
+ comp.setDescription(description);
+ if (family != null)
+ comp.setComponentFamily(family.getResourceLocation());
+ comp.setContentType(T2FLOW_MIME_TYPE);
+ comp.setContent(new Content());
+ comp.getContent().setEncoding("base64");
+ comp.getContent().setType("binary");
+ comp.getContent().setValue(system.serializeBundle(content));
+ if (license == null)
+ license = getPreferredLicense();
+ if (license != null) {
+ comp.setLicenseType(new Description());
+ comp.getLicenseType().getContent().add(license.getAbbreviation());
+ }
+ comp.setPermissions(getPermissions(sharingPolicy));
+
+ return comp;
+ }
+
+ private static final boolean DO_LIST_POLICIES = false;
+
+ private List<Description> listPolicies() throws ComponentException {
+ checkClientCreated();
+ return client.get(PolicyList.class, POLICY_LIST, "type=group")
+ .getPolicy();
+ }
+
+ @Override
+ protected void populatePermissionCache() {
+ permissionCache.add(Policy.PUBLIC);
+ permissionCache.add(Policy.PRIVATE);
+ try {
+ if (DO_LIST_POLICIES)
+ for (Description d : listPolicies())
+ permissionCache.add(new Policy.Group(d.getId()));
+ } catch (ComponentException e) {
+ logger.warn("failed to fetch sharing policies", e);
+ }
+ }
+
+ private List<LicenseType> listLicenses() throws ComponentException {
+ checkClientCreated();
+
+ return client.get(LicenseList.class, LICENSE_LIST,
+ "elements=" + NewComponentLicense.ELEMENTS).getLicense();
+ }
+
+ @Override
+ protected void populateLicenseCache() {
+ try {
+ for (LicenseType lt : listLicenses())
+ licenseCache.add(new NewComponentLicense(this, lt));
+ } catch (ComponentException e) {
+ logger.warn("failed to fetch licenses", e);
+ }
+ }
+
+ @Override
+ public License getPreferredLicense() throws ComponentException {
+ return getLicenseByAbbreviation(getNameOfPreferredLicense());
+ }
+
+ public String getNameOfPreferredLicense() {
+ return "by-nd";
+ }
+
+ public SharingPolicy getDefaultSharingPolicy() {
+ return PRIVATE;
+ }
+
+ private List<Description> listComponents(String query, String prefixes)
+ throws ComponentException {
+ checkClientCreated();
+
+ return client.get(ComponentDescriptionList.class, COMPONENT_LIST,
+ "query=" + query, "prefixes=" + prefixes,
+ "elements=" + NewComponent.ELEMENTS).getWorkflow();
+ }
+
+ @Override
+ public Set<ID> searchForComponents(String prefixes, String text)
+ throws ComponentException {
+ HashSet<ID> versions = new HashSet<>();
+ for (Description cd : listComponents(text, prefixes)) {
+ NewComponent nc = null;
+ for (Family f : getComponentFamilies()) {
+ nc = (NewComponent) ((NewComponentFamily) f)
+ .getComponent(getElementString(cd, "title"));
+ if (nc != null)
+ break;
+ }
+ if (nc != null)
+ versions.add(new ComponentVersionIdentification(
+ getRegistryBase(), nc.getFamily().getName(), nc
+ .getName(), cd.getVersion()));
+ else
+ logger.warn("could not construct component for " + cd.getUri());
+ }
+ return versions;
+ }
+
+ private List<Description> listComponents(String familyUri)
+ throws ComponentException {
+ checkClientCreated();
+
+ return client.get(ComponentDescriptionList.class, COMPONENT_LIST,
+ "component-family=" + familyUri,
+ "elements=" + NewComponent.ELEMENTS).getWorkflow();
+ }
+
+ protected List<Component> listComponents(NewComponentFamily family)
+ throws ComponentException {
+ List<Component> result = new ArrayList<>();
+ for (Description cd : listComponents(family.getResourceLocation()))
+ result.add(new NewComponent(this, family, cd, system));
+ return result;
+ }
+
+ protected void deleteComponent(NewComponent component)
+ throws ComponentException {
+ checkClientCreated();
+
+ client.delete(WORKFLOW_SERVICE, "id=" + component.getId());
+ }
+
+ protected Version createComponentFrom(NewComponentFamily family,
+ String componentName, String description,
+ WorkflowBundle implementation, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ checkClientCreated();
+
+ ComponentType ct = client.post(ComponentType.class, objectFactory
+ .createWorkflow(makeComponentVersionCreateRequest(
+ componentName, description, implementation, family,
+ license, sharingPolicy)), COMPONENT_SERVICE,
+ "elements=" + NewComponent.ELEMENTS);
+ NewComponent nc = new NewComponent(this, family, ct, system);
+ return nc.new Version(ct.getVersion(), description, implementation);
+ }
+
+ protected Version createComponentVersionFrom(NewComponent component,
+ String componentName, String description,
+ WorkflowBundle implementation, License license,
+ SharingPolicy sharingPolicy) throws ComponentException {
+ checkClientCreated();
+
+ ComponentType ct = client.post(ComponentType.class, objectFactory
+ .createWorkflow(makeComponentVersionCreateRequest(
+ componentName, description, implementation,
+ component.family, license, sharingPolicy)),
+ COMPONENT_SERVICE, "id=" + component.getId(), "elements="
+ + NewComponent.ELEMENTS);
+ return component.new Version(ct.getVersion(), description,
+ implementation);
+ }
+
+ public License getLicense(String name) throws ComponentException {
+ for (License l : getLicenses())
+ if (l.getAbbreviation().equals(name))
+ return l;
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ // Careful! Java's URL equality IS BROKEN!
+ if (o != null && o instanceof NewComponentRegistry) {
+ NewComponentRegistry other = (NewComponentRegistry) o;
+ return getRegistryBaseString()
+ .equals(other.getRegistryBaseString());
+ }
+ return false;
+ }
+
+ private static final int BASEHASH = NewComponentRegistry.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ getRegistryBaseString().hashCode();
+ }
+
+ @Override
+ public String getRegistryTypeName() {
+ return "Component API";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryFactory.java
new file mode 100644
index 0000000..43dc37d
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryFactory.java
@@ -0,0 +1,83 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.jaxbContext;
+import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentRegistry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.springframework.beans.factory.annotation.Required;
+
+public class NewComponentRegistryFactory {
+ private final Map<String, NewComponentRegistry> componentRegistries = new HashMap<>();
+ private CredentialManager cm;
+ private ComponentUtil util;
+ private SystemUtils system;
+ private AnnotationUtils annUtils;
+
+ @Required
+ public void setCredentialManager(CredentialManager cm) {
+ this.cm = cm;
+ }
+
+ @Required
+ public void setComponentUtil(ComponentUtil util) {
+ this.util = util;
+ }
+
+ @Required
+ public void setSystemUtils(SystemUtils system) {
+ this.system = system;
+ }
+
+ @Required
+ public void setAnnotationUtils(AnnotationUtils annUtils) {
+ this.annUtils = annUtils;
+ }
+
+ public synchronized ComponentRegistry getComponentRegistry(URL registryBase)
+ throws ComponentException {
+ if (!componentRegistries.containsKey(registryBase.toExternalForm())) {
+ logger.debug("constructing registry instance for " + registryBase);
+ componentRegistries.put(registryBase.toExternalForm(),
+ new NewComponentRegistry(cm, registryBase, util, system,
+ annUtils));
+ }
+ return componentRegistries.get(registryBase.toExternalForm());
+ }
+
+ public boolean verifyBase(URL registryBase) {
+ try {
+ return new Client(jaxbContext, registryBase, false, cm).verify();
+ } catch (Exception e) {
+ logger.info("failed to construct connection client to "
+ + registryBase, e);
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Policy.java
new file mode 100644
index 0000000..3b521af
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/Policy.java
@@ -0,0 +1,136 @@
+package io.github.taverna_extras.component.registry.standard;
+
+import static java.lang.System.identityHashCode;
+import static io.github.taverna_extras.component.registry.api.Privilege.DOWNLOAD;
+import static io.github.taverna_extras.component.registry.api.Privilege.VIEW;
+
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.registry.api.Permissions;
+import io.github.taverna_extras.component.registry.api.Permissions.Permission;
+
+abstract class Policy implements SharingPolicy {
+ public static final SharingPolicy PUBLIC = new Public();
+ public static final SharingPolicy PRIVATE = new Private();
+
+ Policy() {
+ }
+
+ public abstract Permissions getPermissionsElement();
+
+ public static SharingPolicy getPolicy(Permissions perm) {
+ if (perm == null)
+ return PRIVATE;
+ if (perm.getGroupPolicyId() != null)
+ return new Group(perm.getGroupPolicyId());
+ for (Permission p : perm.getPermission())
+ if (p.getId() != null)
+ return new Group(p.getId().toString(), perm);
+ return PUBLIC;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null || !(o instanceof Policy))
+ return false;
+ return equals((Policy) o);
+ }
+
+ @Override
+ public abstract int hashCode();
+
+ protected abstract boolean equals(Policy p);
+
+ static class Public extends Policy {
+ @Override
+ public String getName() {
+ return "Public";
+ }
+
+ @Override
+ public Permissions getPermissionsElement() {
+ Permission.Privilege privView = new Permission.Privilege();
+ privView.setType(VIEW);
+ Permission.Privilege privDownload = new Permission.Privilege();
+ privDownload.setType(DOWNLOAD);
+ Permission perm = new Permission();
+ perm.setCategory("public");
+ perm.getPrivilege().add(privView);
+ perm.getPrivilege().add(privDownload);
+ Permissions result = new Permissions();
+ result.getPermission().add(perm);
+ return result;
+ }
+
+ @Override
+ protected boolean equals(Policy p) {
+ return p instanceof Public;
+ }
+
+ @Override
+ public int hashCode() {
+ return identityHashCode(PUBLIC);
+ }
+ }
+
+ static class Private extends Policy {
+ @Override
+ public String getName() {
+ return "Private";
+ }
+
+ @Override
+ public Permissions getPermissionsElement() {
+ return null;
+ }
+
+ @Override
+ protected boolean equals(Policy p) {
+ return p instanceof Private;
+ }
+
+ @Override
+ public int hashCode() {
+ return identityHashCode(PRIVATE);
+ }
+ }
+
+ static class Group extends Policy {
+ private String id;
+ private Permissions p;
+
+ public Group(String id) {
+ this.id = id;
+ }
+
+ public Group(String id, Permissions p) {
+ this.id = id;
+ this.p = p;
+ }
+
+ @Override
+ public String getName() {
+ return "Group(" + id + ")";
+ }
+
+ @Override
+ public Permissions getPermissionsElement() {
+ if (p != null)
+ return p;
+ Permissions result = new Permissions();
+ result.setGroupPolicyId(id);
+ return result;
+ }
+
+ @Override
+ protected boolean equals(Policy p) {
+ return (p instanceof Group) && id.equals(((Group) p).id);
+ }
+
+ private static final int BASEHASH = Group.class.hashCode();
+
+ @Override
+ public int hashCode() {
+ return BASEHASH ^ id.hashCode();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/Unused.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/Unused.java
new file mode 100644
index 0000000..e6a709b
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/Unused.java
@@ -0,0 +1,43 @@
+package io.github.taverna_extras.component.registry.standard.annotations;
+/*
+ * 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.
+ */
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a constructor, field, method or parameter as unused. Unused members
+ * exist for the purpose of documentation or completeness.
+ *
+ * @author Donal Fellows
+ */
+@Documented
+@Target({ CONSTRUCTOR, FIELD, METHOD, PARAMETER, TYPE })
+@Retention(CLASS)
+public @interface Unused {
+
+}
[10/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
deleted file mode 100644
index fd0285d..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistry.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.apache.commons.io.FileUtils.writeStringToFile;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.profile.ComponentProfileImpl;
-import io.github.taverna_extras.component.registry.ComponentRegistry;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-/**
- * A component registry implemented using the local file system. Note that the
- * components it contains are <i>not</i> shareable.
- *
- * @author alanrw
- */
-class LocalComponentRegistry extends ComponentRegistry {
- private static final Logger logger = getLogger(LocalComponentRegistry.class);
- static final String ENC = "utf-8";
- private ComponentUtil util;
- private SystemUtils system;
- private File baseDir;
-
- public LocalComponentRegistry(File registryDir, ComponentUtil util,
- SystemUtils system) throws ComponentException {
- super(registryDir);
- baseDir = registryDir;
- this.util = util;
- this.system = system;
- }
-
- @Override
- public Family internalCreateComponentFamily(String name,
- Profile componentProfile, String description, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- File newFamilyDir = new File(getComponentFamiliesDir(), name);
- newFamilyDir.mkdirs();
- File profileFile = new File(newFamilyDir, "profile");
- try {
- writeStringToFile(profileFile, componentProfile.getName(), ENC);
- } catch (IOException e) {
- throw new ComponentException("Could not write out profile", e);
- }
- File descriptionFile = new File(newFamilyDir, "description");
- try {
- writeStringToFile(descriptionFile, description, ENC);
- } catch (IOException e) {
- throw new ComponentException("Could not write out description", e);
- }
- return new LocalComponentFamily(this, newFamilyDir, util, system);
- }
-
- @Override
- protected void populateFamilyCache() throws ComponentException {
- File familiesDir = getComponentFamiliesDir();
- for (File subFile : familiesDir.listFiles()) {
- if (!subFile.isDirectory())
- continue;
- LocalComponentFamily newFamily = new LocalComponentFamily(this,
- subFile, util, system);
- familyCache.put(newFamily.getName(), newFamily);
- }
- }
-
- @Override
- protected void populateProfileCache() throws ComponentException {
- File profilesDir = getComponentProfilesDir();
- for (File subFile : profilesDir.listFiles())
- if (subFile.isFile() && (!subFile.isHidden())
- && subFile.getName().endsWith(".xml"))
- try {
- profileCache.add(new LocalComponentProfile(subFile));
- } catch (MalformedURLException e) {
- logger.error("Unable to read profile", e);
- }
- }
-
- @Override
- protected void internalRemoveComponentFamily(Family componentFamily)
- throws ComponentException {
- try {
- deleteDirectory(new File(getComponentFamiliesDir(),
- componentFamily.getName()));
- } catch (IOException e) {
- throw new ComponentException("Unable to delete component family", e);
- }
- }
-
- private File getBaseDir() {
- baseDir.mkdirs();
- return baseDir;
- }
-
- private File getComponentFamiliesDir() {
- File componentFamiliesDir = new File(getBaseDir(), "componentFamilies");
- componentFamiliesDir.mkdirs();
- return componentFamiliesDir;
- }
-
- private File getComponentProfilesDir() {
- File componentProfilesDir = new File(getBaseDir(), "componentProfiles");
- componentProfilesDir.mkdirs();
- return componentProfilesDir;
- }
-
- @Override
- public Profile internalAddComponentProfile(Profile componentProfile,
- License license, SharingPolicy sharingPolicy)
- throws ComponentException {
- String name = componentProfile.getName().replaceAll("\\W+", "")
- + ".xml";
- String inputString = componentProfile.getXML();
- File outputFile = new File(getComponentProfilesDir(), name);
- try {
- writeStringToFile(outputFile, inputString);
- } catch (IOException e) {
- throw new ComponentException("Unable to save profile", e);
- }
-
- try {
- return new LocalComponentProfile(outputFile);
- } catch (MalformedURLException e) {
- throw new ComponentException("Unable to create profile", e);
- }
- }
-
- @Override
- public int hashCode() {
- return 31 + ((baseDir == null) ? 0 : baseDir.hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LocalComponentRegistry other = (LocalComponentRegistry) obj;
- if (baseDir == null)
- return (other.baseDir == null);
- return baseDir.equals(other.baseDir);
- }
-
- @Override
- public void populatePermissionCache() {
- return;
- }
-
- @Override
- public void populateLicenseCache() {
- return;
- }
-
- @Override
- public License getPreferredLicense() {
- return null;
- }
-
- @Override
- public Set<Version.ID> searchForComponents(String prefixString, String text)
- throws ComponentException {
- throw new ComponentException("Local registries cannot be searched yet");
- }
-
- @Override
- public String getRegistryTypeName() {
- return "File System";
- }
-
- class LocalComponentProfile extends ComponentProfileImpl {
- URI uri;
-
- LocalComponentProfile(File file) throws MalformedURLException,
- ComponentException {
- super(LocalComponentRegistry.this, file.toURI(), util
- .getBaseProfileLocator());
- uri = file.toURI();
- }
-
- @Override
- public String toString() {
- return "Local Component Profile[" + uri + "]";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
deleted file mode 100644
index f2625d1..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentRegistryFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.Map;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.SystemUtils;
-import org.springframework.beans.factory.annotation.Required;
-
-public class LocalComponentRegistryFactory {
- private final Map<File, Registry> registries = new HashMap<>();
- private ComponentUtil util;
- private SystemUtils system;
-
- @Required
- public void setComponentUtil(ComponentUtil util) {
- this.util = util;
- }
-
- @Required
- public void setSystemUtils(SystemUtils system) {
- this.system = system;
- }
-
- public synchronized Registry getComponentRegistry(File registryDir)
- throws ComponentException {
- if (!registries.containsKey(registryDir))
- registries.put(registryDir, new LocalComponentRegistry(registryDir,
- util, system));
- return registries.get(registryDir);
- }
-
- public Registry getComponentRegistry(URL componentRegistryBase)
- throws ComponentException {
- @SuppressWarnings("deprecation")
- String hackedPath = URLDecoder.decode(componentRegistryBase.getPath());
- return getComponentRegistry(new File(hackedPath));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
deleted file mode 100644
index 976aa8b..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentVersion.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import static java.lang.Integer.parseInt;
-import static org.apache.commons.io.FileUtils.readFileToString;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.registry.local.LocalComponent.COMPONENT_FILENAME;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.registry.ComponentVersion;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-class LocalComponentVersion extends ComponentVersion {
- private static Logger logger = getLogger(LocalComponentVersion.class);
-
- private final File componentVersionDir;
- private SystemUtils system;
-
- protected LocalComponentVersion(LocalComponent component,
- File componentVersionDir, SystemUtils system) {
- super(component);
- this.componentVersionDir = componentVersionDir;
- this.system = system;
- }
-
- @Override
- protected final String internalGetDescription() {
- File descriptionFile = new File(componentVersionDir, "description");
- try {
- if (descriptionFile.isFile())
- return readFileToString(descriptionFile);
- } catch (IOException e) {
- logger.error("failed to get description from " + descriptionFile, e);
- }
- return "";
- }
-
- @Override
- protected final Integer internalGetVersionNumber() {
- return parseInt(componentVersionDir.getName());
- }
-
- @Override
- protected final WorkflowBundle internalGetImplementation()
- throws ComponentException {
- File filename = new File(componentVersionDir, COMPONENT_FILENAME);
- try {
- return system.getBundle(filename);
- } catch (Exception e) {
- logger.error(
- "failed to get component realization from " + filename, e);
- throw new ComponentException("Unable to open dataflow", e);
- }
- }
-
- @Override
- public int hashCode() {
- return 31 + ((componentVersionDir == null) ? 0 : componentVersionDir
- .hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LocalComponentVersion other = (LocalComponentVersion) obj;
- if (componentVersionDir == null)
- return (other.componentVersionDir == null);
- return componentVersionDir.equals(other.componentVersionDir);
- }
-
- @Override
- public URL getHelpURL() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
deleted file mode 100644
index 87b99b1..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Client.java
+++ /dev/null
@@ -1,654 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static java.lang.Math.min;
-import static java.lang.String.format;
-import static java.lang.System.getProperty;
-import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
-import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
-import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
-import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
-import static java.net.HttpURLConnection.HTTP_OK;
-import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
-import static java.net.URLEncoder.encode;
-import static javax.xml.bind.DatatypeConverter.printBase64Binary;
-import static org.apache.commons.io.IOUtils.copy;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.registry.ClientVersion.VERSION;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.registry.standard.Client.MyExperimentConnector.ServerResponse;
-import io.github.taverna_extras.component.registry.standard.annotations.Unused;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.UsernamePassword;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-class Client {
- private static final String API_VERIFICATION_RESOURCE = "/component-profiles.xml";
- private static final String WHOAMI = "/whoami.xml";
- private static final String PLUGIN_USER_AGENT = "Taverna2-Component-plugin/"
- + VERSION + " Java/" + getProperty("java.version");
- private static final int MESSAGE_TRIM_LENGTH = 512;
- private static final Logger logger = getLogger(Client.class);
- private final MyExperimentConnector http;
- private final URL registryBase;
- private final JAXBContext jaxbContext;
- private final CredentialManager cm;
-
- Client(JAXBContext context, URL repository, CredentialManager cm)
- throws ComponentException {
- this(context, repository, true, cm);
- }
-
- Client(JAXBContext context, URL repository, boolean tryLogIn,
- CredentialManager cm) throws ComponentException {
- this.cm = cm;
- this.registryBase = repository;
- this.jaxbContext = context;
- this.http = new MyExperimentConnector(tryLogIn);
- logger.info("instantiated client connection engine to " + repository);
- }
-
- public boolean verify() {
- try {
- String url = url(API_VERIFICATION_RESOURCE);
- logger.info("API verification: HEAD for " + url);
- return http.HEAD(url).getCode() == HTTP_OK;
- } catch (Exception e) {
- logger.info("failed to connect to " + registryBase, e);
- return false;
- }
- }
-
- private String url(String uri, String... arguments)
- throws MalformedURLException, UnsupportedEncodingException {
- StringBuilder uriBuilder = new StringBuilder(uri);
- for (String queryElement : arguments) {
- String[] bits = queryElement.split("=", 2);
- uriBuilder.append(uriBuilder.indexOf("?") < 0 ? "?" : "&")
- .append(bits[0]).append('=')
- .append(encode(bits[1], "UTF-8"));
- }
- return new URL(registryBase, uriBuilder.toString()).toString();
- }
-
- private Marshaller getMarshaller() throws JAXBException {
- return jaxbContext.createMarshaller();
- }
-
- /**
- * Does an HTTP GET against the configured repository.
- *
- * @param clazz
- * The JAXB-annotated class that the result is supposed to be
- * instantiated into.
- * @param uri
- * The path part of the URI within the repository.
- * @param query
- * The strings to put into the query part. Each should be in
- * <tt>key=value</tt> form.
- * @return The deserialized response object.
- * @throws ComponentException
- * If anything goes wrong.
- */
- public <T> T get(Class<T> clazz, String uri, String... query)
- throws ComponentException {
- try {
- int redirectCounter = 0;
-
- String url = url(uri, query);
- ServerResponse response;
- do {
- if (redirectCounter++ > 5)
- throw new ComponentException("too many redirects!");
- logger.info("GET of " + url);
- response = http.GET(url);
- if (response.isFailure())
- throw new ComponentException(
- "Unable to perform request (%d): %s",
- response.getCode(), response.getError());
- } while ((url = response.getLocation()) != null);
- return response.getResponse(clazz);
-
- } catch (ComponentException e) {
- throw e;
- } catch (MalformedURLException e) {
- throw new ComponentException("Problem constructing resource URL", e);
- } catch (JAXBException e) {
- throw new ComponentException("Problem when unmarshalling response",
- e);
- } catch (Exception e) {
- throw new ComponentException("Problem when sending request", e);
- }
- }
-
- /**
- * Does an HTTP POST against the configured repository.
- *
- * @param clazz
- * The JAXB-annotated class that the result is supposed to be
- * instantiated into.
- * @param elem
- * The JAXB element to post to the resource.
- * @param uri
- * The path part of the URI within the repository.
- * @param query
- * The strings to put into the query part. Each should be in
- * <tt>key=value</tt> form.
- * @return The deserialized response object.
- * @throws ComponentException
- * If anything goes wrong.
- */
- public <T> T post(Class<T> clazz, JAXBElement<?> elem, String uri,
- String... query) throws ComponentException {
- try {
-
- String url = url(uri, query);
- logger.info("POST to " + url);
- StringWriter sw = new StringWriter();
- getMarshaller().marshal(elem, sw);
- if (logger.isDebugEnabled())
- logger.info("About to post XML document:\n" + sw);
- ServerResponse response = http.POST(url, sw);
- if (response.isFailure())
- throw new ComponentException(
- "Unable to perform request (%d): %s",
- response.getCode(), response.getError());
- if (response.getLocation() != null)
- return get(clazz, response.getLocation());
- return response.getResponse(clazz);
-
- } catch (ComponentException e) {
- throw e;
- } catch (MalformedURLException e) {
- throw new ComponentException("Problem constructing resource URL", e);
- } catch (JAXBException e) {
- throw new ComponentException("Problem when marshalling request", e);
- } catch (Exception e) {
- throw new ComponentException("Problem when sending request", e);
- }
- }
-
- /**
- * Does an HTTP PUT against the configured repository.
- *
- * @param clazz
- * The JAXB-annotated class that the result is supposed to be
- * instantiated into.
- * @param elem
- * The JAXB element to post to the resource.
- * @param uri
- * The path part of the URI within the repository.
- * @param query
- * The strings to put into the query part. Each should be in
- * <tt>key=value</tt> form.
- * @return The deserialized response object.
- * @throws ComponentException
- * If anything goes wrong.
- */
- @Unused
- public <T> T put(Class<T> clazz, JAXBElement<?> elem, String uri,
- String... query) throws ComponentException {
- try {
-
- String url = url(uri, query);
- logger.info("PUT to " + url);
- StringWriter sw = new StringWriter();
- getMarshaller().marshal(elem, sw);
- if (logger.isDebugEnabled())
- logger.info("About to put XML document:\n" + sw);
- ServerResponse response = http.PUT(url, sw);
- if (response.isFailure())
- throw new ComponentException(
- "Unable to perform request (%d): %s",
- response.getCode(), response.getError());
- if (response.getLocation() != null)
- return get(clazz, response.getLocation());
- return response.getResponse(clazz);
-
- } catch (ComponentException e) {
- throw e;
- } catch (MalformedURLException e) {
- throw new ComponentException("Problem constructing resource URL", e);
- } catch (JAXBException e) {
- throw new ComponentException("Problem when marshalling request", e);
- } catch (Exception e) {
- throw new ComponentException("Problem when sending request", e);
- }
- }
-
- /**
- * Does an HTTP DELETE against the configured repository.
- *
- * @param uri
- * The path part of the URI within the repository.
- * @param query
- * The strings to put into the query part. Each should be in
- * <tt>key=value</tt> form.
- * @throws ComponentException
- * If anything goes wrong.
- */
- public void delete(String uri, String... query) throws ComponentException {
- ServerResponse response;
- try {
-
- String url = url(uri, query);
- logger.info("DELETE of " + url);
- response = http.DELETE(url);
-
- } catch (MalformedURLException e) {
- throw new ComponentException("Problem constructing resource URL", e);
- } catch (Exception e) {
- throw new ComponentException("Unable to perform request", e);
- }
- if (response.isFailure())
- throw new ComponentException("Unable to perform request (%d): %s",
- response.getCode(), response.getError());
- }
-
- private String getCredentials(String urlString, boolean mandatory)
- throws CMException, UnsupportedEncodingException {
- final URI serviceURI = URI.create(urlString);
-
- if (mandatory || cm.hasUsernamePasswordForService(serviceURI)) {
- UsernamePassword userAndPass = cm.getUsernameAndPasswordForService(
- serviceURI, true, null);
- // Check for user didn't log in...
- if (userAndPass == null)
- return null;
- return printBase64Binary(format("%s:%s", userAndPass.getUsername(),
- userAndPass.getPasswordAsString()).getBytes("UTF-8"));
- }
- return null;
- }
-
- private void clearCredentials(String baseURL) throws CMException {
- for (URI uri : cm.getServiceURIsForAllUsernameAndPasswordPairs())
- if (uri.toString().startsWith(baseURL))
- cm.deleteUsernameAndPasswordForService(uri);
- }
-
- private static Document getDocumentFromStream(InputStream inputStream)
- throws SAXException, IOException, ParserConfigurationException {
- DocumentBuilder db = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder();
- Document doc;
- try (InputStream is = new BufferedInputStream(inputStream)) {
- if (!logger.isDebugEnabled())
- doc = db.parse(is);
- else {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- copy(is, baos);
- String response = baos.toString("UTF-8");
- logger.info("response message follows\n"
- + response.substring(0,
- min(MESSAGE_TRIM_LENGTH, response.length())));
- doc = db.parse(new ByteArrayInputStream(baos.toByteArray()));
- }
- }
- return doc;
- }
-
- class MyExperimentConnector {
- // authentication settings (and the current user)
- private String authString = null;
-
- private void tryLogIn(boolean mandatory) throws ComponentException {
- // check if the stored credentials are valid
- ServerResponse response = null;
- try {
- String userPass = getCredentials(registryBase.toString(),
- mandatory);
- if (userPass == null)
- logger.debug("no credentials available for " + registryBase);
- else {
- // set the system to the "logged in" state from INI file properties
- authString = userPass;
- response = GET(registryBase.toString() + WHOAMI);
- }
- } catch (Exception e) {
- authString = null;
- logger.debug("failed when verifying login credentials", e);
- }
-
- if (response == null || response.getCode() != HTTP_OK)
- try {
- if (response != null)
- throw new ComponentException("failed to log in: "
- + response.getError());
- } finally {
- try {
- authString = null;
- clearCredentials(registryBase.toString());
- } catch (Exception e) {
- logger.debug("failed to clear credentials", e);
- }
- }
- if (authString != null)
- logger.debug("logged in to repository successfully");
- }
-
- MyExperimentConnector(boolean tryLogIn) throws ComponentException {
- if (tryLogIn)
- tryLogIn(false);
- }
-
- // getter for the current status
- private boolean isLoggedIn() {
- return authString != null;
- }
-
- private HttpURLConnection connect(String method, String strURL)
- throws MalformedURLException, IOException {
- HttpURLConnection conn = (HttpURLConnection) new URL(strURL)
- .openConnection();
- conn.setRequestMethod(method);
- if (method.equals("POST") || method.equals("PUT"))
- conn.setDoOutput(true);
- conn.setRequestProperty("User-Agent", PLUGIN_USER_AGENT);
- if (authString != null)
- conn.setRequestProperty("Authorization", "Basic " + authString);
- return conn;
- }
-
- private boolean elevate() throws ComponentException {
- tryLogIn(true);
- return isLoggedIn();
- }
-
- /**
- * Generic method to execute GET requests to myExperiment server.
- *
- * @param url
- * The URL on myExperiment to issue GET request to.
- * @return An object containing XML Document with server's response body
- * and a response code. Response body XML document might be null
- * if there was an error or the user wasn't authorised to
- * perform a certain action. Response code will always be set.
- * @throws Exception
- */
- public ServerResponse GET(String url) throws Exception {
- if (!isLoggedIn())
- logger.warn("not logged in");
- return receiveServerResponse(connect("GET", url), url, true, false);
- }
-
- /**
- * Generic method to execute GET requests to myExperiment server.
- *
- * @param url
- * The URL on myExperiment to issue GET request to.
- * @return An object containing XML Document with server's response body
- * and a response code. Response body XML document might be null
- * if there was an error or the user wasn't authorised to
- * perform a certain action. Response code will always be set.
- * @throws Exception
- */
- public ServerResponse HEAD(String url) throws Exception {
- if (!isLoggedIn())
- logger.warn("not logged in");
- return receiveServerResponse(connect("HEAD", url), url, false, true);
- }
-
- /**
- * Generic method to execute GET requests to myExperiment server.
- *
- * @param url
- * The URL on myExperiment to POST to.
- * @param xmlDataBody
- * Body of the XML data to be POSTed to strURL.
- * @return An object containing XML Document with server's response body
- * and a response code. Response body XML document might be null
- * if there was an error or the user wasn't authorised to
- * perform a certain action. Response code will always be set.
- * @throws Exception
- */
- public ServerResponse POST(String url, Object xmlDataBody)
- throws Exception {
- if (!isLoggedIn() && !elevate())
- return null;
-
- HttpURLConnection conn = connect("POST", url);
- sendXmlBody(xmlDataBody, conn);
- return receiveServerResponse(conn, url, false, false);
- }
-
- /**
- * Generic method to execute DELETE requests to myExperiment server.
- * This is only to be called when a user is logged in.
- *
- * @param url
- * The URL on myExperiment to direct DELETE request to.
- * @return An object containing XML Document with server's response body
- * and a response code. Response body XML document might be null
- * if there was an error or the user wasn't authorised to
- * perform a certain action. Response code will always be set.
- * @throws Exception
- */
- public ServerResponse DELETE(String url) throws Exception {
- if (!isLoggedIn() && !elevate())
- return null;
- return receiveServerResponse(connect("DELETE", url), url, true,
- false);
- }
-
- @Unused
- public ServerResponse PUT(String url, Object xmlDataBody)
- throws Exception {
- if (!isLoggedIn() && !elevate())
- return null;
-
- HttpURLConnection conn = connect("PUT", url);
- sendXmlBody(xmlDataBody, conn);
- return receiveServerResponse(conn, url, false, false);
- }
-
- /**
- * Factoring out of how to write a body.
- *
- * @param xmlDataBody
- * What to write (an {@link InputStream}, a {@link Reader} or
- * an object that will have it's {@link Object#toString()
- * toString()} method called.
- * @param conn
- * Where to write it to.
- * @throws IOException
- * If anything goes wrong. The <code>conn</code> will be
- * disconnected in the case of a failure.
- */
- private void sendXmlBody(Object xmlDataBody, HttpURLConnection conn)
- throws IOException {
- try {
- conn.setRequestProperty("Content-Type", "application/xml");
- if (xmlDataBody instanceof InputStream)
- copy((InputStream) xmlDataBody, conn.getOutputStream());
- else
- try (OutputStreamWriter out = new OutputStreamWriter(
- conn.getOutputStream())) {
- if (xmlDataBody instanceof Reader)
- copy((Reader) xmlDataBody, out);
- else
- out.write(xmlDataBody.toString());
- }
- } catch (IOException e) {
- conn.disconnect();
- throw e;
- }
- }
-
- /**
- * A common method for retrieving myExperiment server's response for all
- * types of requests.
- *
- * @param conn
- * Instance of the established URL connection to poll for
- * server's response.
- * @param url
- * The URL on myExperiment with which the connection is
- * established.
- * @param isGETrequest
- * Flag for identifying type of the request. True when the
- * current connection executes GET request; false when it
- * executes a POST request.
- * @return An object containing XML Document with server's response body
- * and a response code. Response body XML document might be null
- * if there was an error or the user wasn't authorised to
- * perform a certain action. Response code will always be set.
- */
- private ServerResponse receiveServerResponse(HttpURLConnection conn,
- String url, boolean isGETrequest, boolean isHEADrequest)
- throws Exception {
- try {
- switch (conn.getResponseCode()) {
- case HTTP_OK:
- /*
- * data retrieval was successful - parse the response XML
- * and return it along with response code
- */
- if (isHEADrequest)
- return new ServerResponse(conn.getResponseCode(), null,
- null);
- return new ServerResponse(conn.getResponseCode(), null,
- getDocumentFromStream(conn.getInputStream()));
- case HTTP_NO_CONTENT:
- return new ServerResponse(HTTP_OK, null, null);
-
- case HttpURLConnection.HTTP_CREATED:
- case HttpURLConnection.HTTP_MOVED_PERM:
- case HttpURLConnection.HTTP_MOVED_TEMP:
- case HttpURLConnection.HTTP_SEE_OTHER:
- case HttpURLConnection.HTTP_USE_PROXY:
- return new ServerResponse(conn.getResponseCode(),
- conn.getHeaderField("Location"), null);
-
- case HTTP_BAD_REQUEST:
- case HTTP_FORBIDDEN:
- /*
- * this was a bad XML request - need full XML response to
- * retrieve the error message from it; Java throws
- * IOException if getInputStream() is used when non HTTP_OK
- * response code was received - hence can use
- * getErrorStream() straight away to fetch the error
- * document
- */
- return new ServerResponse(conn.getResponseCode(), null,
- getDocumentFromStream(conn.getErrorStream()));
-
- case HTTP_UNAUTHORIZED:
- // this content is not authorised for current user
- logger.warn("non-authorised request to " + url + "\n"
- + IOUtils.toString(conn.getErrorStream()));
- return new ServerResponse(conn.getResponseCode(), null,
- null);
-
- case HTTP_NOT_FOUND:
- if (isHEADrequest)
- return new ServerResponse(conn.getResponseCode(), null,
- null);
- throw new FileNotFoundException("no such resource: " + url);
- default:
- // unexpected response code - raise an exception
- throw new IOException(
- format("Received unexpected HTTP response code (%d) while %s %s",
- conn.getResponseCode(),
- (isGETrequest ? "fetching data at"
- : "posting data to"), url));
- }
- } finally {
- conn.disconnect();
- }
- }
-
- class ServerResponse {
- private final int responseCode;
- private final String responseLocation;
- private final Document responseBody;
-
- ServerResponse(int responseCode, String responseLocation,
- Document responseBody) {
- this.responseCode = responseCode;
- this.responseBody = responseBody;
- this.responseLocation = responseLocation;
- }
-
- public int getCode() {
- return responseCode;
- }
-
- public boolean isFailure() {
- return responseCode >= HTTP_BAD_REQUEST;
- }
-
- public String getLocation() {
- return responseLocation;
- }
-
- public <T> T getResponse(Class<T> clazz) throws JAXBException {
- return jaxbContext.createUnmarshaller()
- .unmarshal(responseBody.getDocumentElement(), clazz)
- .getValue();
- }
-
- /**
- * Returns contents of the "reason" field of the error message.
- */
- public String getError() {
- if (responseBody != null) {
- Node reasonElement = responseBody.getDocumentElement()
- .getElementsByTagName("reason").item(0);
- if (reasonElement != null) {
- String reason = reasonElement.getTextContent();
- if (!reason.isEmpty())
- return reason;
- }
- }
- return format("unknown reason (%d)", responseCode);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
deleted file mode 100644
index 44de963..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponent.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static java.lang.String.format;
-import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
-import static io.github.taverna_extras.component.registry.standard.Policy.getPolicy;
-import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
-import static io.github.taverna_extras.component.utils.SystemUtils.getValue;
-
-import java.lang.ref.SoftReference;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.IllegalFormatException;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.registry.Component;
-import io.github.taverna_extras.component.registry.ComponentVersion;
-import io.github.taverna_extras.component.registry.api.ComponentType;
-import io.github.taverna_extras.component.registry.api.Description;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-class NewComponent extends Component {
- static final String ELEMENTS = "title,description";
- static final String EXTRA = "license-type,permissions";
-
- private final SystemUtils system;
- final NewComponentRegistry registry;
- final NewComponentFamily family;
- private final String id;
- private final String title;
- private final String description;
- private final String resource;
-
- NewComponent(NewComponentRegistry registry, NewComponentFamily family,
- Description cd, SystemUtils system) throws ComponentException {
- super(cd.getUri());
- this.system = system;
- this.registry = registry;
- this.family = family;
- id = cd.getId().trim();
- title = getElementString(cd, "title");
- description = getElementString(cd, "description");
- resource = cd.getResource();
- }
-
- NewComponent(NewComponentRegistry registry, NewComponentFamily family,
- ComponentType ct, SystemUtils system) {
- super(ct.getUri());
- this.system = system;
- this.registry = registry;
- this.family = family;
- id = ct.getId().trim();
- title = ct.getTitle().trim();
- description = ct.getDescription().trim();
- resource = ct.getResource();
- }
-
- public ComponentType getCurrent(String elements) throws ComponentException {
- return registry.getComponentById(id, null, elements);
- }
-
- @Override
- protected String internalGetName() {
- return title;
- }
-
- @Override
- protected String internalGetDescription() {
- return description;
- }
-
- @Override
- protected void populateComponentVersionMap() {
- try {
- for (Description d : getCurrent("versions").getVersions()
- .getWorkflow())
- versionMap.put(d.getVersion(), new Version(d.getVersion(),
- getValue(d)));
- } catch (ComponentException e) {
- logger.warn("failed to retrieve version list: " + e.getMessage());
- }
- }
-
- @Override
- protected Version internalAddVersionBasedOn(WorkflowBundle bundle,
- String revisionComment) throws ComponentException {
- /*
- * Only fetch the license and sharing policy now; user might have
- * updated them on the site and we want to duplicate.
- */
- ComponentType ct = getCurrent(EXTRA);
- License license = registry.getLicense(getValue(ct.getLicenseType())
- .trim());
- SharingPolicy sharingPolicy = getPolicy(ct.getPermissions());
-
- return (Version) registry.createComponentVersionFrom(this, title,
- revisionComment, bundle, license, sharingPolicy);
- }
-
- public String getId() {
- return id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof NewComponent) {
- NewComponent other = (NewComponent) o;
- return registry.equals(other.registry) && id.equals(other.id);
- }
- return false;
- }
-
- public String getResourceLocation() {
- return resource;
- }
-
- private static final int BASEHASH = NewComponent.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ registry.hashCode() ^ id.hashCode();
- }
-
- class Version extends ComponentVersion {
- private int version;
- private String description;
- private String location;
- private SoftReference<WorkflowBundle> bundleRef;
-
- private static final String htmlPageTemplate = "%1$s/workflows/%2$s/versions/%3$s.html";
-
- protected Version(Integer version, String description, WorkflowBundle bundle) {
- super(NewComponent.this);
- this.version = version;
- this.description = description;
- this.bundleRef = new SoftReference<>(bundle);
- }
-
- protected Version(Integer version, String description) {
- super(NewComponent.this);
- this.version = version;
- this.description = description;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Version) {
- Version other = (Version) o;
- return version == other.version
- && NewComponent.this.equals(other.getComponent());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return NewComponent.this.hashCode() ^ (version << 16)
- ^ (version >> 16);
- }
-
- @Override
- protected Integer internalGetVersionNumber() {
- return version;
- }
-
- @Override
- protected String internalGetDescription() {
- return description;
- }
-
- private String getLocationUri() throws ComponentException {
- if (location == null)
- location = registry.getComponentById(id, version,
- "content-uri").getContentUri();
- return location;
- }
-
- @Override
- protected synchronized WorkflowBundle internalGetImplementation()
- throws ComponentException {
- if (bundleRef == null || bundleRef.get() == null) {
- String contentUri = getLocationUri();
- try {
- WorkflowBundle result = system.getBundleFromUri(contentUri
- + "?version=" + version);
- bundleRef = new SoftReference<>(result);
- return result;
- } catch (Exception e) {
- throw new ComponentException("Unable to open dataflow", e);
- }
- }
- return bundleRef.get();
- }
-
- @Override
- public URL getHelpURL() {
- try {
- return new URL(format(htmlPageTemplate,
- registry.getRegistryBaseString(), getId(), version));
- } catch (IllegalFormatException | MalformedURLException e) {
- logger.error(e);
- return null;
- }
- }
- }
-
- @Override
- public Registry getRegistry() {
- return registry;
- }
-
- @Override
- public Family getFamily() {
- return family;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
deleted file mode 100644
index 1c16b1e..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentFamily.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
-
-import java.util.List;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.registry.ComponentFamily;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
-import io.github.taverna_extras.component.registry.api.Description;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * A family of components in the new-interface registry.
- *
- * @author Donal Fellows
- */
-class NewComponentFamily extends ComponentFamily {
- static final String ELEMENTS = "title,description";
-
- private final NewComponentRegistry registry;
- private final NewComponentProfile profile;
- private final String id;
- private final String name;
- private final String description;
- private final String uri;
- private final String resource;
-
- NewComponentFamily(NewComponentRegistry componentRegistry,
- NewComponentProfile profile, Description familyDesc,
- ComponentUtil util) throws ComponentException {
- super(componentRegistry, util);
- uri = familyDesc.getUri();
- registry = componentRegistry;
- this.profile = profile;
- id = familyDesc.getId().trim();
- name = getElementString(familyDesc, "title");
- description = getElementString(familyDesc, "description");
- resource = familyDesc.getResource();
- }
-
- public NewComponentFamily(NewComponentRegistry componentRegistry,
- NewComponentProfile profile, ComponentFamilyType cft,
- ComponentUtil util) {
- super(componentRegistry, util);
- uri = cft.getUri();
- registry = componentRegistry;
- this.profile = profile;
- id = cft.getId();
- name = cft.getTitle();
- description = cft.getDescription();
- resource = cft.getResource();
- }
-
- @Override
- protected String internalGetName() {
- return name;
- }
-
- @Override
- protected String internalGetDescription() {
- return description;
- }
-
- @Override
- protected Profile internalGetComponentProfile() throws ComponentException {
- return profile;
- }
-
- public List<Component> getMemberComponents() throws ComponentException {
- return registry.listComponents(this);
- }
-
- @Override
- protected void populateComponentCache() throws ComponentException {
- for (Component c : getMemberComponents()) {
- NewComponent component = (NewComponent) c;
- componentCache.put(component.getName(), component);
- }
- }
-
- @Override
- protected Version internalCreateComponentBasedOn(String componentName,
- String description, WorkflowBundle bundle) throws ComponentException {
- if (componentName == null)
- componentName = registry.annUtils.getTitle(bundle, "Untitled");
- if (description == null)
- componentName = registry.annUtils.getDescription(bundle,
- "Undescribed");
- return registry.createComponentFrom(this, componentName, description,
- bundle, registry.getPreferredLicense(),
- registry.getDefaultSharingPolicy());
- }
-
- @Override
- protected void internalRemoveComponent(Component component)
- throws ComponentException {
- registry.deleteComponent((NewComponent) component);
- }
-
- String getId() {
- return id;
- }
-
- public String getUri() {
- return uri;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof NewComponentFamily) {
- NewComponentFamily other = (NewComponentFamily) o;
- return registry.equals(other.registry) && id.equals(other.id);
- }
- return false;
- }
-
- private static final int BASEHASH = NewComponentFamily.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ registry.hashCode() ^ id.hashCode();
- }
-
- public String getResourceLocation() {
- return resource;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
deleted file mode 100644
index 5e08b4b..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentLicense.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.registry.api.LicenseType;
-
-class NewComponentLicense implements License {
- private NewComponentRegistry registry;
- private String id;
- private String title;
- private String description;
- private String abbreviation;
-
- static final String ELEMENTS = "title,description,unique-name";
-
- NewComponentLicense(NewComponentRegistry newComponentRegistry,
- LicenseType lt) {
- registry = newComponentRegistry;
- id = lt.getId();
- title = lt.getTitle();
- description = lt.getDescription();
- abbreviation = lt.getUniqueName();
- }
-
- String getId() {
- return id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof NewComponentLicense))
- return false;
- NewComponentLicense other = (NewComponentLicense) o;
- return registry.equals(other.registry) && id.equals(other.id);
- }
-
- private static final int BASEHASH = NewComponentLicense.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ registry.hashCode() ^ id.hashCode();
- }
-
- @Override
- public String getName() {
- return title;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getAbbreviation() {
- return abbreviation;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
deleted file mode 100644
index 372c853..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentProfile.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.profile.BaseProfileLocator;
-import io.github.taverna_extras.component.profile.ComponentProfileImpl;
-import io.github.taverna_extras.component.registry.api.ComponentProfileType;
-import io.github.taverna_extras.component.registry.api.Description;
-
-/**
- * Profiles managed by the new-interface component registry.
- *
- * @author Donal Fellows
- */
-class NewComponentProfile extends ComponentProfileImpl {
- private static final String LOCATION = "content-uri";
- static final String ELEMENTS = LOCATION;
-
- private final NewComponentRegistry registry;
- private String id;
- private String location;
- private String resource;
- private final String uri;
-
- private static URL contentUrl(ComponentProfileType cpt)
- throws ComponentException {
- try {
- return new URL(cpt.getContentUri());
- } catch (MalformedURLException e) {
- throw new ComponentException("bad profile location", e);
- }
- }
-
- private static URL getLocationURL(Description cpd) throws ComponentException {
- try {
- return new URL(getElementString(cpd, LOCATION));
- } catch (MalformedURLException e) {
- throw new ComponentException("bad profile location", e);
- }
- }
-
- NewComponentProfile(NewComponentRegistry registry,
- ComponentProfileType profile, BaseProfileLocator base)
- throws ComponentException {
- super(registry, contentUrl(profile), base);
- this.registry = registry;
- uri = profile.getUri();
- id = profile.getId();
- location = profile.getContentUri();
- resource = profile.getResource();
- }
-
- NewComponentProfile(NewComponentRegistry registry, Description cpd,
- BaseProfileLocator base) throws ComponentException {
- super(registry, getLocationURL(cpd), base);
- this.registry = registry;
- uri = cpd.getUri();
- id = cpd.getId();
- location = getElementString(cpd, LOCATION);
- resource = cpd.getResource();
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getID() {
- return id;
- }
-
- public String getUri() {
- return uri;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof NewComponentProfile) {
- NewComponentProfile other = (NewComponentProfile) o;
- return registry.equals(other.registry) && id.equals(other.id);
- }
- return false;
- }
-
- private static final int BASEHASH = NewComponentProfile.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ registry.hashCode() ^ id.hashCode();
- }
-
- @Override
- public String toString() {
- return "Remote Component Profile[" + location + "]";
- }
-
- public String getResourceLocation() {
- return resource;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
deleted file mode 100644
index 00a549e..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistry.java
+++ /dev/null
@@ -1,485 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.registry.standard.Policy.PRIVATE;
-import static io.github.taverna_extras.component.utils.SystemUtils.getElementString;
-
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.nio.charset.UnsupportedCharsetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.Version.ID;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.registry.ComponentRegistry;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
-import io.github.taverna_extras.component.registry.api.ComponentDescriptionList;
-import io.github.taverna_extras.component.registry.api.ComponentFamilyList;
-import io.github.taverna_extras.component.registry.api.ComponentFamilyType;
-import io.github.taverna_extras.component.registry.api.ComponentProfileList;
-import io.github.taverna_extras.component.registry.api.ComponentProfileType;
-import io.github.taverna_extras.component.registry.api.ComponentType;
-import io.github.taverna_extras.component.registry.api.Content;
-import io.github.taverna_extras.component.registry.api.Description;
-import io.github.taverna_extras.component.registry.api.LicenseList;
-import io.github.taverna_extras.component.registry.api.LicenseType;
-import io.github.taverna_extras.component.registry.api.ObjectFactory;
-import io.github.taverna_extras.component.registry.api.Permissions;
-import io.github.taverna_extras.component.registry.api.PolicyList;
-import io.github.taverna_extras.component.utils.AnnotationUtils;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-
-class NewComponentRegistry extends ComponentRegistry {
- private static final String PROFILE_MIME_TYPE = "application/vnd.taverna.component-profile+xml";
- private static final String T2FLOW_MIME_TYPE = "application/vnd.taverna.t2flow+xml";
- static final Logger logger = getLogger(NewComponentRegistry.class);
- static final JAXBContext jaxbContext;
- static final Charset utf8;
- private static final ObjectFactory objectFactory = new ObjectFactory();
-
- // service URIs
- private static final String COMPONENT_SERVICE = "/component.xml";
- private static final String COMPONENT_FAMILY_SERVICE = "/component-family.xml";
- private static final String COMPONENT_PROFILE_SERVICE = "/component-profile.xml";
- private static final String COMPONENT_LIST = "/components.xml";
- private static final String COMPONENT_FAMILY_LIST = "/component-families.xml";
- private static final String COMPONENT_PROFILE_LIST = "/component-profiles.xml";
- private static final String WORKFLOW_SERVICE = "/workflow.xml";
- private static final String PACK_SERVICE = "/pack.xml";
- private static final String FILE_SERVICE = "/file.xml";
- private static final String LICENSE_LIST = "/licenses.xml";
- private static final String POLICY_LIST = "/policies.xml";
-
- static {
- JAXBContext c = null;
- Charset cs = null;
- try {
- c = JAXBContext.newInstance(ComponentDescriptionList.class,
- ComponentFamilyList.class, ComponentProfileList.class,
- ComponentType.class, ComponentFamilyType.class,
- ComponentProfileType.class, PolicyList.class,
- LicenseList.class);
- cs = Charset.forName("UTF-8");
- } catch (JAXBException e) {
- throw new Error("failed to build context", e);
- } catch (UnsupportedCharsetException e) {
- throw new Error("failed to find charset", e);
- } finally {
- jaxbContext = c;
- utf8 = cs;
- }
- }
-
- Client client;
- private final CredentialManager cm;
- private final ComponentUtil util;
- private final SystemUtils system;
- final AnnotationUtils annUtils;
-
- protected NewComponentRegistry(CredentialManager cm, URL registryBase,
- ComponentUtil util, SystemUtils system, AnnotationUtils annUtils) throws ComponentException {
- super(registryBase);
- this.cm = cm;
- this.util = util;
- this.system = system;
- this.annUtils = annUtils;
- }
-
- private void checkClientCreated() throws ComponentException {
- try {
- if (client == null)
- client = new Client(jaxbContext, super.getRegistryBase(), cm);
- } catch (Exception e) {
- throw new ComponentException("Unable to access registry", e);
- }
- }
-
- private List<Description> listComponentFamilies(String profileUri)
- throws ComponentException {
- checkClientCreated();
- return client.get(ComponentFamilyList.class, COMPONENT_FAMILY_LIST,
- "component-profile=" + profileUri,
- "elements=" + NewComponentFamily.ELEMENTS).getPack();
- }
-
- ComponentType getComponentById(String id, Integer version, String elements)
- throws ComponentException {
- checkClientCreated();
-
- if (version != null) {
- return client.get(ComponentType.class, WORKFLOW_SERVICE,
- "id=" + id, "version=" + version, "elements=" + elements);
- }
- return client.get(ComponentType.class, WORKFLOW_SERVICE, "id=" + id,
- "elements=" + elements);
- }
-
- @SuppressWarnings("unused")
- private ComponentFamilyType getComponentFamilyById(String id,
- String elements) throws ComponentException {
- checkClientCreated();
-
- return client.get(ComponentFamilyType.class, PACK_SERVICE, "id=" + id,
- "elements=" + elements);
- }
-
- private ComponentProfileType getComponentProfileById(String id,
- String elements) throws ComponentException {
- checkClientCreated();
-
- return client.get(ComponentProfileType.class, FILE_SERVICE, "id=" + id,
- "elements=" + elements);
- }
-
- @Override
- protected void populateFamilyCache() throws ComponentException {
- for (Profile pr : getComponentProfiles()) {
- NewComponentProfile p = (NewComponentProfile) pr;
- for (Description cfd : listComponentFamilies(p
- .getResourceLocation()))
- familyCache.put(getElementString(cfd, "title"),
- new NewComponentFamily(this, p, cfd, util));
- }
- }
-
- @Override
- protected Family internalCreateComponentFamily(String familyName,
- Profile componentProfile, String description, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- NewComponentProfile profile = (NewComponentProfile) componentProfile;
-
- checkClientCreated();
-
- return new NewComponentFamily(this, profile, client.post(
- ComponentFamilyType.class,
- objectFactory.createPack(makeComponentFamilyCreateRequest(
- profile, familyName, description, license,
- sharingPolicy)), COMPONENT_FAMILY_SERVICE, "elements="
- + NewComponentFamily.ELEMENTS), util);
- }
-
- @Override
- protected void internalRemoveComponentFamily(Family componentFamily)
- throws ComponentException {
- NewComponentFamily ncf = (NewComponentFamily) componentFamily;
- checkClientCreated();
-
- client.delete(WORKFLOW_SERVICE, "id=" + ncf.getId());
- }
-
- @Override
- protected void populateProfileCache() throws ComponentException {
- checkClientCreated();
-
- for (Description cpd : client.get(ComponentProfileList.class,
- COMPONENT_PROFILE_LIST,
- "elements=" + NewComponentProfile.ELEMENTS).getFile())
- if (cpd.getUri() != null && !cpd.getUri().isEmpty())
- profileCache.add(new NewComponentProfile(this, cpd, util
- .getBaseProfileLocator()));
- }
-
- @Override
- protected Profile internalAddComponentProfile(Profile componentProfile,
- License license, SharingPolicy sharingPolicy)
- throws ComponentException {
- if (componentProfile == null)
- throw new ComponentException("component profile must not be null");
- try {
- if (componentProfile instanceof NewComponentProfile) {
- NewComponentProfile profile = (NewComponentProfile) componentProfile;
- if (profile.getComponentRegistry().equals(this))
- return new NewComponentProfile(this,
- getComponentProfileById(profile.getId(),
- NewComponentProfile.ELEMENTS),
- util.getBaseProfileLocator());
- }
- } catch (ComponentException e) {
- // Do nothing but fall through
- }
- checkClientCreated();
-
- return new NewComponentProfile(this, client.post(
- ComponentProfileType.class, objectFactory
- .createFile(makeComponentProfileCreateRequest(
- componentProfile.getName(),
- componentProfile.getDescription(),
- componentProfile.getXML(), license,
- sharingPolicy)), COMPONENT_PROFILE_SERVICE,
- "elements=" + NewComponentProfile.ELEMENTS),
- util.getBaseProfileLocator());
- }
-
- public Permissions getPermissions(SharingPolicy userSharingPolicy) {
- if (userSharingPolicy == null)
- userSharingPolicy = getDefaultSharingPolicy();
- return ((Policy) userSharingPolicy).getPermissionsElement();
- }
-
- private ComponentProfileType makeComponentProfileCreateRequest(
- String title, String description, String content, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- ComponentProfileType profile = new ComponentProfileType();
-
- profile.setFilename(title + ".xml");
- profile.setTitle(title);
- profile.setTitle(description);
- profile.setContentType(PROFILE_MIME_TYPE);
- profile.setContent(new Content());
- profile.getContent().setEncoding("base64");
- profile.getContent().setType("binary");
- profile.getContent().setValue(content.getBytes(utf8));
- if (license == null)
- license = getPreferredLicense();
- profile.setLicenseType(new Description());
- profile.getLicenseType().getContent().add(license.getAbbreviation());
- profile.setPermissions(getPermissions(sharingPolicy));
-
- return profile;
- }
-
- private ComponentFamilyType makeComponentFamilyCreateRequest(
- NewComponentProfile profile, String familyName, String description,
- License license, SharingPolicy sharingPolicy)
- throws ComponentException {
- ComponentFamilyType familyDoc = new ComponentFamilyType();
-
- familyDoc.setComponentProfile(profile.getResourceLocation());
- familyDoc.setDescription(description);
- familyDoc.setTitle(familyName);
- if (license == null)
- license = getPreferredLicense();
- familyDoc.setLicenseType(new Description());
- familyDoc.getLicenseType().getContent().add(license.getAbbreviation());
- familyDoc.setPermissions(getPermissions(sharingPolicy));
-
- return familyDoc;
- }
-
- private ComponentType makeComponentVersionCreateRequest(String title,
- String description, WorkflowBundle content, NewComponentFamily family,
- License license, SharingPolicy sharingPolicy)
- throws ComponentException {
- ComponentType comp = new ComponentType();
-
- comp.setTitle(title);
- comp.setDescription(description);
- if (family != null)
- comp.setComponentFamily(family.getResourceLocation());
- comp.setContentType(T2FLOW_MIME_TYPE);
- comp.setContent(new Content());
- comp.getContent().setEncoding("base64");
- comp.getContent().setType("binary");
- comp.getContent().setValue(system.serializeBundle(content));
- if (license == null)
- license = getPreferredLicense();
- if (license != null) {
- comp.setLicenseType(new Description());
- comp.getLicenseType().getContent().add(license.getAbbreviation());
- }
- comp.setPermissions(getPermissions(sharingPolicy));
-
- return comp;
- }
-
- private static final boolean DO_LIST_POLICIES = false;
-
- private List<Description> listPolicies() throws ComponentException {
- checkClientCreated();
- return client.get(PolicyList.class, POLICY_LIST, "type=group")
- .getPolicy();
- }
-
- @Override
- protected void populatePermissionCache() {
- permissionCache.add(Policy.PUBLIC);
- permissionCache.add(Policy.PRIVATE);
- try {
- if (DO_LIST_POLICIES)
- for (Description d : listPolicies())
- permissionCache.add(new Policy.Group(d.getId()));
- } catch (ComponentException e) {
- logger.warn("failed to fetch sharing policies", e);
- }
- }
-
- private List<LicenseType> listLicenses() throws ComponentException {
- checkClientCreated();
-
- return client.get(LicenseList.class, LICENSE_LIST,
- "elements=" + NewComponentLicense.ELEMENTS).getLicense();
- }
-
- @Override
- protected void populateLicenseCache() {
- try {
- for (LicenseType lt : listLicenses())
- licenseCache.add(new NewComponentLicense(this, lt));
- } catch (ComponentException e) {
- logger.warn("failed to fetch licenses", e);
- }
- }
-
- @Override
- public License getPreferredLicense() throws ComponentException {
- return getLicenseByAbbreviation(getNameOfPreferredLicense());
- }
-
- public String getNameOfPreferredLicense() {
- return "by-nd";
- }
-
- public SharingPolicy getDefaultSharingPolicy() {
- return PRIVATE;
- }
-
- private List<Description> listComponents(String query, String prefixes)
- throws ComponentException {
- checkClientCreated();
-
- return client.get(ComponentDescriptionList.class, COMPONENT_LIST,
- "query=" + query, "prefixes=" + prefixes,
- "elements=" + NewComponent.ELEMENTS).getWorkflow();
- }
-
- @Override
- public Set<ID> searchForComponents(String prefixes, String text)
- throws ComponentException {
- HashSet<ID> versions = new HashSet<>();
- for (Description cd : listComponents(text, prefixes)) {
- NewComponent nc = null;
- for (Family f : getComponentFamilies()) {
- nc = (NewComponent) ((NewComponentFamily) f)
- .getComponent(getElementString(cd, "title"));
- if (nc != null)
- break;
- }
- if (nc != null)
- versions.add(new ComponentVersionIdentification(
- getRegistryBase(), nc.getFamily().getName(), nc
- .getName(), cd.getVersion()));
- else
- logger.warn("could not construct component for " + cd.getUri());
- }
- return versions;
- }
-
- private List<Description> listComponents(String familyUri)
- throws ComponentException {
- checkClientCreated();
-
- return client.get(ComponentDescriptionList.class, COMPONENT_LIST,
- "component-family=" + familyUri,
- "elements=" + NewComponent.ELEMENTS).getWorkflow();
- }
-
- protected List<Component> listComponents(NewComponentFamily family)
- throws ComponentException {
- List<Component> result = new ArrayList<>();
- for (Description cd : listComponents(family.getResourceLocation()))
- result.add(new NewComponent(this, family, cd, system));
- return result;
- }
-
- protected void deleteComponent(NewComponent component)
- throws ComponentException {
- checkClientCreated();
-
- client.delete(WORKFLOW_SERVICE, "id=" + component.getId());
- }
-
- protected Version createComponentFrom(NewComponentFamily family,
- String componentName, String description,
- WorkflowBundle implementation, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- checkClientCreated();
-
- ComponentType ct = client.post(ComponentType.class, objectFactory
- .createWorkflow(makeComponentVersionCreateRequest(
- componentName, description, implementation, family,
- license, sharingPolicy)), COMPONENT_SERVICE,
- "elements=" + NewComponent.ELEMENTS);
- NewComponent nc = new NewComponent(this, family, ct, system);
- return nc.new Version(ct.getVersion(), description, implementation);
- }
-
- protected Version createComponentVersionFrom(NewComponent component,
- String componentName, String description,
- WorkflowBundle implementation, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- checkClientCreated();
-
- ComponentType ct = client.post(ComponentType.class, objectFactory
- .createWorkflow(makeComponentVersionCreateRequest(
- componentName, description, implementation,
- component.family, license, sharingPolicy)),
- COMPONENT_SERVICE, "id=" + component.getId(), "elements="
- + NewComponent.ELEMENTS);
- return component.new Version(ct.getVersion(), description,
- implementation);
- }
-
- public License getLicense(String name) throws ComponentException {
- for (License l : getLicenses())
- if (l.getAbbreviation().equals(name))
- return l;
- return null;
- }
-
- @Override
- public boolean equals(Object o) {
- // Careful! Java's URL equality IS BROKEN!
- if (o != null && o instanceof NewComponentRegistry) {
- NewComponentRegistry other = (NewComponentRegistry) o;
- return getRegistryBaseString()
- .equals(other.getRegistryBaseString());
- }
- return false;
- }
-
- private static final int BASEHASH = NewComponentRegistry.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ getRegistryBaseString().hashCode();
- }
-
- @Override
- public String getRegistryTypeName() {
- return "Component API";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
deleted file mode 100644
index 43dc37d..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/NewComponentRegistryFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.jaxbContext;
-import static io.github.taverna_extras.component.registry.standard.NewComponentRegistry.logger;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.registry.ComponentRegistry;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.AnnotationUtils;
-import io.github.taverna_extras.component.utils.SystemUtils;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.springframework.beans.factory.annotation.Required;
-
-public class NewComponentRegistryFactory {
- private final Map<String, NewComponentRegistry> componentRegistries = new HashMap<>();
- private CredentialManager cm;
- private ComponentUtil util;
- private SystemUtils system;
- private AnnotationUtils annUtils;
-
- @Required
- public void setCredentialManager(CredentialManager cm) {
- this.cm = cm;
- }
-
- @Required
- public void setComponentUtil(ComponentUtil util) {
- this.util = util;
- }
-
- @Required
- public void setSystemUtils(SystemUtils system) {
- this.system = system;
- }
-
- @Required
- public void setAnnotationUtils(AnnotationUtils annUtils) {
- this.annUtils = annUtils;
- }
-
- public synchronized ComponentRegistry getComponentRegistry(URL registryBase)
- throws ComponentException {
- if (!componentRegistries.containsKey(registryBase.toExternalForm())) {
- logger.debug("constructing registry instance for " + registryBase);
- componentRegistries.put(registryBase.toExternalForm(),
- new NewComponentRegistry(cm, registryBase, util, system,
- annUtils));
- }
- return componentRegistries.get(registryBase.toExternalForm());
- }
-
- public boolean verifyBase(URL registryBase) {
- try {
- return new Client(jaxbContext, registryBase, false, cm).verify();
- } catch (Exception e) {
- logger.info("failed to construct connection client to "
- + registryBase, e);
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
deleted file mode 100644
index 3b521af..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/Policy.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-
-import static java.lang.System.identityHashCode;
-import static io.github.taverna_extras.component.registry.api.Privilege.DOWNLOAD;
-import static io.github.taverna_extras.component.registry.api.Privilege.VIEW;
-
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.registry.api.Permissions;
-import io.github.taverna_extras.component.registry.api.Permissions.Permission;
-
-abstract class Policy implements SharingPolicy {
- public static final SharingPolicy PUBLIC = new Public();
- public static final SharingPolicy PRIVATE = new Private();
-
- Policy() {
- }
-
- public abstract Permissions getPermissionsElement();
-
- public static SharingPolicy getPolicy(Permissions perm) {
- if (perm == null)
- return PRIVATE;
- if (perm.getGroupPolicyId() != null)
- return new Group(perm.getGroupPolicyId());
- for (Permission p : perm.getPermission())
- if (p.getId() != null)
- return new Group(p.getId().toString(), perm);
- return PUBLIC;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || !(o instanceof Policy))
- return false;
- return equals((Policy) o);
- }
-
- @Override
- public abstract int hashCode();
-
- protected abstract boolean equals(Policy p);
-
- static class Public extends Policy {
- @Override
- public String getName() {
- return "Public";
- }
-
- @Override
- public Permissions getPermissionsElement() {
- Permission.Privilege privView = new Permission.Privilege();
- privView.setType(VIEW);
- Permission.Privilege privDownload = new Permission.Privilege();
- privDownload.setType(DOWNLOAD);
- Permission perm = new Permission();
- perm.setCategory("public");
- perm.getPrivilege().add(privView);
- perm.getPrivilege().add(privDownload);
- Permissions result = new Permissions();
- result.getPermission().add(perm);
- return result;
- }
-
- @Override
- protected boolean equals(Policy p) {
- return p instanceof Public;
- }
-
- @Override
- public int hashCode() {
- return identityHashCode(PUBLIC);
- }
- }
-
- static class Private extends Policy {
- @Override
- public String getName() {
- return "Private";
- }
-
- @Override
- public Permissions getPermissionsElement() {
- return null;
- }
-
- @Override
- protected boolean equals(Policy p) {
- return p instanceof Private;
- }
-
- @Override
- public int hashCode() {
- return identityHashCode(PRIVATE);
- }
- }
-
- static class Group extends Policy {
- private String id;
- private Permissions p;
-
- public Group(String id) {
- this.id = id;
- }
-
- public Group(String id, Permissions p) {
- this.id = id;
- this.p = p;
- }
-
- @Override
- public String getName() {
- return "Group(" + id + ")";
- }
-
- @Override
- public Permissions getPermissionsElement() {
- if (p != null)
- return p;
- Permissions result = new Permissions();
- result.setGroupPolicyId(id);
- return result;
- }
-
- @Override
- protected boolean equals(Policy p) {
- return (p instanceof Group) && id.equals(((Group) p).id);
- }
-
- private static final int BASEHASH = Group.class.hashCode();
-
- @Override
- public int hashCode() {
- return BASEHASH ^ id.hashCode();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
deleted file mode 100644
index e6a709b..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/Unused.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.taverna_extras.component.registry.standard.annotations;
-/*
- * 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.
- */
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.CLASS;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Marks a constructor, field, method or parameter as unused. Unused members
- * exist for the purpose of documentation or completeness.
- *
- * @author Donal Fellows
- */
-@Documented
-@Target({ CONSTRUCTOR, FIELD, METHOD, PARAMETER, TYPE })
-@Retention(CLASS)
-public @interface Unused {
-
-}
[08/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
deleted file mode 100644
index f5328cc..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-import java.util.List;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public abstract class ComponentRegistryTest extends Harness {
- private Profile componentProfile;
-
- @Before
- public void setup() throws Exception {
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- componentProfile = util.getProfile(componentProfileUrl);
- }
-
- @After
- public void tearDown() throws Exception {
- for (Family componentFamily : componentRegistry.getComponentFamilies()) {
- componentRegistry.removeComponentFamily(componentFamily);
- }
- }
-
- @Test
- public void testGetComponentFamilies() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertTrue(componentRegistry.getComponentFamilies().contains(
- componentFamily));
- componentRegistry.removeComponentFamily(componentFamily);
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- }
-
- @Test
- public void testGetComponentFamily() throws Exception {
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- componentRegistry.removeComponentFamily(componentFamily);
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test
- public void testCreateComponentFamily() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals("TestComponentFamily", componentFamily.getName());
- assertEquals(componentRegistry, componentFamily.getComponentRegistry());
- assertEquals(0, componentFamily.getComponents().size());
- // assertEquals(componentProfile,
- // componentFamily.getComponentProfile());
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyDuplicate() throws Exception {
- componentRegistry.createComponentFamily("TestComponentFamily",
- componentProfile, "Some description", null, null);
- componentRegistry.createComponentFamily("TestComponentFamily",
- componentProfile, "Some description", null, null);
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyNullProfile() throws Exception {
- componentRegistry.createComponentFamily("TestComponentFamily", null,
- "Some description", null, null);
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyNullName() throws Exception {
- componentRegistry.createComponentFamily(null, componentProfile,
- "Some description", null, null);
- }
-
- @Test
- public void testRemoveComponentFamily() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- componentRegistry.removeComponentFamily(componentFamily);
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test
- public void testGetResistryBase() throws Exception {
- assertEquals(componentRegistryUrl, componentRegistry.getRegistryBase());
- }
-
- @Test
- public void testGetComponentProfiles() throws Exception {
- assertNotNull(componentRegistry.getComponentProfiles());
- }
-
- @Test
- public void testAddComponentProfile() throws Exception {
- List<Profile> componentProfiles = componentRegistry
- .getComponentProfiles();
- boolean contained = false;
- for (Profile p : componentProfiles) {
- if (p.getId().equals(componentProfile.getId())) {
- contained = true;
- }
- }
- assertFalse(contained);
- int componentProfileCount = componentProfiles.size();
- componentRegistry.addComponentProfile(componentProfile, null, null);
- int newSize = componentRegistry.getComponentProfiles().size();
- assertEquals(componentProfileCount + 1, newSize);
- }
-
- @Test(expected = ComponentException.class)
- public void testAddComponentProfileNullProfile() throws Exception {
- componentRegistry.addComponentProfile(null, null, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
deleted file mode 100644
index 0ced0c8..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentTest extends Harness {
- private Family componentFamily;
- private Component component;
- private WorkflowBundle bundle;
-
- @Before
- public void setUp() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- Profile componentProfile = util
- .getProfile(componentProfileUrl);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- component = componentFamily.createComponentBasedOn("Test Component",
- "Some description", bundle).getComponent();
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetName() throws Exception {
- assertEquals("Test Component", component.getName());
- assertEquals("Test Component", component.getName());
- }
-
- @Test
- public void testGetComponentVersionMap() throws Exception {
- assertNotNull(component.getComponentVersionMap());
- assertEquals(1, component.getComponentVersionMap().size());
- assertEquals(component, component.getComponentVersionMap().get(1)
- .getComponent());
- }
-
- @Test
- public void testGetComponentVersion() throws Exception {
- assertNotNull(component.getComponentVersion(1));
- assertNull(component.getComponentVersion(2));
- }
-
- @Test
- public void testAddVersionBasedOn() throws Exception {
- assertNotNull(component.getComponentVersion(1));
- assertNull(component.getComponentVersion(2));
- Version componentVersion = component.addVersionBasedOn(bundle,
- "Some description");
- assertNotNull(componentVersion);
- assertEquals(component, componentVersion.getComponent());
- assertEquals(2, componentVersion.getVersionNumber().intValue());
- assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
- .getIdentifier());
- }
-
- @Test
- public void testGetComponentURL() throws Exception {
- assertNotNull(component.getComponentURL());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
deleted file mode 100644
index 48b320b..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentVersionTest extends Harness {
- private Family componentFamily;
- private WorkflowBundle bundle;
- private Version componentVersion;
-
- @Before
- public void setUp() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- Profile componentProfile = util.getProfile(componentProfileUrl);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetVersionNumber() throws Exception {
- assertNotNull(componentVersion.getVersionNumber());
- assertEquals(componentVersion.getVersionNumber(),
- componentVersion.getVersionNumber());
- }
-
- @Test
- public void testGetDescription() throws Exception {
- assertNotNull(componentVersion.getDescription());
- }
-
- @Test
- public void testGetDataflow() throws Exception {
- assertNotNull(componentVersion.getImplementation());
- assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
- .getIdentifier());
- }
-
- @Test
- public void testGetComponent() throws Exception {
- assertNotNull(componentVersion.getComponent());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
deleted file mode 100644
index 663704c..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-
-public class Harness {
- public static URL componentRegistryUrl;
- public static Registry componentRegistry;
- public static ComponentUtil util;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
deleted file mode 100644
index b5791e8..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentFamilyTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentFamilyTest extends ComponentFamilyTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
deleted file mode 100644
index 2a57e1c..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertSame;
-
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.registry.ComponentRegistryTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentRegistryTest extends ComponentRegistryTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- Registry getAgain = RegistrySupport.factory
- .getComponentRegistry(componentRegistryUrl);
- assertSame(componentRegistry, getAgain);
- }
-
- @Test
- @Ignore("broken")
- @Override
- public void testAddComponentProfile() throws Exception {
- super.testAddComponentProfile();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
deleted file mode 100644
index f82e591..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentTest extends ComponentTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
deleted file mode 100644
index f08425e..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentVersionTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentVersionTest extends ComponentVersionTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
deleted file mode 100644
index cac3eff..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import static java.lang.System.getProperty;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
-import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
-
-import java.io.File;
-
-import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
-
-class RegistrySupport {
- private static File testRegistry;
- final static LocalComponentRegistryFactory factory = new LocalComponentRegistryFactory();
-
- public static void pre() throws Exception {
- testRegistry = new File(getProperty("java.io.tmpdir"), "TestRegistry");
- testRegistry.mkdir();
- componentRegistryUrl = testRegistry.toURI().toURL();
- componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
- }
-
- public static void post() throws Exception {
- deleteDirectory(testRegistry);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
deleted file mode 100644
index bb06af5..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentFamilyTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentFamilyTest extends ComponentFamilyTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
deleted file mode 100644
index 86417d5..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.registry.ComponentRegistryTest;
-import io.github.taverna_extras.component.registry.standard.NewComponent;
-import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
-import io.github.taverna_extras.component.registry.standard.Policy;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore("affects remote service")
-public class NewComponentRegistryTest extends ComponentRegistryTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- assertSame(componentRegistry,
- RegistrySupport.factory.getComponentRegistry(componentRegistryUrl));
- }
-
- @Test
- public void testUploadWorkflow() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- WorkflowBundle bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
-
- NewComponentRegistry registry = (NewComponentRegistry) RegistrySupport.factory.getComponentRegistry(componentRegistryUrl);
- Version v = registry.createComponentFrom(null, "Test Workflow",
- "test description", bundle, null, Policy.PRIVATE);
- assertEquals("test description", v.getDescription());
- registry.deleteComponent((NewComponent) v.getComponent());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
deleted file mode 100644
index 2281cb0..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentTest extends ComponentTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
deleted file mode 100644
index cad04eb..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.registry.ComponentVersionTest;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentVersionTest extends ComponentVersionTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
deleted file mode 100644
index a1d0fef..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.taverna_extras.component.registry.standard;
-/*
- * 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.
- */
-
-import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
-import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.registry.standard.NewComponent;
-import io.github.taverna_extras.component.registry.standard.NewComponentFamily;
-import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
-import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
-
-class RegistrySupport {
- static final String DEPLOYMENT = "http://aeon.cs.man.ac.uk:3006";
- static final NewComponentRegistryFactory factory = new NewComponentRegistryFactory();// FIXME
-
- public static void pre() throws Exception {
- componentRegistryUrl = new URL(DEPLOYMENT);
- componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
- }
-
- public static void post() throws Exception {
- NewComponentRegistry registry = (NewComponentRegistry) factory
- .getComponentRegistry(componentRegistryUrl);
- for (Profile p : registry.getComponentProfiles())
- registry.client.delete("/file.xml", "id=" + p.getId());
- for (Family f : registry.getComponentFamilies()) {
- for (Component c : f.getComponents())
- registry.deleteComponent((NewComponent) c);
- registry.client.delete("/pack.xml", "id="
- + ((NewComponentFamily) f).getId());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Component.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Component.java
new file mode 100644
index 0000000..e014fb9
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Component.java
@@ -0,0 +1,89 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+import java.net.URL;
+import java.util.SortedMap;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * The abstract interface supported by a component.
+ *
+ * @author Donal Fellows
+ * @author David Withers
+ */
+public interface Component extends NamedItem {
+ /**
+ * @return the name of the Component.
+ */
+ @Override
+ String getName();
+
+ /**
+ * Returns the URL for the Component.
+ *
+ * @return the URL for the Component.
+ */
+ URL getComponentURL();
+
+ /**
+ * Creates a new version of this Component.
+ *
+ * @param bundle
+ * the workflow that the new ComponentVersion will use.
+ * @return a new version of this Component.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ Version addVersionBasedOn(WorkflowBundle bundle, String revisionComment)
+ throws ComponentException;
+
+ /**
+ * Returns the ComponentVersion that has the specified version number.
+ *
+ * @param version
+ * the version number of the ComponentVersion to return.
+ * @return the ComponentVersion that has the specified version number.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ Version getComponentVersion(Integer version) throws ComponentException;
+
+ /**
+ * @return the description of the Component.
+ */
+ @Override
+ String getDescription();
+
+ /**
+ * Returns a SortedMap of version number to ComponentVersion.
+ * <p>
+ * The returned map is sorted increasing numeric order.
+ *
+ * @return a SortedMap of version number to ComponentVersion.
+ */
+ SortedMap<Integer, Version> getComponentVersionMap();
+
+ Registry getRegistry();
+
+ Family getFamily();
+
+ void delete() throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentException.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentException.java
new file mode 100644
index 0000000..044903e
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentException.java
@@ -0,0 +1,48 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+/**
+ * Thrown when there is a problem interacting with a ComponentRegistry.
+ *
+ * @author David Withers
+ */
+public class ComponentException extends Exception {
+ private static final long serialVersionUID = -5222074350812438467L;
+
+ public ComponentException() {
+ super();
+ }
+
+ public ComponentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ComponentException(String message) {
+ super(message);
+ }
+
+ public ComponentException(Throwable cause) {
+ super(cause);
+ }
+
+ public ComponentException(String messageTemplate, Object...parameters) {
+ super(String.format(messageTemplate, parameters));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentFactory.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentFactory.java
new file mode 100644
index 0000000..5b69b61
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/ComponentFactory.java
@@ -0,0 +1,45 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.profile.Profile;
+
+public interface ComponentFactory {
+ public Registry getRegistry(URL registryBase) throws ComponentException;
+
+ public Family getFamily(URL registryBase, String familyName)
+ throws ComponentException;
+
+ public Component getComponent(URL registryBase, String familyName,
+ String componentName) throws ComponentException;
+
+ public Version getVersion(URL registryBase, String familyName,
+ String componentName, Integer componentVersion)
+ throws ComponentException;
+
+ public Version getVersion(Version.ID ident) throws ComponentException;
+
+ public Component getComponent(Version.ID ident) throws ComponentException;
+
+ public Profile getProfile(URL url) throws ComponentException;
+
+ public Profile getBaseProfile() throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Family.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Family.java
new file mode 100644
index 0000000..ca4ec54
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Family.java
@@ -0,0 +1,117 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+import java.util.List;
+
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public interface Family extends NamedItem {
+ /**
+ * Creates a new Component and adds it to this ComponentFamily.
+ *
+ * @param componentName
+ * the name of the Component to create. Must not be null.
+ * @param bundle
+ * the workflow for the Component. Must not be null.
+ * @return the new Component.
+ * @throws ComponentException
+ * <ul>
+ * <li>if componentName is null,
+ * <li>if dataflow is null,
+ * <li>if a Component with this name already exists,
+ * <li>if there is a problem accessing the ComponentRegistry.
+ * </ul>
+ */
+ Version createComponentBasedOn(String componentName, String description,
+ WorkflowBundle bundle) throws ComponentException;
+
+ /**
+ * Returns the Component with the specified name.
+ * <p>
+ * If this ComponentFamily does not contain a Component with the specified
+ * name <code>null</code> is returned.
+ *
+ * @param componentName
+ * the name of the Component to return. Must not be null.
+ * @return the Component with the specified name.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ Component getComponent(String componentName) throws ComponentException;
+
+ /**
+ * Removes the specified Component from this ComponentFamily.
+ * <p>
+ * If this ComponentFamily does not contain the Component this method has no
+ * effect.
+ *
+ * @param component
+ * the Component to remove.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ void removeComponent(Component component) throws ComponentException;
+
+ /**
+ * Returns all the Components in this ComponentFamily.
+ * <p>
+ * If this ComponentFamily does not contain any Components an empty list is
+ * returned.
+ *
+ * @return all the Components in this ComponentFamilies.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ List<Component> getComponents() throws ComponentException;
+
+ /**
+ * Returns the ComponentProfile for this ComponentFamily.
+ *
+ * @return the ComponentProfile for this ComponentFamily.
+ * @throws ComponentException
+ */
+ Profile getComponentProfile() throws ComponentException;
+
+ /**
+ * Returns the ComponentRegistry that contains this ComponentFamily.
+ *
+ * @return the ComponentRegistry that contains this ComponentFamily.
+ */
+ Registry getComponentRegistry();
+
+ /**
+ * @return the name of the component Family.
+ */
+ @Override
+ String getName();
+
+ /**
+ * @return the description of the component Family.
+ */
+ @Override
+ String getDescription();
+
+ /**
+ * Delete this family from its registry.
+ * @throws ComponentException
+ */
+ void delete() throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/License.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/License.java
new file mode 100644
index 0000000..2906288
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/License.java
@@ -0,0 +1,23 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+public interface License extends NamedItem {
+ public String getAbbreviation();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/NamedItem.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/NamedItem.java
new file mode 100644
index 0000000..775e515
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/NamedItem.java
@@ -0,0 +1,26 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+public interface NamedItem {
+ /** Name this entity. */
+ public String getName();
+ /** Describe this entity. */
+ public String getDescription();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Registry.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Registry.java
new file mode 100644
index 0000000..e6d1e23
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Registry.java
@@ -0,0 +1,158 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import io.github.taverna_extras.component.api.profile.Profile;
+
+public interface Registry {
+
+ License getPreferredLicense() throws ComponentException;
+
+ Set<Version.ID> searchForComponents(String prefixString, String text)
+ throws ComponentException;
+
+ /**
+ * Returns all the ComponentFamilies in this ComponetRegistry.
+ * <p>
+ * If this ComponentRegistry does not contain any ComponentFamilies an empty
+ * list is returned.
+ *
+ * @return all the ComponentFamilies in this ComponetRegistry.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ List<Family> getComponentFamilies() throws ComponentException;
+
+ List<License> getLicenses() throws ComponentException;
+
+ List<SharingPolicy> getPermissions() throws ComponentException;
+
+ /**
+ * Adds a ComponentProfile to this ComponentRegistry.
+ *
+ * @param componentProfile
+ * the ComponentProfile to add. Must not be null.
+ * @param sharingPolicy
+ * @param license
+ * @return the ComponentProfile added to this ComponentRegistry.
+ * @throws ComponentException
+ * <ul>
+ * <li>if componentProfile is null,
+ * <li>if there is a problem accessing the ComponentRegistry.
+ * </ul>
+ */
+ Profile addComponentProfile(Profile componentProfile, License license,
+ SharingPolicy sharingPolicy) throws ComponentException;
+
+ /**
+ * Returns all the ComponentProfiles in this ComponetRegistry.
+ * <p>
+ * If this ComponentRegistry does not contain any ComponentProfiles an empty
+ * list is returned.
+ *
+ * @return all the ComponentProfiles in this ComponetRegistry.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ List<Profile> getComponentProfiles() throws ComponentException;
+
+ /**
+ * Returns the ComponentProfile with the given ID in this ComponetRegistry.
+ * <p>
+ * If this ComponentRegistry does not contain the ComponentProfile, a
+ * <tt>null</tt> is returned.
+ *
+ * @return the matching ComponentProfile in this ComponetRegistry, or
+ * <tt>null</tt> if there is no such thing.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ Profile getComponentProfile(String id) throws ComponentException;
+
+ String getRegistryBaseString();
+
+ /**
+ * Returns the location of this ComponentRepository.
+ *
+ * @return the location of this ComponentRepository
+ */
+ URL getRegistryBase();
+
+ /**
+ * Removes a the ComponentFamily with the specified name from this
+ * ComponentRegistry.
+ * <p>
+ * If this ComponentRegistry does not contain a ComponentFamily with the
+ * specified name this method has no effect.
+ *
+ * @param componentFamily
+ * the ComponentFamily to remove.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ void removeComponentFamily(Family componentFamily) throws ComponentException;
+
+ /**
+ * Creates a new ComponentFamily and adds it to this ComponentRegistry.
+ *
+ * @param familyName
+ * the name of the ComponentFamily to create. Must not be null.
+ * @param componentProfile
+ * the ComponentProfile for the new ComponentFamily. Must not be
+ * null.
+ * @param sharingPolicy
+ * the SharingPolicy to use for the new ComponentFamily.
+ * @return the new ComponentFamily
+ * @throws ComponentException
+ * <ul>
+ * <li>if familyName is null,
+ * <li>if componentProfile is null,
+ * <li>if a ComponentFamily with this name already exists,
+ * <li>if there is a problem accessing the ComponentRegistry.
+ * </ul>
+ */
+ Family createComponentFamily(String familyName, Profile componentProfile,
+ String description, License license, SharingPolicy sharingPolicy)
+ throws ComponentException;
+
+ /**
+ * Returns the ComponentFamily with the specified name.
+ * <p>
+ * If this ComponentRegistry does not contain a ComponentFamily with the
+ * specified name <code>null</code> is returned.
+ *
+ * @param familyName
+ * the name of the ComponentFamily to return. Must not be null.
+ * @return the ComponentFamily with the specified name in this
+ * ComponentRepository or null if none exists.
+ * @throws ComponentException
+ * if there is a problem accessing the ComponentRegistry.
+ */
+ Family getComponentFamily(String familyName) throws ComponentException;
+
+ /**
+ * @return A description of the type of registry this is.
+ */
+ String getRegistryTypeName();
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/SharingPolicy.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/SharingPolicy.java
new file mode 100644
index 0000000..9965339
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/SharingPolicy.java
@@ -0,0 +1,32 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+/**
+ * @author alanrw
+ *
+ */
+public interface SharingPolicy {
+
+ /**
+ * @return The user-relevant name of the permission
+ */
+ public abstract String getName();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Version.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Version.java
new file mode 100644
index 0000000..2929ed0
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/Version.java
@@ -0,0 +1,224 @@
+package io.github.taverna_extras.component.api;
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public interface Version {
+ /** @return The version number of this version */
+ Integer getVersionNumber();
+
+ /** @return The description of this version */
+ String getDescription();
+
+ /** @return The implementation for this version */
+ WorkflowBundle getImplementation() throws ComponentException;
+
+ /** @return The component of which this is a version */
+ Component getComponent();
+
+ /** @return The identification token for this version */
+ ID getID();
+
+ URL getHelpURL();
+
+ interface ID extends Serializable {
+ /** @return The name of the family of the component to which we refer to */
+ String getFamilyName();
+
+ /** @return The base URL of the registry containing the component */
+ URL getRegistryBase();
+
+ /**
+ * @return The name of the component referred to, unique within its
+ * family
+ */
+ String getComponentName();
+
+ /**
+ * @return The version number of the version of the component referred
+ * to
+ */
+ Integer getComponentVersion();
+
+ /**
+ * Tests whether this ID is equal to the given one, <i>excluding</i> the
+ * version.
+ *
+ * @param id
+ * The ID to compare to.
+ * @return A boolean
+ */
+ boolean mostlyEqualTo(ID id);
+
+ /**
+ * Tests whether this ID is equal to the given component,
+ * <i>excluding</i> the version.
+ *
+ * @param component
+ * The component to compare to.
+ * @return A boolean
+ */
+ boolean mostlyEqualTo(Component component);
+ }
+
+ class Identifier implements ID {
+ private static final long serialVersionUID = 1139928258250264997L;
+
+ private final URL registryBase;
+ private final String familyName;
+ private final String componentName;
+ private final Integer componentVersion;
+
+ public Identifier(URL registryBase, String familyName,
+ String componentName, Integer componentVersion) {
+ super();
+ this.registryBase = registryBase;
+ this.familyName = familyName;
+ this.componentName = componentName;
+ this.componentVersion = componentVersion;
+ }
+
+ /**
+ * @return the registryBase
+ */
+ @Override
+ public URL getRegistryBase() {
+ return registryBase;
+ }
+
+ /**
+ * @return the familyName
+ */
+ @Override
+ public String getFamilyName() {
+ return familyName;
+ }
+
+ /**
+ * @return the componentName
+ */
+ @Override
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ * @return the componentVersion
+ */
+ @Override
+ public Integer getComponentVersion() {
+ return componentVersion;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result *= prime;
+ result += (componentName == null) ? 0 : componentName.hashCode();
+ result *= prime;
+ result += (componentVersion == null) ? 0 : componentVersion
+ .hashCode();
+ result *= prime;
+ result += (familyName == null) ? 0 : familyName.hashCode();
+ result *= prime;
+ result += (registryBase == null) ? 0 : registryBase.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!ID.class.isAssignableFrom(obj.getClass()))
+ return false;
+ ID other = (ID) obj;
+ if (componentName == null) {
+ if (other.getComponentName() != null)
+ return false;
+ } else if (!componentName.equals(other.getComponentName()))
+ return false;
+ if (componentVersion == null) {
+ if (other.getComponentVersion() != null)
+ return false;
+ } else if (!componentVersion.equals(other.getComponentVersion()))
+ return false;
+ if (familyName == null) {
+ if (other.getFamilyName() != null)
+ return false;
+ } else if (!familyName.equals(other.getFamilyName()))
+ return false;
+ if (registryBase == null) {
+ if (other.getRegistryBase() != null)
+ return false;
+ } else if (!registryBase.toString().equals(
+ other.getRegistryBase().toString()))
+ // NB: Comparison of URLs is on their string form!
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getComponentName() + " V. " + getComponentVersion()
+ + " in family " + getFamilyName() + " on "
+ + getRegistryBase().toExternalForm();
+ }
+
+ @Override
+ public boolean mostlyEqualTo(ID id) {
+ if (this == id)
+ return true;
+ if (id == null)
+ return false;
+ if (getClass() != id.getClass())
+ return false;
+ if (componentName == null) {
+ if (id.getFamilyName() != null)
+ return false;
+ } else if (!componentName.equals(id.getComponentName()))
+ return false;
+ if (familyName == null) {
+ if (id.getFamilyName() != null)
+ return false;
+ } else if (!familyName.equals(id.getFamilyName()))
+ return false;
+ if (registryBase == null) {
+ if (id.getRegistryBase() != null)
+ return false;
+ } else if (!registryBase.toString().equals(
+ id.getRegistryBase().toString()))
+ // NB: Comparison of URLs is on their string form!
+ return false;
+ return true;
+ }
+
+ @Override
+ public boolean mostlyEqualTo(Component c) {
+ return mostlyEqualTo(new Identifier(c.getRegistry()
+ .getRegistryBase(), c.getFamily().getName(), c.getName(), 0));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentConfig.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentConfig.java
new file mode 100644
index 0000000..7de348c
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentConfig.java
@@ -0,0 +1,23 @@
+package io.github.taverna_extras.component.api.config;
+/*
+ * 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.
+ */
+
+public interface ComponentConfig {
+ String URI = "http://ns.taverna.org.uk/2010/activity/component";
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentPropertyNames.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentPropertyNames.java
new file mode 100644
index 0000000..457161d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/config/ComponentPropertyNames.java
@@ -0,0 +1,32 @@
+package io.github.taverna_extras.component.api.config;
+/*
+ * 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.
+ */
+
+/**
+ * The names of properties used in JSON configurations associated with
+ * components.
+ *
+ * @author Donal Fellows
+ */
+public interface ComponentPropertyNames {
+ String REGISTRY_BASE = "registryBase";
+ String FAMILY_NAME = "familyName";
+ String COMPONENT_NAME = "componentName";
+ String COMPONENT_VERSION = "componentVersion";
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/package-info.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/package-info.java
new file mode 100644
index 0000000..a0b3e2f
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+/**
+ * An abstract API for working with components in a registry.
+ * @author Donal Fellows
+ * @author David Withers
+ */
+package io.github.taverna_extras.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ActivityProfile.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ActivityProfile.java
new file mode 100644
index 0000000..8795c8a
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ActivityProfile.java
@@ -0,0 +1,23 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+public interface ActivityProfile extends AnnotatedElement {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/AnnotatedElement.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/AnnotatedElement.java
new file mode 100644
index 0000000..0ad0da4
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/AnnotatedElement.java
@@ -0,0 +1,28 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+import java.util.List;
+
+import io.github.taverna_extras.component.api.ComponentException;
+
+public interface AnnotatedElement {
+ List<SemanticAnnotationProfile> getSemanticAnnotations()
+ throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionHandling.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionHandling.java
new file mode 100644
index 0000000..ee5810d
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionHandling.java
@@ -0,0 +1,47 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExceptionHandling {
+ private final boolean failLists;
+ private final List<HandleException> remapped = new ArrayList<HandleException>();
+
+ public ExceptionHandling(
+ io.github.taverna_extras.component.api.profile.doc.ExceptionHandling proxied) {
+ for (io.github.taverna_extras.component.api.profile.doc.HandleException he : proxied
+ .getHandleException())
+ remapped.add(new HandleException(he));
+ this.failLists = proxied.getFailLists() != null;
+ }
+
+ public boolean failLists() {
+ return failLists;
+ }
+
+ public List<HandleException> getHandleExceptions() {
+ return remapped;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionReplacement.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionReplacement.java
new file mode 100644
index 0000000..69163cf
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/ExceptionReplacement.java
@@ -0,0 +1,43 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+
+import io.github.taverna_extras.component.api.profile.doc.Replacement;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ExceptionReplacement {
+ private final String id, message;
+
+ public ExceptionReplacement(Replacement replacement) {
+ id = replacement.getReplacementId();
+ message = replacement.getReplacementMessage();
+ }
+
+ public String getReplacementId() {
+ return id;
+ }
+
+ public String getReplacementMessage() {
+ return message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/HandleException.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/HandleException.java
new file mode 100644
index 0000000..fb29cd6
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/HandleException.java
@@ -0,0 +1,55 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+
+import static java.util.regex.Pattern.DOTALL;
+import static java.util.regex.Pattern.compile;
+
+import java.util.regex.Pattern;
+
+/**
+ * @author alanrw
+ *
+ */
+public class HandleException {
+ private final Pattern pattern;
+ private ExceptionReplacement replacement;
+ private final boolean pruneStack;
+
+ public HandleException(
+ io.github.taverna_extras.component.api.profile.doc.HandleException proxied) {
+ pruneStack = proxied.getPruneStack() != null;
+ pattern = compile(proxied.getPattern(), DOTALL);
+ if (proxied.getReplacement() != null)
+ replacement = new ExceptionReplacement(proxied.getReplacement());
+ }
+
+ public boolean matches(String s) {
+ return pattern.matcher(s).matches();
+ }
+
+ public boolean pruneStack() {
+ return pruneStack;
+ }
+
+ public ExceptionReplacement getReplacement() {
+ return replacement;
+ }
+}
[11/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
deleted file mode 100644
index 6c7a5b0..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
+++ /dev/null
@@ -1,683 +0,0 @@
-package io.github.taverna_extras.component.profile;
-/*
- * 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.
- */
-
-import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
-import static java.lang.System.identityHashCode;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptyMap;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.profile.ActivityProfile;
-import io.github.taverna_extras.component.api.profile.ExceptionHandling;
-import io.github.taverna_extras.component.api.profile.PortProfile;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import io.github.taverna_extras.component.api.profile.doc.Activity;
-import io.github.taverna_extras.component.api.profile.doc.Ontology;
-import io.github.taverna_extras.component.api.profile.doc.Port;
-import io.github.taverna_extras.component.api.profile.doc.Profile;
-import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
-
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntProperty;
-import static org.apache.taverna.workflowmodel.health.HealthCheck.NO_PROBLEM;
-import org.apache.taverna.workflowmodel.health.RemoteHealthChecker;
-
-/**
- * A ComponentProfile specifies the inputs, outputs and semantic annotations
- * that a Component must contain.
- *
- * @author David Withers
- */
-public class ComponentProfileImpl implements
- io.github.taverna_extras.component.api.profile.Profile {
- private static final Logger logger = getLogger(ComponentProfileImpl.class);
- private static final Map<String, OntModel> ontologyModels = new HashMap<>();
- private static final JAXBContext jaxbContext;
- private BaseProfileLocator base;
- static {
- try {
- jaxbContext = JAXBContext.newInstance(Profile.class);
- } catch (JAXBException e) {
- // Should never happen! Represents a critical error
- throw new Error(
- "Failed to initialize profile deserialization engine", e);
- }
- }
- private io.github.taverna_extras.component.api.profile.Profile parent;
- private Profile profileDoc;
- private ExceptionHandling exceptionHandling;
- private Registry parentRegistry = null;
- private final Object lock = new Object();
- private Exception loaderException = null;
- protected volatile boolean loaded = false;
-
- public ComponentProfileImpl(URL profileURL, BaseProfileLocator base)
- throws ComponentException {
- this(null, profileURL, base);
- }
-
- public ComponentProfileImpl(String profileString, BaseProfileLocator base)
- throws ComponentException {
- this(null, profileString, base);
- }
-
- public ComponentProfileImpl(Registry registry, URI profileURI,
- BaseProfileLocator base) throws ComponentException,
- MalformedURLException {
- this(registry, profileURI.toURL(), base);
- }
-
- public ComponentProfileImpl(Registry registry, URL profileURL,
- BaseProfileLocator base) throws ComponentException {
- logger.info("Loading profile in " + identityHashCode(this) + " from "
- + profileURL);
- this.base = base;
- try {
- URL url = profileURL;
- if (url.getProtocol().startsWith("http"))
- url = new URI(url.getProtocol(), url.getAuthority(),
- url.getPath(), url.getQuery(), url.getRef()).toURL();
- loadProfile(this, url, base);
- } catch (MalformedURLException e) {
- logger.warn("Malformed URL? " + profileURL);
- } catch (URISyntaxException e) {
- logger.warn("Malformed URL? " + profileURL);
- }
- parentRegistry = registry;
- }
-
- public ComponentProfileImpl(Registry registry, String profileString,
- BaseProfileLocator base) throws ComponentException {
- logger.info("Loading profile in " + identityHashCode(this)
- + " from string");
- this.base = base;
- loadProfile(this, profileString, base);
- this.parentRegistry = registry;
- }
-
- private static void loadProfile(final ComponentProfileImpl profile,
- final Object source, BaseProfileLocator base) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- Date start = new Date();
- if (source instanceof URL)
- loadProfileFromURL(profile, (URL) source);
- else if (source instanceof String)
- loadProfileFromString(profile, (String) source);
- else
- throw new IllegalArgumentException(
- "Bad type of profile source: " + source.getClass());
- Date end = new Date();
- logger.info("Loaded profile in " + identityHashCode(profile)
- + " (in " + (end.getTime() - start.getTime())
- + " msec)");
- }
- };
- if (base.getProfile() == null)
- // Must load the base profile synchronously, to avoid deadlock
- r.run();
- else
- new Thread(r).start();
- }
-
- private static void loadProfileFromURL(ComponentProfileImpl profile, URL source) {
- try {
- URLConnection conn = source.openConnection();
- try {
- conn.addRequestProperty("Accept", "application/xml,*/*;q=0.1");
- } catch (Exception e) {
- }
- try (InputStream is = conn.getInputStream()) {
- profile.profileDoc = jaxbContext.createUnmarshaller()
- .unmarshal(new StreamSource(is), Profile.class)
- .getValue();
- }
- } catch (FileNotFoundException e) {
- profile.loaderException = e;
- logger.warn("URL not readable: " + source);
- } catch (Exception e) {
- profile.loaderException = e;
- logger.warn("Failed to load profile.", e);
- }
- synchronized (profile.lock) {
- profile.loaded = true;
- profile.lock.notifyAll();
- }
- }
-
- private static void loadProfileFromString(ComponentProfileImpl profile,
- String source) {
- try {
- profile.profileDoc = jaxbContext
- .createUnmarshaller()
- .unmarshal(new StreamSource(new StringReader(source)),
- Profile.class).getValue();
- } catch (Exception e) {
- profile.loaderException = e;
- logger.warn("Failed to load profile.", e);
- }
- synchronized (profile.lock) {
- profile.loaded = true;
- profile.lock.notifyAll();
- }
- }
-
- @Override
- public Registry getComponentRegistry() {
- return parentRegistry;
- }
-
- @Override
- public String getXML() throws ComponentException {
- try {
- StringWriter stringWriter = new StringWriter();
- jaxbContext.createMarshaller().marshal(getProfileDocument(),
- stringWriter);
- return stringWriter.toString();
- } catch (JAXBException e) {
- throw new ComponentException("Unable to serialize profile.", e);
- }
- }
-
- @Override
- public Profile getProfileDocument() throws ComponentException {
- try {
- synchronized (lock) {
- while (!loaded)
- lock.wait();
- if (loaderException != null) {
- if (loaderException instanceof FileNotFoundException)
- throw new ComponentException(
- "Profile not found/readable: "
- + loaderException.getMessage(),
- loaderException);
- throw new ComponentException(
- "Problem loading profile definition: "
- + loaderException.getMessage(),
- loaderException);
- }
- return profileDoc;
- }
- } catch (InterruptedException e) {
- logger.info("Interrupted during wait for lock.", e);
- return null;
- }
- }
-
- @Override
- public String getId() {
- try {
- return getProfileDocument().getId();
- } catch (ComponentException e) {
- return null;
- }
- }
-
- @Override
- public String getName() {
- try {
- return getProfileDocument().getName();
- } catch (ComponentException e) {
- return null;
- }
- }
-
- @Override
- public String getDescription() {
- try {
- return getProfileDocument().getDescription();
- } catch (ComponentException e) {
- return null;
- }
- }
-
- /**
- * @return Is this the base profile?
- */
- private boolean isBase() {
- if (base == null)
- return true;
- Object o = base.getProfile();
- return o == null || o == this;
- }
-
- private synchronized io.github.taverna_extras.component.api.profile.Profile parent()
- throws ComponentException {
- if (parent == null) {
- try {
- if (!isBase() && getProfileDocument().getExtends() != null
- && parentRegistry != null) {
- parent = parentRegistry
- .getComponentProfile(getProfileDocument()
- .getExtends().getProfileId());
- if (parent != null)
- return parent;
- }
- } catch (ComponentException e) {
- }
- parent = new EmptyProfile();
- }
- return parent;
- }
-
- @Override
- public String getOntologyLocation(String ontologyId) {
- String ontologyURI = null;
- try {
- for (Ontology ontology : getProfileDocument().getOntology())
- if (ontology.getId().equals(ontologyId))
- ontologyURI = ontology.getValue();
- } catch (ComponentException e) {
- }
- if ((ontologyURI == null) && !isBase())
- ontologyURI = base.getProfile().getOntologyLocation(ontologyId);
- return ontologyURI;
- }
-
- private Map<String, String> internalGetPrefixMap()
- throws ComponentException {
- Map<String, String> result = new TreeMap<>();
- try {
- for (Ontology ontology : getProfileDocument().getOntology())
- result.put(ontology.getId(), ontology.getValue());
- } catch (ComponentException e) {
- }
- result.putAll(parent().getPrefixMap());
- return result;
- }
-
- @Override
- public Map<String, String> getPrefixMap() throws ComponentException {
- Map<String, String> result = internalGetPrefixMap();
- if (!isBase())
- result.putAll(base.getProfile().getPrefixMap());
- return result;
- }
-
- private OntModel readOntologyFromURI(String ontologyId, String ontologyURI) {
- logger.info("Reading ontology for " + ontologyId + " from "
- + ontologyURI);
- OntModel model = createOntologyModel();
- try {
- URL url = new URL(ontologyURI);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- // CRITICAL: must be retrieved as correct content type
- conn.addRequestProperty("Accept",
- "application/rdf+xml,application/xml;q=0.9");
- try (InputStream in = conn.getInputStream()) {
- // TODO Consider whether the encoding is handled right
- // ontologyModel.read(in, url.toString());
- model.read(new StringReader(IOUtils.toString(in, "UTF-8")),
- url.toString());
- }
- } catch (MalformedURLException e) {
- logger.error("Problem reading ontology " + ontologyId, e);
- return null;
- } catch (IOException e) {
- logger.error("Problem reading ontology " + ontologyId, e);
- return null;
- } catch (NullPointerException e) {
- // TODO Why is this different?
- logger.error("Problem reading ontology " + ontologyId, e);
- model = createOntologyModel();
- }
- return model;
- }
-
- private boolean isAccessible(String ontologyURI) {
- return RemoteHealthChecker.contactEndpoint(null, ontologyURI).getResultId() == NO_PROBLEM;
- }
-
- @Override
- public OntModel getOntology(String ontologyId) {
- String ontologyURI = getOntologyLocation(ontologyId);
- synchronized (ontologyModels) {
- if (ontologyModels.containsKey(ontologyURI))
- return ontologyModels.get(ontologyURI);
- }
-
- // Drop out of critical section while we do I/O
- if (!isAccessible(ontologyURI)) {
- logger.warn("Catastrophic problem contacting ontology source.");
- // Catastrophic problem?!
- synchronized (ontologyModels) {
- ontologyModels.put(ontologyURI, null);
- }
- return null;
- }
- OntModel model = readOntologyFromURI(ontologyId, ontologyURI);
-
- synchronized (ontologyModels) {
- if (model != null && !ontologyModels.containsKey(ontologyURI)) {
- ontologyModels.put(ontologyURI, model);
- }
- return ontologyModels.get(ontologyURI);
- }
- }
-
- @Override
- public List<PortProfile> getInputPortProfiles() {
- List<PortProfile> portProfiles = new ArrayList<>();
- try {
- for (Port port : getProfileDocument().getComponent().getInputPort())
- portProfiles.add(new PortProfileImpl(this, port));
- } catch (ComponentException e) {
- }
- if (!isBase())
- portProfiles.addAll(base.getProfile().getInputPortProfiles());
- return portProfiles;
- }
-
- @Override
- public List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles()
- throws ComponentException {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- List<PortProfile> portProfiles = getInputPortProfiles();
- portProfiles.addAll(parent().getInputPortProfiles());
- for (PortProfile portProfile : portProfiles)
- saProfiles.addAll(portProfile.getSemanticAnnotations());
- if (!isBase())
- saProfiles.addAll(base.getProfile()
- .getInputSemanticAnnotationProfiles());
- return getUniqueSemanticAnnotationProfiles(saProfiles);
- }
-
- @Override
- public List<PortProfile> getOutputPortProfiles() {
- List<PortProfile> portProfiles = new ArrayList<>();
- try {
- for (Port port : getProfileDocument().getComponent()
- .getOutputPort())
- portProfiles.add(new PortProfileImpl(this, port));
- } catch (ComponentException e) {
- }
- if (!isBase())
- portProfiles.addAll(base.getProfile().getOutputPortProfiles());
- return portProfiles;
- }
-
- @Override
- public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles()
- throws ComponentException {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- List<PortProfile> portProfiles = getOutputPortProfiles();
- portProfiles.addAll(parent().getOutputPortProfiles());
- for (PortProfile portProfile : portProfiles)
- saProfiles.addAll(portProfile.getSemanticAnnotations());
- if (!isBase())
- saProfiles.addAll(base.getProfile()
- .getOutputSemanticAnnotationProfiles());
- return getUniqueSemanticAnnotationProfiles(saProfiles);
- }
-
- @Override
- public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
- List<io.github.taverna_extras.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
- try {
- for (Activity activity : getProfileDocument().getComponent()
- .getActivity())
- activityProfiles.add(new ActivityProfileImpl(this, activity));
- } catch (ComponentException e) {
- }
- return activityProfiles;
- }
-
- @Override
- public List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles()
- throws ComponentException {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- List<ActivityProfile> activityProfiles = getActivityProfiles();
- activityProfiles.addAll(parent().getActivityProfiles());
- for (ActivityProfile activityProfile : activityProfiles)
- saProfiles.addAll(activityProfile.getSemanticAnnotations());
- if (!isBase())
- saProfiles.addAll(base.getProfile()
- .getActivitySemanticAnnotationProfiles());
- return getUniqueSemanticAnnotationProfiles(saProfiles);
- }
-
- @Override
- public List<SemanticAnnotationProfile> getSemanticAnnotations()
- throws ComponentException {
- List<SemanticAnnotationProfile> saProfiles = getComponentProfiles();
- saProfiles.addAll(parent().getSemanticAnnotations());
- if (!isBase())
- saProfiles.addAll(base.getProfile().getSemanticAnnotations());
- return saProfiles;
- }
-
- private List<SemanticAnnotationProfile> getComponentProfiles() {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- try {
- for (SemanticAnnotation semanticAnnotation : getProfileDocument()
- .getComponent().getSemanticAnnotation())
- saProfiles.add(new SemanticAnnotationProfileImpl(this,
- semanticAnnotation));
- } catch (ComponentException e) {
- }
- return saProfiles;
- }
-
- private List<SemanticAnnotationProfile> getUniqueSemanticAnnotationProfiles(
- List<SemanticAnnotationProfile> semanticAnnotationProfiles) {
- List<SemanticAnnotationProfile> uniqueSemanticAnnotations = new ArrayList<>();
- Set<OntProperty> predicates = new HashSet<>();
- for (SemanticAnnotationProfile semanticAnnotationProfile : semanticAnnotationProfiles) {
- OntProperty prop = semanticAnnotationProfile.getPredicate();
- if (prop != null && !predicates.contains(prop)) {
- predicates.add(prop);
- uniqueSemanticAnnotations.add(semanticAnnotationProfile);
- }
- }
- return uniqueSemanticAnnotations;
- }
-
- @Override
- public ExceptionHandling getExceptionHandling() {
- try {
- if (exceptionHandling == null
- && getProfileDocument().getComponent()
- .getExceptionHandling() != null)
- exceptionHandling = new ExceptionHandling(getProfileDocument()
- .getComponent().getExceptionHandling());
- } catch (ComponentException e) {
- }
- return exceptionHandling;
- }
-
- @Override
- public String toString() {
- return "ComponentProfile" + "\n Name : " + getName()
- + "\n Description : " + getDescription()
- + "\n InputPortProfiles : " + getInputPortProfiles()
- + "\n OutputPortProfiles : " + getOutputPortProfiles();
- }
-
- @Override
- public int hashCode() {
- return 31 + ((getId() == null) ? 0 : getId().hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ComponentProfileImpl other = (ComponentProfileImpl) obj;
- if (!loaded || !other.loaded)
- return false;
- if (getId() == null)
- return other.getId() == null;
- return getId().equals(other.getId());
- }
-
- public OntClass getClass(String className) {
- try {
- for (Ontology ontology : getProfileDocument().getOntology()) {
- OntModel ontModel = getOntology(ontology.getId());
- if (ontModel != null) {
- OntClass result = ontModel.getOntClass(className);
- if (result != null)
- return result;
- }
- }
- } catch (ComponentException e) {
- }
- return null;
- }
-
- @Override
- public void delete() throws ComponentException {
- throw new ComponentException("Deletion not supported.");
- }
-}
-
-/**
- * A simple do-nothing implementation of a profile. Used when there's no other
- * option for what a <i>real</i> profile extends.
- *
- * @author Donal Fellows
- */
-final class EmptyProfile implements
- io.github.taverna_extras.component.api.profile.Profile {
- @Override
- public String getName() {
- return "";
- }
-
- @Override
- public String getDescription() {
- return "";
- }
-
- @Override
- public Registry getComponentRegistry() {
- return null;
- }
-
- @Override
- public String getXML() throws ComponentException {
- throw new ComponentException("No document.");
- }
-
- @Override
- public Profile getProfileDocument() {
- return new Profile();
- }
-
- @Override
- public String getId() {
- return "";
- }
-
- @Override
- public String getOntologyLocation(String ontologyId) {
- return "";
- }
-
- @Override
- public Map<String, String> getPrefixMap() {
- return emptyMap();
- }
-
- @Override
- public OntModel getOntology(String ontologyId) {
- return null;
- }
-
- @Override
- public List<PortProfile> getInputPortProfiles() {
- return emptyList();
- }
-
- @Override
- public List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles() {
- return emptyList();
- }
-
- @Override
- public List<PortProfile> getOutputPortProfiles() {
- return emptyList();
- }
-
- @Override
- public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles() {
- return emptyList();
- }
-
- @Override
- public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
- return emptyList();
- }
-
- @Override
- public List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles() {
- return emptyList();
- }
-
- @Override
- public List<SemanticAnnotationProfile> getSemanticAnnotations() {
- return emptyList();
- }
-
- @Override
- public ExceptionHandling getExceptionHandling() {
- return null;
- }
-
- @Override
- public void delete() throws ComponentException {
- throw new ComponentException("Deletion forbidden.");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
deleted file mode 100644
index 53a1190..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package io.github.taverna_extras.component.profile;
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.github.taverna_extras.component.api.profile.PortProfile;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import io.github.taverna_extras.component.api.profile.doc.Port;
-import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
-
-/**
- * Specifies the semantic annotations that a port must have.
- *
- * @author David Withers
- */
-public class PortProfileImpl implements PortProfile {
- private final ComponentProfileImpl componentProfile;
- private final Port port;
-
- public PortProfileImpl(ComponentProfileImpl componentProfile, Port port) {
- this.componentProfile = componentProfile;
- this.port = port;
- }
-
- @Override
- public List<SemanticAnnotationProfile> getSemanticAnnotations() {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- for (SemanticAnnotation annotation : port.getSemanticAnnotation())
- saProfiles.add(new SemanticAnnotationProfileImpl(componentProfile,
- annotation));
- return saProfiles;
- }
-
- @Override
- public String toString() {
- return "PortProfile \n SemanticAnnotations : "
- + getSemanticAnnotations();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
deleted file mode 100644
index a3b5afa..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package io.github.taverna_extras.component.profile;
-/*
- * 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.
- */
-
-import static java.io.File.createTempFile;
-import static org.apache.commons.io.FileUtils.writeStringToFile;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
-
-import org.apache.jena.ontology.Individual;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.ontology.OntResource;
-
-/**
- * Definition of a semantic annotation for a component element.
- *
- * @author David Withers
- */
-public class SemanticAnnotationProfileImpl implements SemanticAnnotationProfile {
- private static final Logger log = getLogger(SemanticAnnotationProfileImpl.class);
- private final ComponentProfileImpl componentProfile;
- private final SemanticAnnotation semanticAnnotation;
-
- public SemanticAnnotationProfileImpl(ComponentProfileImpl componentProfile,
- SemanticAnnotation semanticAnnotation) {
- this.componentProfile = componentProfile;
- this.semanticAnnotation = semanticAnnotation;
- }
-
- /**
- * Returns the ontology that defines semantic annotation.
- *
- * @return the ontology that defines semantic annotation
- */
- @Override
- public OntModel getOntology() {
- String ontology = semanticAnnotation.getOntology();
- if (ontology == null)
- return null;
- return componentProfile.getOntology(ontology);
- }
-
- /**
- * Returns the predicate for the semantic annotation.
- *
- * @return the predicate for the semantic annotation
- */
- @Override
- public OntProperty getPredicate() {
- OntModel ontology = getOntology();
- if (ontology == null)
- return null;
- String predicate = semanticAnnotation.getPredicate();
- if (predicate == null)
- return null;
- if (predicate.contains("foaf")) {
- StringWriter sw = new StringWriter();
- ontology.writeAll(sw, null, "RDF/XML");
- try {
- writeStringToFile(createTempFile("foaf", null), sw.toString());
- } catch (IOException e) {
- log.info("failed to write foaf ontology to temporary file", e);
- }
- }
-
- return ontology.getOntProperty(predicate);
- }
-
- @Override
- public String getPredicateString() {
- return semanticAnnotation.getPredicate();
- }
-
- @Override
- public String getClassString() {
- return semanticAnnotation.getClazz();
- }
-
- /**
- * Returns the individual that the semantic annotation must use.
- *
- * May be null if no explicit individual is required.
- *
- * @return the individual that the semantic annotation must use
- */
- @Override
- public Individual getIndividual() {
- String individual = semanticAnnotation.getValue();
- if (individual == null || individual.isEmpty())
- return null;
- return getOntology().getIndividual(individual);
- }
-
- /**
- * Returns the individuals in the range of the predicate defined in the
- * ontology.
- *
- * @return the individuals in the range of the predicate defined in the
- * ontology
- */
- @Override
- public List<Individual> getIndividuals() {
- OntModel ontology = getOntology();
- OntProperty prop = getPredicate();
- if (ontology == null || prop == null)
- return new ArrayList<>();
- OntResource range = prop.getRange();
- if (range == null)
- return new ArrayList<>();
- return ontology.listIndividuals(range).toList();
- }
-
- @Override
- public Integer getMinOccurs() {
- return semanticAnnotation.getMinOccurs().intValue();
- }
-
- @Override
- public Integer getMaxOccurs() {
- try {
- return Integer.valueOf(semanticAnnotation.getMaxOccurs());
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- @Override
- public String toString() {
- return "SemanticAnnotation " + "\n Predicate : " + getPredicate()
- + "\n Individual : " + getIndividual() + "\n Individuals : "
- + getIndividuals();
- }
-
- @Override
- public OntClass getRangeClass() {
- String clazz = this.getClassString();
- if (clazz != null)
- return componentProfile.getClass(clazz);
-
- OntProperty prop = getPredicate();
- if (prop == null)
- return null;
- OntResource range = prop.getRange();
- if (range != null && range.isClass())
- return range.asClass();
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
deleted file mode 100644
index c9fda59..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-public class ClientVersion {
- private static final String DEFAULT_VERSION = "1.1.0";
- public static final String VERSION;
-
- private ClientVersion() {
- }
-
- static {
- InputStream is = ClientVersion.class
- .getResourceAsStream("version.properties");
- String version = DEFAULT_VERSION;
- if (is != null)
- try {
- Properties p = new Properties();
- p.load(is);
- version = p.getProperty("project.version", DEFAULT_VERSION);
- } catch (IOException e) {
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- VERSION = version;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
deleted file mode 100644
index afdf2b8..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-
-import static java.util.Collections.synchronizedSortedMap;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * A Component is a building block for creating Taverna workflows. Components
- * and must comply with the ComponentProfile of their ComponentFamily.
- *
- * @author David Withers
- */
-public abstract class Component implements
- io.github.taverna_extras.component.api.Component {
- private String name;
- private String description;
- private URL url;
- /**
- * Mapping from version numbers to version implementations.
- */
- protected SortedMap<Integer, Version> versionMap = new TreeMap<>();
-
- protected Component(URL url) {
- this.url = url;
- }
-
- protected Component(String url) {
- try {
- this.url = new URL(url);
- } catch (MalformedURLException e) {
- // nothing
- }
- }
-
- protected Component(File fileDir) {
- try {
- this.url = fileDir.toURI().toURL();
- } catch (MalformedURLException e) {
- // nothing
- }
- }
-
- @Override
- public final synchronized String getName() {
- if (name == null)
- name = internalGetName();
- return name;
- }
-
- /**
- * The real implementation of the name fetching. Caching already handled.
- *
- * @return The name of the component.
- */
- protected abstract String internalGetName();
-
- @Override
- public final synchronized String getDescription() {
- if (description == null)
- description = internalGetDescription();
- return description;
- }
-
- /**
- * The real implementation of the description fetching. Caching already
- * handled.
- *
- * @return The description of the component.
- */
- protected abstract String internalGetDescription();
-
- @Override
- public final SortedMap<Integer, Version> getComponentVersionMap() {
- synchronized (versionMap) {
- checkComponentVersionMap();
- return synchronizedSortedMap(versionMap);
- }
- }
-
- private void checkComponentVersionMap() {
- if (versionMap.isEmpty())
- populateComponentVersionMap();
- }
-
- /**
- * Create the contents of the {@link #versionMap} field.
- */
- protected abstract void populateComponentVersionMap();
-
- @Override
- public final Version getComponentVersion(Integer version)
- throws ComponentException {
- synchronized (versionMap) {
- checkComponentVersionMap();
- return versionMap.get(version);
- }
- }
-
- @Override
- public final Version addVersionBasedOn(WorkflowBundle bundle,
- String revisionComment) throws ComponentException {
- Version result = internalAddVersionBasedOn(bundle, revisionComment);
- synchronized (versionMap) {
- checkComponentVersionMap();
- versionMap.put(result.getVersionNumber(), result);
- }
- return result;
- }
-
- /**
- * Manufacture a new version of a component. Does not add to the overall
- * version map.
- *
- * @param bundle
- * The definition of the component.
- * @param revisionComment
- * The description of the version.
- * @return The new version of the component.
- * @throws RegistryException
- */
- protected abstract Version internalAddVersionBasedOn(WorkflowBundle bundle,
- String revisionComment) throws ComponentException;
-
- @Override
- public final URL getComponentURL() {
- return url;
- }
-
- @Override
- public void delete() throws ComponentException {
- getFamily().removeComponent(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
deleted file mode 100644
index ce8a782..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * A ComponentFamily is a collection of Components that share the same
- * ComponentProfile.
- *
- * @author David Withers
- */
-public abstract class ComponentFamily implements
- io.github.taverna_extras.component.api.Family {
- private Registry parentRegistry;
- private String name;
- private String description;
- private Profile componentProfile;
- private ComponentUtil util;
-
- protected Map<String, Component> componentCache = new HashMap<>();
-
- public ComponentFamily(Registry componentRegistry, ComponentUtil util) {
- this.parentRegistry = componentRegistry;
- this.util = util;
- }
-
- @Override
- public Registry getComponentRegistry() {
- return parentRegistry;
- }
-
- @Override
- public final synchronized String getName() {
- if (name == null) {
- name = internalGetName();
- }
- return name;
- }
-
- protected abstract String internalGetName();
-
- @Override
- public final synchronized String getDescription() {
- if (description == null) {
- description = internalGetDescription();
- }
- return description;
- }
-
- protected abstract String internalGetDescription();
-
- @Override
- public final synchronized Profile getComponentProfile()
- throws ComponentException {
- if (componentProfile == null)
- componentProfile = internalGetComponentProfile();
- if (componentProfile == null) {
- Profile baseProfile = util.getBaseProfile();
- if (baseProfile != null) {
- return baseProfile;
- }
- }
- return componentProfile;
- }
-
- protected abstract Profile internalGetComponentProfile()
- throws ComponentException;
-
- @Override
- public final List<Component> getComponents() throws ComponentException {
- checkComponentCache();
- return new ArrayList<>(componentCache.values());
- }
-
- private void checkComponentCache() throws ComponentException {
- synchronized (componentCache) {
- if (componentCache.isEmpty())
- populateComponentCache();
- }
- }
-
- protected abstract void populateComponentCache() throws ComponentException;
-
- @Override
- public final Component getComponent(String componentName)
- throws ComponentException {
- checkComponentCache();
- return componentCache.get(componentName);
- }
-
- @Override
- public final Version createComponentBasedOn(String componentName,
- String description, WorkflowBundle bundle) throws ComponentException {
- if (componentName == null)
- throw new ComponentException("Component name must not be null");
- if (bundle == null)
- throw new ComponentException("workflow must not be null");
- checkComponentCache();
- if (componentCache.containsKey(componentName))
- throw new ComponentException("Component name already used");
- Version version = internalCreateComponentBasedOn(componentName,
- description, bundle);
- synchronized (componentCache) {
- Component c = version.getComponent();
- componentCache.put(componentName, c);
- }
- return version;
- }
-
- protected abstract Version internalCreateComponentBasedOn(
- String componentName, String description, WorkflowBundle bundle)
- throws ComponentException;
-
- @Override
- public final void removeComponent(Component component)
- throws ComponentException {
- if (component != null) {
- checkComponentCache();
- synchronized (componentCache) {
- componentCache.remove(component.getName());
- }
- internalRemoveComponent(component);
- }
- }
-
- protected abstract void internalRemoveComponent(Component component)
- throws ComponentException;
-
- @Override
- public void delete() throws ComponentException {
- getComponentRegistry().removeComponentFamily(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
deleted file mode 100644
index 91846a3..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import static java.lang.System.currentTimeMillis;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public class ComponentImplementationCache {
- private class Entry {
- WorkflowBundle implementation;
- long timestamp;
- }
- private final long VALIDITY = 15 * 60 * 1000;
- private final Logger logger = getLogger(ComponentImplementationCache.class);
- private final Map<Version.ID, Entry> cache = new WeakHashMap<>();
- private ComponentUtil utils;
-
- public void setComponentUtil(ComponentUtil utils) {
- this.utils = utils;
- }
-
- public WorkflowBundle getImplementation(Version.ID id) throws ComponentException {
- long now = currentTimeMillis();
- synchronized (id) {
- Entry entry = cache.get(id);
- if (entry != null && entry.timestamp >= now)
- return entry.implementation;
- logger.info("before calculate component version for " + id);
- Version componentVersion;
- try {
- componentVersion = utils.getVersion(id);
- } catch (RuntimeException e) {
- if (entry != null)
- return entry.implementation;
- throw new ComponentException(e.getMessage(), e);
- }
- logger.info("calculated component version for " + id + " as "
- + componentVersion.getVersionNumber() + "; retrieving dataflow");
- WorkflowBundle implementation = componentVersion.getImplementation();
- //DataflowValidationReport report = implementation.checkValidity();
- //logger.info("component version " + id + " incomplete:"
- // + report.isWorkflowIncomplete() + " valid:"
- // + report.isValid());
- entry = new Entry();
- entry.implementation = implementation;
- entry.timestamp = now + VALIDITY;
- return cache.put(id, entry).implementation;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
deleted file mode 100644
index 325da27..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentRegistry.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-
-/**
- * A ComponentRegistry contains ComponentFamilies and ComponentProfiles.
- *
- * @author David Withers
- */
-public abstract class ComponentRegistry implements
- io.github.taverna_extras.component.api.Registry {
- protected Map<String, Family> familyCache = new HashMap<>();
- protected List<Profile> profileCache = new ArrayList<>();
- protected List<SharingPolicy> permissionCache = new ArrayList<>();
- protected List<License> licenseCache = new ArrayList<>();
-
- private URL registryBase;
-
- protected ComponentRegistry(URL registryBase) throws ComponentException {
- this.registryBase = registryBase;
- }
-
- protected ComponentRegistry(File fileDir) throws ComponentException {
- try {
- this.registryBase = fileDir.toURI().toURL();
- } catch (MalformedURLException e) {
- throw new ComponentException(e);
- }
- }
-
- @Override
- public final List<Family> getComponentFamilies() throws ComponentException {
- checkFamilyCache();
- return new ArrayList<Family>(familyCache.values());
- }
-
- private void checkFamilyCache() throws ComponentException {
- synchronized (familyCache) {
- if (familyCache.isEmpty())
- populateFamilyCache();
- }
- }
-
- protected abstract void populateFamilyCache() throws ComponentException;
-
- @Override
- public final Family getComponentFamily(String familyName)
- throws ComponentException {
- checkFamilyCache();
- return familyCache.get(familyName);
- }
-
- @Override
- public final Family createComponentFamily(String familyName,
- Profile componentProfile, String description, License license,
- SharingPolicy sharingPolicy) throws ComponentException {
- if (familyName == null)
- throw new ComponentException(
- "Component family name must not be null");
- if (componentProfile == null)
- throw new ComponentException("Component profile must not be null");
- if (getComponentFamily(familyName) != null)
- throw new ComponentException("Component family already exists");
-
- Family result = internalCreateComponentFamily(familyName,
- componentProfile, description, license, sharingPolicy);
- checkFamilyCache();
- synchronized (familyCache) {
- familyCache.put(familyName, result);
- }
- return result;
- }
-
- protected abstract Family internalCreateComponentFamily(String familyName,
- Profile componentProfile, String description, License license,
- SharingPolicy sharingPolicy) throws ComponentException;
-
- @Override
- public final void removeComponentFamily(Family componentFamily)
- throws ComponentException {
- if (componentFamily != null) {
- checkFamilyCache();
- synchronized (familyCache) {
- familyCache.remove(componentFamily.getName());
- }
- internalRemoveComponentFamily(componentFamily);
- }
- }
-
- protected abstract void internalRemoveComponentFamily(Family componentFamily)
- throws ComponentException;
-
- @Override
- public final URL getRegistryBase() {
- return registryBase;
- }
-
- @Override
- public final String getRegistryBaseString() {
- String urlString = getRegistryBase().toString();
- if (urlString.endsWith("/"))
- urlString = urlString.substring(0, urlString.length() - 1);
- return urlString;
- }
-
- private void checkProfileCache() throws ComponentException {
- synchronized (profileCache) {
- if (profileCache.isEmpty())
- populateProfileCache();
- }
- }
-
- protected abstract void populateProfileCache() throws ComponentException;
-
- @Override
- public final List<Profile> getComponentProfiles() throws ComponentException {
- checkProfileCache();
- return profileCache;
- }
-
- @Override
- public final Profile getComponentProfile(String id)
- throws ComponentException {
- // TODO use a map instead of a *linear search*...
- for (Profile p : getComponentProfiles())
- if (p.getId().equals(id))
- return p;
- return null;
- }
-
- @Override
- public final Profile addComponentProfile(Profile componentProfile,
- License license, SharingPolicy sharingPolicy)
- throws ComponentException {
- if (componentProfile == null) {
- throw new ComponentException("componentProfile is null");
- }
- Profile result = null;
- checkProfileCache();
- for (Profile p : getComponentProfiles())
- if (p.getId().equals(componentProfile.getId())) {
- result = p;
- break;
- }
-
- if (result == null) {
- result = internalAddComponentProfile(componentProfile, license,
- sharingPolicy);
- synchronized (profileCache) {
- profileCache.add(result);
- }
- }
- return result;
- }
-
- protected abstract Profile internalAddComponentProfile(
- Profile componentProfile, License license,
- SharingPolicy sharingPolicy) throws ComponentException;
-
- private void checkPermissionCache() {
- synchronized (permissionCache) {
- if (permissionCache.isEmpty())
- populatePermissionCache();
- }
- }
-
- protected abstract void populatePermissionCache();
-
- @Override
- public final List<SharingPolicy> getPermissions() throws ComponentException {
- checkPermissionCache();
- return permissionCache;
- }
-
- private void checkLicenseCache() {
- synchronized (licenseCache) {
- if (licenseCache.isEmpty())
- populateLicenseCache();
- }
- }
-
- protected abstract void populateLicenseCache();
-
- @Override
- public final List<License> getLicenses() throws ComponentException {
- checkLicenseCache();
- return licenseCache;
- }
-
- protected License getLicenseByAbbreviation(String licenseString)
- throws ComponentException {
- checkLicenseCache();
- for (License l : getLicenses())
- if (l.getAbbreviation().equals(licenseString))
- return l;
- return null;
- }
-
- @Override
- public abstract License getPreferredLicense() throws ComponentException;
-
- @Override
- public abstract Set<Version.ID> searchForComponents(String prefixString,
- String text) throws ComponentException;
-
- @Override
- public String toString() {
- String[] names = getClass().getName().split("\\.");
- return names[names.length-1] + ": " + registryBase;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
deleted file mode 100644
index cc31f05..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentUtil.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.profile.BaseProfileLocator;
-import io.github.taverna_extras.component.profile.ComponentProfileImpl;
-import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
-import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
-import org.springframework.beans.factory.annotation.Required;
-
-/**
- * @author alanrw
- * @author dkf
- */
-public class ComponentUtil implements ComponentFactory {
- private NewComponentRegistryFactory netLocator;
- private BaseProfileLocator base;
- private LocalComponentRegistryFactory fileLocator;
-
- private final Map<String, Registry> cache = new HashMap<>();
-
- @Required
- public void setNetworkLocator(NewComponentRegistryFactory locator) {
- this.netLocator = locator;
- }
-
- @Required
- public void setFileLocator(LocalComponentRegistryFactory fileLocator) {
- this.fileLocator = fileLocator;
- }
-
- @Required
- public void setBaseLocator(BaseProfileLocator base) {
- this.base = base;
- }
-
- @Override
- public Registry getRegistry(URL registryBase) throws ComponentException {
- Registry registry = cache.get(registryBase.toString());
- if (registry != null)
- return registry;
-
- if (registryBase.getProtocol().startsWith("http")) {
- if (!netLocator.verifyBase(registryBase))
- throw new ComponentException(
- "Unable to establish credentials for " + registryBase);
- registry = netLocator.getComponentRegistry(registryBase);
- } else
- registry = fileLocator.getComponentRegistry(registryBase);
- cache.put(registryBase.toString(), registry);
- return registry;
- }
-
- @Override
- public Family getFamily(URL registryBase, String familyName)
- throws ComponentException {
- return getRegistry(registryBase).getComponentFamily(familyName);
- }
-
- @Override
- public Component getComponent(URL registryBase, String familyName,
- String componentName) throws ComponentException {
- return getRegistry(registryBase).getComponentFamily(familyName)
- .getComponent(componentName);
- }
-
- @Override
- public Version getVersion(URL registryBase, String familyName,
- String componentName, Integer componentVersion)
- throws ComponentException {
- return getRegistry(registryBase).getComponentFamily(familyName)
- .getComponent(componentName)
- .getComponentVersion(componentVersion);
- }
-
- @Override
- public Version getVersion(Version.ID ident) throws ComponentException {
- return getVersion(ident.getRegistryBase(), ident.getFamilyName(),
- ident.getComponentName(), ident.getComponentVersion());
- }
-
- @Override
- public Component getComponent(Version.ID ident) throws ComponentException {
- return getComponent(ident.getRegistryBase(), ident.getFamilyName(),
- ident.getComponentName());
- }
-
- @Override
- public Profile getProfile(URL url) throws ComponentException {
- Profile p = new ComponentProfileImpl(url, base);
- p.getProfileDocument(); // force immediate loading
- return p;
- }
-
- @Override
- public Profile getBaseProfile() throws ComponentException {
- return base.getProfile();
- }
-
- public BaseProfileLocator getBaseProfileLocator() {
- return base;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
deleted file mode 100644
index ab95218..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersion.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public abstract class ComponentVersion implements
- io.github.taverna_extras.component.api.Version {
- private Integer versionNumber;
- private String description;
- private Component component;
-
- protected ComponentVersion(Component component) {
- this.component = component;
- }
-
- @Override
- public final synchronized Integer getVersionNumber() {
- if (versionNumber == null)
- versionNumber = internalGetVersionNumber();
- return versionNumber;
- }
-
- protected abstract Integer internalGetVersionNumber();
-
- @Override
- public final synchronized String getDescription() {
- if (description == null)
- description = internalGetDescription();
-
- return description;
- }
-
- protected abstract String internalGetDescription();
-
- @Override
- public final synchronized WorkflowBundle getImplementation()
- throws ComponentException {
- // Cached in dataflow cache
- return internalGetImplementation();
- }
-
- protected abstract WorkflowBundle internalGetImplementation()
- throws ComponentException;
-
- @Override
- public final Component getComponent() {
- return component;
- }
-
- @Override
- public ID getID() {
- Component c = getComponent();
- return new ComponentVersionIdentification(c.getRegistry()
- .getRegistryBase(), c.getFamily().getName(), c.getName(),
- getVersionNumber());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
deleted file mode 100644
index 4cecab5..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentVersionIdentification.java
+++ /dev/null
@@ -1,212 +0,0 @@
-
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.Version.ID;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentVersionIdentification implements
- io.github.taverna_extras.component.api.Version.ID {
- private static final long serialVersionUID = 1768548650702925916L;
- private URL registryBase;
- private String familyName;
- private String componentName;
- private Integer componentVersion;
-
- public ComponentVersionIdentification(URL registryBase, String familyName,
- String componentName, Integer componentVersion) {
- super();
- this.registryBase = registryBase;
- this.familyName = familyName;
- this.componentName = componentName;
- this.componentVersion = componentVersion;
- }
-
- public ComponentVersionIdentification(Registry registry, Family family,
- io.github.taverna_extras.component.api.Component component, Integer version) {
- this(registry.getRegistryBase(), family.getName(), component.getName(), version);
- }
-
- public ComponentVersionIdentification(Version.ID toBeCopied) {
- this.registryBase = toBeCopied.getRegistryBase();
- this.familyName = toBeCopied.getFamilyName();
- this.componentName = toBeCopied.getComponentName();
- this.componentVersion = toBeCopied.getComponentVersion();
- }
-
- /**
- * @return the registryBase
- */
- @Override
- public URL getRegistryBase() {
- return registryBase;
- }
-
- /**
- * @return the familyName
- */
- @Override
- public String getFamilyName() {
- return familyName;
- }
-
- /**
- * @return the componentName
- */
- @Override
- public String getComponentName() {
- return componentName;
- }
-
- /**
- * @return the componentVersion
- */
- @Override
- public Integer getComponentVersion() {
- return componentVersion;
- }
-
- /**
- * @param componentVersion
- * the componentVersion to set
- */
- public void setComponentVersion(Integer componentVersion) {
- this.componentVersion = componentVersion;
- }
-
- /**
- * @param registryBase
- * the registryBase to set
- */
- public void setRegistryBase(URL registryBase) {
- this.registryBase = registryBase;
- }
-
- /**
- * @param familyName
- * the familyName to set
- */
- public void setFamilyName(String familyName) {
- this.familyName = familyName;
- }
-
- /**
- * @param componentName
- * the componentName to set
- */
- public void setComponentName(String componentName) {
- this.componentName = componentName;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((componentName == null) ? 0 : componentName.hashCode());
- result = prime
- * result
- + ((componentVersion == null) ? 0 : componentVersion.hashCode());
- result = prime * result
- + ((familyName == null) ? 0 : familyName.hashCode());
- result = prime * result
- + ((registryBase == null) ? 0 : registryBase.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ComponentVersionIdentification other = (ComponentVersionIdentification) obj;
- if (componentName == null) {
- if (other.componentName != null)
- return false;
- } else if (!componentName.equals(other.componentName))
- return false;
- if (componentVersion == null) {
- if (other.componentVersion != null)
- return false;
- } else if (!componentVersion.equals(other.componentVersion))
- return false;
- if (familyName == null) {
- if (other.familyName != null)
- return false;
- } else if (!familyName.equals(other.familyName))
- return false;
- if (registryBase == null) {
- if (other.registryBase != null)
- return false;
- } else if (!registryBase.toString().equals(other.registryBase.toString()))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return getComponentName() + " V. " + getComponentVersion()
- + " in family " + getFamilyName() + " on "
- + getRegistryBase().toExternalForm();
- }
-
- @Override
- public boolean mostlyEqualTo(ID id) {
- if (this == id)
- return true;
- if (id == null)
- return false;
- if (getClass() != id.getClass())
- return false;
- ComponentVersionIdentification other = (ComponentVersionIdentification) id;
- if (componentName == null) {
- if (other.componentName != null)
- return false;
- } else if (!componentName.equals(other.componentName))
- return false;
- if (familyName == null) {
- if (other.familyName != null)
- return false;
- } else if (!familyName.equals(other.familyName))
- return false;
- if (registryBase == null) {
- if (other.registryBase != null)
- return false;
- } else if (!registryBase.toString().equals(other.registryBase.toString()))
- return false;
- return true;
- }
-
- @Override
- public boolean mostlyEqualTo(io.github.taverna_extras.component.api.Component c) {
- return mostlyEqualTo(new ComponentVersionIdentification(c.getRegistry(), c.getFamily(), c, 0));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
deleted file mode 100644
index 697f57f..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponent.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-
-import static org.apache.commons.io.FileUtils.readFileToString;
-import static org.apache.commons.io.FileUtils.writeStringToFile;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.NoSuchElementException;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.registry.Component;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-class LocalComponent extends Component {
- static final String COMPONENT_FILENAME = "dataflow.t2flow";
- private final File componentDir;
- private final LocalComponentRegistry registry;
- private final LocalComponentFamily family;
- private static Logger logger = getLogger(LocalComponent.class);
- private SystemUtils system;
-
- public LocalComponent(File componentDir, LocalComponentRegistry registry,
- LocalComponentFamily family, SystemUtils system) {
- super(componentDir);
- this.system = system;
- this.componentDir = componentDir;
- this.registry = registry;
- this.family = family;
- }
-
- @Override
- protected final Version internalAddVersionBasedOn(WorkflowBundle bundle,
- String revisionComment) throws ComponentException {
- Integer nextVersionNumber = 1;
- try {
- nextVersionNumber = getComponentVersionMap().lastKey() + 1;
- } catch (NoSuchElementException e) {
- // This is OK
- }
- File newVersionDir = new File(componentDir,
- nextVersionNumber.toString());
- newVersionDir.mkdirs();
- LocalComponentVersion newComponentVersion = new LocalComponentVersion(
- this, newVersionDir, system);
- try {
- system.saveBundle(bundle, new File(newVersionDir,
- COMPONENT_FILENAME));
- } catch (Exception e) {
- throw new ComponentException("Unable to save component version", e);
- }
- File revisionCommentFile = new File(newVersionDir, "description");
- try {
- writeStringToFile(revisionCommentFile, revisionComment, ENC);
- } catch (IOException e) {
- throw new ComponentException("Could not write out description", e);
- }
-
- return newComponentVersion;
- }
-
- @Override
- protected final String internalGetName() {
- return componentDir.getName();
- }
-
- @Override
- protected final void populateComponentVersionMap() {
- for (File subFile : componentDir.listFiles())
- try {
- if (subFile.isDirectory())
- versionMap.put(Integer.valueOf(subFile.getName()),
- new LocalComponentVersion(this, subFile, system));
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- @Override
- public int hashCode() {
- return 31 + ((componentDir == null) ? 0 : componentDir.hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LocalComponent other = (LocalComponent) obj;
- if (componentDir == null)
- return (other.componentDir == null);
- return componentDir.equals(other.componentDir);
- }
-
- @Override
- protected final String internalGetDescription() {
- File descriptionFile = new File(componentDir, "description");
- try {
- if (descriptionFile.isFile())
- return readFileToString(descriptionFile);
- } catch (IOException e) {
- logger.error("failed to get description from " + descriptionFile, e);
- }
- return "";
- }
-
- @Override
- public Registry getRegistry() {
- return registry;
- }
-
- @Override
- public Family getFamily() {
- return family;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
deleted file mode 100644
index b9a692c..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/local/LocalComponentFamily.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package io.github.taverna_extras.component.registry.local;
-/*
- * 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.
- */
-
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.apache.commons.io.FileUtils.readFileToString;
-import static org.apache.commons.io.FileUtils.writeStringToFile;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.registry.local.LocalComponentRegistry.ENC;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.registry.ComponentFamily;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author alanrw
- *
- */
-class LocalComponentFamily extends ComponentFamily {
- private static Logger logger = getLogger(LocalComponentFamily.class);
- private static final String PROFILE = "profile";
-
- private final File componentFamilyDir;
- private SystemUtils system;
-
- public LocalComponentFamily(LocalComponentRegistry parentRegistry,
- File componentFamilyDir, ComponentUtil util, SystemUtils system) {
- super(parentRegistry, util);
- this.componentFamilyDir = componentFamilyDir;
- this.system = system;
- }
-
- @Override
- protected final Profile internalGetComponentProfile()
- throws ComponentException {
- LocalComponentRegistry parentRegistry = (LocalComponentRegistry) getComponentRegistry();
- File profileFile = new File(componentFamilyDir, PROFILE);
- String profileName;
- try {
- profileName = readFileToString(profileFile, ENC);
- } catch (IOException e) {
- throw new ComponentException("Unable to read profile name", e);
- }
- for (Profile p : parentRegistry.getComponentProfiles())
- if (p.getName().equals(profileName))
- return p;
- return null;
- }
-
- @Override
- protected void populateComponentCache() throws ComponentException {
- for (File subFile : componentFamilyDir.listFiles()) {
- if (!subFile.isDirectory())
- continue;
- LocalComponent newComponent = new LocalComponent(subFile,
- (LocalComponentRegistry) getComponentRegistry(), this,
- system);
- componentCache.put(newComponent.getName(), newComponent);
- }
- }
-
- @Override
- protected final String internalGetName() {
- return componentFamilyDir.getName();
- }
-
- @Override
- protected final Version internalCreateComponentBasedOn(
- String componentName, String description, WorkflowBundle bundle)
- throws ComponentException {
- File newSubFile = new File(componentFamilyDir, componentName);
- if (newSubFile.exists())
- throw new ComponentException("Component already exists");
- newSubFile.mkdirs();
- File descriptionFile = new File(newSubFile, "description");
- try {
- writeStringToFile(descriptionFile, description, ENC);
- } catch (IOException e) {
- throw new ComponentException("Could not write out description", e);
- }
- LocalComponent newComponent = new LocalComponent(newSubFile,
- (LocalComponentRegistry) getComponentRegistry(), this, system);
-
- return newComponent.addVersionBasedOn(bundle, "Initial version");
- }
-
- @Override
- public int hashCode() {
- return 31 + ((componentFamilyDir == null) ? 0 : componentFamilyDir
- .hashCode());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- LocalComponentFamily other = (LocalComponentFamily) obj;
- if (componentFamilyDir == null)
- return (other.componentFamilyDir == null);
- return componentFamilyDir.equals(other.componentFamilyDir);
- }
-
- @Override
- protected final String internalGetDescription() {
- File descriptionFile = new File(componentFamilyDir, "description");
- try {
- if (descriptionFile.isFile())
- return readFileToString(descriptionFile);
- } catch (IOException e) {
- logger.error("failed to get description from " + descriptionFile, e);
- }
- return "";
- }
-
- @Override
- protected final void internalRemoveComponent(Component component)
- throws ComponentException {
- File componentDir = new File(componentFamilyDir, component.getName());
- try {
- deleteDirectory(componentDir);
- } catch (IOException e) {
- throw new ComponentException("Unable to delete component", e);
- }
- }
-}
[12/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/package-info.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/package-info.java
new file mode 100644
index 0000000..6a89454
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/annotations/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+/**
+ * Miscellaneous annotations on other parts of the component engine.
+ *
+ * @author Donal Fellows
+ */
+package io.github.taverna_extras.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/package-info.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/package-info.java
new file mode 100644
index 0000000..89df01a
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/registry/standard/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/**
+ * This is the new interface to the myExperiment registry, a.k.a. μExperiment.
+ * @author Donal Fellows
+ */
+package io.github.taverna_extras.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/AnnotationUtils.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/AnnotationUtils.java
new file mode 100644
index 0000000..a3ac463
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/AnnotationUtils.java
@@ -0,0 +1,109 @@
+package io.github.taverna_extras.component.utils;
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.WeakHashMap;
+
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.URITools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
+
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.rdf.model.Statement;
+
+public class AnnotationUtils {
+ private static final String TITLE_ANNOTATION = "http://purl.org/dc/terms/title";
+ private static final String DESCRIPTION_ANNOTATION = "http://purl.org/dc/terms/description";
+ private Scufl2Tools tools = new Scufl2Tools();
+ private URITools uris = new URITools();
+
+ public Model getAnnotationModel(Child<WorkflowBundle> subject) throws IOException {
+ return ModelFactory.createDefaultModel().add(getModel(subject));
+ }
+
+ private WeakHashMap<Child<?>, Model> cache = new WeakHashMap<>();
+
+ private static void readParse(Model model, WorkflowBundle bundle, String path)
+ throws IOException {
+ model.read(
+ new StringReader(bundle.getResources()
+ .getResourceAsString(path)), bundle.getGlobalBaseURI()
+ .resolve(path).toString(), "TTL");
+ }
+
+ public Model getModel(Child<WorkflowBundle> subject) throws IOException {
+ WorkflowBundle bundle = subject.getParent();
+ Model m = cache.get(subject);
+ if (m == null) {
+ m = ModelFactory.createDefaultModel();
+ long initialSize = m.size();
+ for (Annotation a : tools.annotationsFor(subject,
+ subject.getParent()))
+ if (!a.getBody().isAbsolute())
+ readParse(m, bundle, a.getBody().getPath());
+ if (m.size() == initialSize)
+ for (ResourceEntry o : bundle.getResources()
+ .listResources("annotation").values())
+ readParse(m, bundle, o.getPath());
+ cache.put(subject, m);
+ }
+ return m;
+ }
+
+ public Statement getAnnotation(Child<WorkflowBundle> subject,
+ String uriForAnnotation) throws IOException {
+ Model m = getModel(subject);
+ Property p = m.getProperty(uriForAnnotation);
+ return m.getResource(uris.uriForBean(subject).toString()).getProperty(
+ p);
+ }
+
+ /** Get the title of the main workflow in a workflow bundle. */
+ public String getTitle(WorkflowBundle bundle, String defaultTitle) {
+ try {
+ Statement s = getAnnotation(bundle.getMainWorkflow(),
+ TITLE_ANNOTATION);
+ if (s != null && s.getObject().isLiteral())
+ return s.getObject().asLiteral().getString();
+ } catch (IOException e) {
+ // TODO log this error?
+ }
+ return defaultTitle;
+ }
+
+ /** Get the description of the main workflow in a workflow bundle. */
+ public String getDescription(WorkflowBundle bundle, String defaultDescription) {
+ try {
+ Statement s = getAnnotation(bundle.getMainWorkflow(),
+ DESCRIPTION_ANNOTATION);
+ if (s != null && s.getObject().isLiteral())
+ return s.getObject().asLiteral().getString();
+ } catch (IOException e) {
+ // TODO log this error?
+ }
+ return defaultDescription;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/SystemUtils.java
new file mode 100644
index 0000000..9a57122
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/utils/SystemUtils.java
@@ -0,0 +1,135 @@
+package io.github.taverna_extras.component.utils;
+/*
+ * 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.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.api.Description;
+import org.apache.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
+import org.apache.taverna.platform.execution.api.WorkflowCompiler;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.workflowmodel.Dataflow;
+
+public class SystemUtils {
+ private static final String T2FLOW_TYPE = "application/vnd.taverna.t2flow+xml";
+ private static final String SCUFL2_TYPE = "application/vnd.taverna.scufl2.workflow-bundle";
+ private ApplicationConfiguration appConfig;
+ private WorkflowBundleIO workflowBundleIO;
+ private List<WorkflowCompiler> compilers;
+
+ public byte[] serializeBundle(WorkflowBundle bundle) throws ComponentException {
+ try {
+ ByteArrayOutputStream dataflowStream = new ByteArrayOutputStream();
+ workflowBundleIO.writeBundle(bundle, dataflowStream, SCUFL2_TYPE);
+ return dataflowStream.toByteArray();
+ } catch (Exception e) {
+ throw new ComponentException(
+ "failed to serialize component implementation", e);
+ }
+ }
+
+ private String determineMediaTypeForFilename(File file) {
+ String[] pieces = file.getName().split("\\.");
+ switch (pieces[pieces.length - 1]) {
+ case "t2flow":
+ return T2FLOW_TYPE;
+ default:
+ return SCUFL2_TYPE;
+ }
+ }
+
+ public void saveBundle(WorkflowBundle bundle, File file) throws Exception {
+ workflowBundleIO.writeBundle(bundle, file,
+ determineMediaTypeForFilename(file));
+ }
+
+ public WorkflowBundle getBundleFromUri(String uri) throws Exception {
+ return workflowBundleIO.readBundle(new URL(uri), null);
+ }
+
+ public WorkflowBundle getBundle(File file) throws Exception {
+ return workflowBundleIO.readBundle(file, null);
+ }
+
+ public static JAXBElement<?> getElement(Description d, String name)
+ throws ComponentException {
+ for (Object o : d.getContent())
+ if (o instanceof JAXBElement) {
+ JAXBElement<?> el = (JAXBElement<?>) o;
+ if (el.getName().getLocalPart().equals(name))
+ return el;
+ }
+ throw new ComponentException("no " + name + " element");
+ }
+
+ public static String getElementString(Description d, String name)
+ throws ComponentException {
+ return getElement(d, name).getValue().toString().trim();
+ }
+
+ public static String getValue(Description d) {
+ StringBuilder sb = new StringBuilder();
+ for (Object o : d.getContent())
+ if (!(o instanceof JAXBElement))
+ sb.append(o);
+ return sb.toString();
+ }
+
+ public File getApplicationHomeDir() {
+ return appConfig.getApplicationHomeDir().toFile();
+ }
+
+ public void setAppConfig(ApplicationConfiguration appConfig) {
+ this.appConfig = appConfig;
+ }
+
+ public void setWorkflowBundler(WorkflowBundleIO workflowBundler) {
+ this.workflowBundleIO = workflowBundler;
+ }
+
+ public void setCompilers(List<WorkflowCompiler> compilers) {
+ this.compilers = compilers;
+ }
+
+ public Dataflow compile(WorkflowBundle implementation)
+ throws InvalidWorkflowException {
+ InvalidWorkflowException exn = null;
+ if (compilers != null)
+ for (WorkflowCompiler c : new ArrayList<>(compilers))
+ try {
+ return c.getDataflow(implementation);
+ } catch (InvalidWorkflowException e) {
+ if (exn == null)
+ exn = e;
+ continue;
+ }
+ if (exn != null)
+ throw exn;
+ throw new InvalidWorkflowException("no compiler available");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
deleted file mode 100644
index 9619297..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.profile.ExceptionHandling;
-import io.github.taverna_extras.component.registry.ComponentImplementationCache;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.AnnotationUtils;
-import io.github.taverna_extras.component.utils.SystemUtils;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.taverna.activities.dataflow.DataflowActivity;
-import org.apache.taverna.annotation.annotationbeans.SemanticAnnotation;
-import org.apache.taverna.invocation.InvocationContext;
-import org.apache.taverna.invocation.impl.InvocationContextImpl;
-import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
-import org.apache.taverna.reference.ReferenceService;
-import org.apache.taverna.reference.T2Reference;
-import org.apache.taverna.workflowmodel.Dataflow;
-import org.apache.taverna.workflowmodel.EditException;
-import org.apache.taverna.workflowmodel.Edits;
-import org.apache.taverna.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
-import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import org.apache.taverna.workflowmodel.utils.AnnotationTools;
-
-public class ComponentActivity extends
- AbstractAsynchronousActivity<JsonNode> {
- public static final String URI = "http://ns.taverna.org.uk/2010/activity/component";
- private Logger logger = getLogger(ComponentActivity.class);
-
- private ComponentUtil util;
- private ComponentImplementationCache cache;
- private volatile DataflowActivity componentRealization;
- private JsonNode json;
- private ComponentActivityConfigurationBean bean;
- private SystemUtils system;
- private AnnotationUtils annUtils;
- private ComponentExceptionFactory cef;
-
- private Dataflow realizingDataflow = null;
-
- ComponentActivity(ComponentUtil util, ComponentImplementationCache cache,
- Edits edits, SystemUtils system, AnnotationUtils annUtils, ComponentExceptionFactory exnFactory) {
- this.util = util;
- this.cache = cache;
- this.system = system;
- this.annUtils = annUtils;
- setEdits(edits);
- this.componentRealization = new DataflowActivity();
- this.cef = exnFactory;
- }
-
- @Override
- public void configure(JsonNode json) throws ActivityConfigurationException {
- this.json = json;
- try {
- bean = new ComponentActivityConfigurationBean(json, util, cache);
- } catch (MalformedURLException e) {
- throw new ActivityConfigurationException(
- "failed to understand configuration", e);
- }
- try {
- configurePorts(bean.getPorts());
- } catch (ComponentException e) {
- throw new ActivityConfigurationException(
- "failed to get component realization", e);
- }
- }
-
- @Override
- public void executeAsynch(Map<String, T2Reference> inputs,
- AsynchronousActivityCallback callback) {
- try {
- ExceptionHandling exceptionHandling = bean.getExceptionHandling();
- // InvocationContextImpl newContext = copyInvocationContext(callback);
-
- getComponentRealization().executeAsynch(inputs, new ProxyCallback(
- callback, callback.getContext(), exceptionHandling, cef));
- } catch (ActivityConfigurationException e) {
- callback.fail("Unable to execute component", e);
- }
- }
-
- @SuppressWarnings("unused")
- private InvocationContextImpl copyInvocationContext(
- AsynchronousActivityCallback callback) {
- InvocationContext originalContext = callback.getContext();
- ReferenceService rs = originalContext.getReferenceService();
- InvocationContextImpl newContext = new InvocationContextImpl(rs, null);
- // for (Object o : originalContext.getEntities(Object.class)) {
- // newContext.addEntity(o);
- // }
- return newContext;
- }
-
- @Override
- public JsonNode getConfiguration() {
- return json;
- }
-
- ComponentActivityConfigurationBean getConfigBean() {
- return bean;
- }
-
- private DataflowActivity getComponentRealization()
- throws ActivityConfigurationException {
- synchronized (componentRealization) {
- try {
- if (componentRealization.getNestedDataflow() == null) {
- if (realizingDataflow == null)
- realizingDataflow = system.compile(util
- .getVersion(bean).getImplementation());
- componentRealization.setNestedDataflow(realizingDataflow);
- copyAnnotations();
- }
- } catch (ComponentException e) {
- logger.error("unable to read workflow", e);
- throw new ActivityConfigurationException(
- "unable to read workflow", e);
- } catch (InvalidWorkflowException e) {
- logger.error("unable to compile workflow", e);
- throw new ActivityConfigurationException(
- "unable to compile workflow", e);
- }
- }
-
- return componentRealization;
- }
-
- private void copyAnnotations() {
- // FIXME Completely wrong way of doing this!
- try {
- //annUtils.getAnnotation(subject, uriForAnnotation)
- String annotationValue = AnnotationTools.getAnnotationString(realizingDataflow,
- SemanticAnnotation.class, null);
- if (annotationValue != null)
- AnnotationTools.setAnnotationString(this, SemanticAnnotation.class,
- annotationValue, getEdits()).doEdit();
- } catch (EditException e) {
- logger.error("failed to set annotation string", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
deleted file mode 100644
index 6819b3f..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.ExceptionHandling;
-import io.github.taverna_extras.component.registry.ComponentImplementationCache;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-import org.apache.taverna.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
-
-/**
- * Component activity configuration bean.
- */
-public class ComponentActivityConfigurationBean extends
- ComponentVersionIdentification implements Serializable {
- public static final String ERROR_CHANNEL = "error_channel";
- public static final List<String> ignorableNames = Arrays
- .asList(ERROR_CHANNEL);
- private static final long serialVersionUID = 5774901665863468058L;
- private static final Logger logger = getLogger(ComponentActivity.class);
-
- private transient ActivityPortsDefinitionBean ports = null;
- private transient ExceptionHandling eh;
- private transient ComponentUtil util;
- private transient ComponentImplementationCache cache;
-
- public ComponentActivityConfigurationBean(Version.ID toBeCopied,
- ComponentUtil util, ComponentImplementationCache cache) {
- super(toBeCopied);
- this.util = util;
- this.cache = cache;
- try {
- getPorts();
- } catch (io.github.taverna_extras.component.api.ComponentException e) {
- logger.error("failed to get component realization", e);
- }
- }
-
- public ComponentActivityConfigurationBean(JsonNode json,
- ComponentUtil util, ComponentImplementationCache cache) throws MalformedURLException {
- super(getUrl(json), getFamily(json), getComponent(json),
- getVersion(json));
- this.util = util;
- this.cache = cache;
- }
-
- private static URL getUrl(JsonNode json) throws MalformedURLException {
- return new URL(json.get(REGISTRY_BASE).textValue());
- }
-
- private static String getFamily(JsonNode json) {
- return json.get(FAMILY_NAME).textValue();
- }
-
- private static String getComponent(JsonNode json) {
- return json.get(COMPONENT_NAME).textValue();
- }
-
- private static Integer getVersion(JsonNode json) {
- JsonNode node = json.get(COMPONENT_VERSION);
- if (node == null || !node.isInt())
- return null;
- return node.intValue();
- }
-
- private ActivityPortsDefinitionBean getPortsDefinition(WorkflowBundle w) {
- ActivityPortsDefinitionBean result = new ActivityPortsDefinitionBean();
- List<ActivityInputPortDefinitionBean> inputs = result
- .getInputPortDefinitions();
- List<ActivityOutputPortDefinitionBean> outputs = result
- .getOutputPortDefinitions();
-
- for (InputWorkflowPort iwp : w.getMainWorkflow().getInputPorts())
- inputs.add(makeInputDefinition(iwp));
- // FIXME: Get the ValidatorState (so we can get getPortResolvedDepth()
- ValidatorState vs = ... ;
- for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- outputs.add(makeOutputDefinition(vs.getPortResolvedDepth(owp), owp.getName()));
-
- try {
- eh = util.getFamily(getRegistryBase(), getFamilyName())
- .getComponentProfile().getExceptionHandling();
- if (eh != null)
- outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (io.github.taverna_extras.component.api.ComponentException e) {
- logger.error("failed to get exception handling for family", e);
- }
- return result;
- }
-
- private ActivityInputPortDefinitionBean makeInputDefinition(
- InputWorkflowPort dip) {
- ActivityInputPortDefinitionBean activityInputPortDefinitionBean = new ActivityInputPortDefinitionBean();
- activityInputPortDefinitionBean.setHandledReferenceSchemes(null);
- activityInputPortDefinitionBean.setMimeTypes((List<String>) null);
- activityInputPortDefinitionBean.setTranslatedElementType(String.class);
- activityInputPortDefinitionBean.setAllowsLiteralValues(true);
- activityInputPortDefinitionBean.setDepth(dip.getDepth());
- activityInputPortDefinitionBean.setName(dip.getName());
- return activityInputPortDefinitionBean;
- }
-
- private ActivityOutputPortDefinitionBean makeOutputDefinition(int depth,
- String name) {
- ActivityOutputPortDefinitionBean activityOutputPortDefinitionBean = new ActivityOutputPortDefinitionBean();
- activityOutputPortDefinitionBean.setMimeTypes(new ArrayList<String>());
- activityOutputPortDefinitionBean.setDepth(depth);
- activityOutputPortDefinitionBean.setGranularDepth(depth);
- activityOutputPortDefinitionBean.setName(name);
- return activityOutputPortDefinitionBean;
- }
-
- /**
- * @return the ports
- */
- public ActivityPortsDefinitionBean getPorts() throws io.github.taverna_extras.component.api.ComponentException{
- if (ports == null)
- ports = getPortsDefinition(cache.getImplementation(this));
- return ports;
- }
-
- public ExceptionHandling getExceptionHandling() {
- return eh;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
deleted file mode 100644
index c90ea1a..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version.ID;
-import io.github.taverna_extras.component.registry.ComponentImplementationCache;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import io.github.taverna_extras.component.utils.AnnotationUtils;
-import io.github.taverna_extras.component.utils.SystemUtils;
-import org.springframework.beans.factory.annotation.Required;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.taverna.workflowmodel.Edits;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityFactory;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityInputPort;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
-import org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-
-public class ComponentActivityFactory extends ComponentExceptionFactory
- implements ActivityFactory {
- private ComponentUtil util;
- private ComponentImplementationCache cache;
- private Edits edits;
- private SystemUtils system;
- private AnnotationUtils annUtils;
-
- @Override
- public ComponentActivity createActivity() {
- return new ComponentActivity(util, cache, edits, system, annUtils, this);
- }
-
- @Override
- public URI getActivityType() {
- return URI.create(ComponentActivity.URI);
- }
-
- @Override
- public JsonNode getActivityConfigurationSchema() {
- ObjectMapper objectMapper = new ObjectMapper();
- try {
- return objectMapper
- .readTree(getClass().getResource("/schema.json"));
- } catch (IOException e) {
- return objectMapper.createObjectNode();
- }
- }
-
- @Override
- public Set<ActivityInputPort> getInputPorts(JsonNode configuration)
- throws ActivityConfigurationException {
- try {
- Set<ActivityInputPort> activityInputPorts = new HashSet<>();
- for (ActivityInputPortDefinitionBean ipd : createConfiguration(
- configuration).getPorts().getInputPortDefinitions())
- activityInputPorts.add(edits.createActivityInputPort(
- ipd.getName(), ipd.getDepth(), true, null,
- ipd.getTranslatedElementType()));
- return activityInputPorts;
- } catch (MalformedURLException | ComponentException | RuntimeException e) {
- throw new ActivityConfigurationException(
- "failed to get implementation for configuration of inputs",
- e);
- }
- }
-
- @Override
- public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration)
- throws ActivityConfigurationException {
- try {
- Set<ActivityOutputPort> activityOutputPorts = new HashSet<>();
- for (ActivityOutputPortDefinitionBean opd : createConfiguration(
- configuration).getPorts().getOutputPortDefinitions())
- activityOutputPorts.add(edits.createActivityOutputPort(
- opd.getName(), opd.getDepth(), opd.getGranularDepth()));
- return activityOutputPorts;
- } catch (MalformedURLException | ComponentException | RuntimeException e) {
- throw new ActivityConfigurationException(
- "failed to get implementation for configuration of outputs",
- e);
- }
- }
-
- public ComponentActivityConfigurationBean createConfiguration(ID id) {
- return new ComponentActivityConfigurationBean(id, util, cache);
- }
-
- public ComponentActivityConfigurationBean createConfiguration(JsonNode json)
- throws MalformedURLException {
- return new ComponentActivityConfigurationBean(json, util, cache);
- }
-
- @Required
- public void setComponentUtil(ComponentUtil util) {
- this.util = util;
- }
-
- @Required
- public void setDataflowCache(ComponentImplementationCache cache) {
- this.cache = cache;
- }
-
- @Required
- public void setEdits(Edits edits) {
- this.edits = edits;
- }
-
- @Required
- public void setSystemUtil(SystemUtils system) {
- this.system = system;
- }
-
- @Required
- public void setAnnotationUtils(AnnotationUtils annUtils) {
- this.annUtils = annUtils;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
deleted file mode 100644
index d874241..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import static io.github.taverna_extras.component.activity.ComponentHealthCheck.NON_SHAREABLE;
-
-import java.util.List;
-import org.apache.taverna.visit.VisitKind;
-import org.apache.taverna.visit.VisitReport;
-import static org.apache.taverna.visit.VisitReport.Status.WARNING;
-import org.apache.taverna.workflowmodel.health.HealthChecker;
-
-/**
- * Component health checker
- *
- */
-public class ComponentActivityLocalChecker implements
- HealthChecker<ComponentActivity> {
- private static final VisitKind visitKind = ComponentHealthCheck
- .getInstance();
-
- @Override
- public boolean canVisit(Object o) {
- /*
- * Return True if we can visit the object. We could do deeper (but not
- * time consuming) checks here, for instance if the health checker only
- * deals with ComponentActivity where a certain configuration option is
- * enabled.
- */
- return o instanceof ComponentActivity;
- }
-
- @Override
- public boolean isTimeConsuming() {
- /*
- * Return true if the health checker does a network lookup or similar
- * time consuming checks, in which case it would only be performed when
- * using File->Validate workflow or File->Run.
- */
- return false;
- }
-
- @Override
- public VisitReport visit(ComponentActivity activity, List<Object> ancestry) {
- if (!activity.getConfigBean().getRegistryBase().getProtocol()
- .startsWith("http"))
- return new VisitReport(visitKind, activity,
- "Local component makes workflow non-shareable",
- NON_SHAREABLE, WARNING);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
deleted file mode 100644
index 4d45b60..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.activity.ComponentHealthCheck.OUT_OF_DATE;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.registry.ComponentUtil;
-import org.apache.taverna.visit.VisitKind;
-import org.apache.taverna.visit.VisitReport;
-import static org.apache.taverna.visit.VisitReport.Status.WARNING;
-import org.apache.taverna.workflowmodel.health.HealthChecker;
-import org.springframework.beans.factory.annotation.Required;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentActivityUpgradeChecker implements
- HealthChecker<ComponentActivity> {
- private static final String OUTDATED_MSG = "Component out of date";
- private static final VisitKind visitKind = ComponentHealthCheck
- .getInstance();
- private static Logger logger = getLogger(ComponentActivityUpgradeChecker.class);
- private ComponentUtil utils;
-
- @Required
- public void setComponentUtil(ComponentUtil util) {
- this.utils = util;
- }
-
- @Override
- public boolean canVisit(Object o) {
- return o instanceof ComponentActivity;
- }
-
- @Override
- public boolean isTimeConsuming() {
- return false;
- }
-
- @Override
- public VisitReport visit(ComponentActivity activity, List<Object> ancestry) {
- ComponentActivityConfigurationBean config = activity.getConfigBean();
- int versionNumber = config.getComponentVersion();
- int latestVersion = 0;
-
- try {
- latestVersion = utils
- .getComponent(config.getRegistryBase(),
- config.getFamilyName(), config.getComponentName())
- .getComponentVersionMap().lastKey();
- } catch (ComponentException e) {
- logger.error("failed to get component description", e);
- }
-
- if (latestVersion > versionNumber)
- return new VisitReport(visitKind, activity, OUTDATED_MSG,
- OUT_OF_DATE, WARNING);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
deleted file mode 100644
index 243fe84..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-class ComponentExceptionFactory {
- private static final String UNEXPECTED_ID = "http://ns.taverna.org.uk/2012/component/unexpected";
-
- ComponentExceptionFactory() {
- }
-
- public ComponentImplementationException createComponentException(
- String exceptionId, String message) {
- ComponentImplementationException result = new ComponentImplementationException(message);
- result.setExceptionId(exceptionId);
- return result;
- }
-
- public ComponentImplementationException createUnexpectedComponentException(
- String message) {
- return createComponentException(UNEXPECTED_ID, message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
deleted file mode 100644
index 0381de1..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import org.apache.taverna.visit.VisitKind;
-import org.apache.taverna.visit.Visitor;
-
-public class ComponentHealthCheck extends VisitKind {
- public static final int NO_PROBLEM = 0;
- public static final int OUT_OF_DATE = 10;
- public static final int NON_SHAREABLE = 20;
- public static final int FAILS_PROFILE = 30;
-
- @Override
- public Class<? extends Visitor<?>> getVisitorClass() {
- return ComponentActivityUpgradeChecker.class;
- }
-
- private static class Singleton {
- private static ComponentHealthCheck instance = new ComponentHealthCheck();
- }
-
- public static ComponentHealthCheck getInstance() {
- return Singleton.instance;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
deleted file mode 100644
index 7ef77f7..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-public class ComponentImplementationException extends Exception {
- public ComponentImplementationException(String string) {
- super(string);
- this.setStackTrace(new StackTraceElement[] {});
- }
-
- private static final long serialVersionUID = -3844030382222698090L;
- private String exceptionId;
-
- public void setExceptionId(String exceptionId) {
- this.exceptionId = exceptionId;
- }
-
- public String getExceptionId() {
- return exceptionId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
deleted file mode 100644
index 3a04af3..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package io.github.taverna_extras.component.activity;
-/*
- * 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.
- */
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.xml.ws.Holder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.profile.ExceptionHandling;
-import io.github.taverna_extras.component.api.profile.ExceptionReplacement;
-import io.github.taverna_extras.component.api.profile.HandleException;
-import org.apache.taverna.invocation.InvocationContext;
-import org.apache.taverna.reference.ErrorDocument;
-import org.apache.taverna.reference.ErrorDocumentService;
-import org.apache.taverna.reference.IdentifiedList;
-import org.apache.taverna.reference.ListService;
-import org.apache.taverna.reference.ReferenceService;
-import org.apache.taverna.reference.T2Reference;
-import static org.apache.taverna.reference.T2ReferenceType.ErrorDocument;
-import static org.apache.taverna.reference.T2ReferenceType.IdentifiedList;
-import static org.apache.taverna.reference.T2ReferenceType.ReferenceSet;
-import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import org.apache.taverna.workflowmodel.processor.dispatch.events.DispatchErrorType;
-
-/**
- * @author alanrw
- *
- */
-public class ProxyCallback implements AsynchronousActivityCallback {
- private static final Logger logger = getLogger(ProxyCallback.class);
-
- private final ComponentExceptionFactory cef;
- private final AsynchronousActivityCallback proxiedCallback;
- private final ReferenceService references;
- private final InvocationContext context;
- private final ExceptionHandling exceptionHandling;
- private final ListService lists;
- private final ErrorDocumentService errors;
-
- /**
- * @param proxiedCallback
- * @param invocationContext
- * @param exceptionHandling
- * @param exnFactory
- */
- ProxyCallback(AsynchronousActivityCallback proxiedCallback,
- InvocationContext invocationContext,
- ExceptionHandling exceptionHandling,
- ComponentExceptionFactory exnFactory) {
- this.proxiedCallback = proxiedCallback;
- this.exceptionHandling = exceptionHandling;
- context = invocationContext;
- references = context.getReferenceService();
- lists = references.getListService();
- errors = references.getErrorDocumentService();
- cef = exnFactory;
- }
-
- @Override
- public InvocationContext getContext() {
- return context;
- }
-
- @Override
- public void requestRun(Runnable runMe) {
- proxiedCallback.requestRun(runMe);
- }
-
- @Override
- public void receiveResult(Map<String, T2Reference> data, int[] index) {
- if (exceptionHandling == null) {
- proxiedCallback.receiveResult(data, index);
- return;
- }
-
- List<T2Reference> exceptions = new ArrayList<>();
- Map<String, T2Reference> replacement = new HashMap<>();
- for (Entry<String, T2Reference> entry : data.entrySet())
- replacement.put(entry.getKey(),
- considerReference(entry.getValue(), exceptions));
- replacement.put("error_channel",
- references.register(exceptions, 1, true, context));
- proxiedCallback.receiveResult(replacement, index);
- }
-
- private T2Reference considerReference(T2Reference value,
- List<T2Reference> exceptions) {
- if (!value.containsErrors())
- return value;
- else if (!value.getReferenceType().equals(IdentifiedList))
- return replaceErrors(value, value.getDepth(), exceptions);
- else if (exceptionHandling.failLists())
- return replaceErrors(findFirstFailure(value), value.getDepth(),
- exceptions);
-
- List<T2Reference> replacementList = new ArrayList<>();
- for (T2Reference subValue : lists.getList(value))
- replacementList.add(considerReference(subValue, exceptions));
- return references.register(replacementList, value.getDepth(), true,
- context);
- }
-
- private T2Reference findFirstFailure(T2Reference value) {
- IdentifiedList<T2Reference> originalList = lists.getList(value);
- for (T2Reference subValue : originalList) {
- if (subValue.getReferenceType().equals(ErrorDocument))
- return subValue;
- if (subValue.getReferenceType().equals(IdentifiedList))
- if (subValue.containsErrors())
- return findFirstFailure(subValue);
- // No need to consider value
- }
- return null;
- }
-
- private T2Reference replaceErrors(T2Reference value, int depth,
- List<T2Reference> exceptions) {
- ErrorDocument doc = errors.getError(value);
-
- Holder<HandleException> handleException = new Holder<>();
- Set<ErrorDocument> toConsider = new HashSet<>();
- Set<ErrorDocument> considered = new HashSet<>();
- toConsider.add(doc);
-
- while (!toConsider.isEmpty())
- try {
- ErrorDocument nudoc = remapException(toConsider, considered,
- handleException);
- if (nudoc != null) {
- doc = nudoc;
- break;
- }
- } catch (Exception e) {
- logger.error("failed to locate exception mapping", e);
- }
-
- String exceptionMessage = doc.getExceptionMessage();
- // An exception that is not mentioned
- if (handleException.value == null) {
- ComponentImplementationException newException = cef
- .createUnexpectedComponentException(exceptionMessage);
- T2Reference replacement = errors.registerError(exceptionMessage,
- newException, depth, context).getId();
- exceptions.add(errors.registerError(exceptionMessage, newException,
- 0, context).getId());
- return replacement;
- }
-
- if (handleException.value.pruneStack())
- doc.getStackTraceStrings().clear();
-
- ExceptionReplacement exnReplacement = handleException.value
- .getReplacement();
- if (exnReplacement == null) {
- T2Reference replacement = references.register(doc, depth, true,
- context);
- exceptions.add(references.register(doc, 0, true, context));
- return replacement;
- }
-
- ComponentImplementationException newException = cef
- .createComponentException(exnReplacement.getReplacementId(),
- exnReplacement.getReplacementMessage());
- T2Reference replacement = errors.registerError(
- exnReplacement.getReplacementMessage(), newException, depth,
- context).getId();
- exceptions.add(errors.registerError(
- exnReplacement.getReplacementMessage(), newException, 0,
- context).getId());
- return replacement;
- }
-
- private ErrorDocument remapException(Set<ErrorDocument> toConsider,
- Set<ErrorDocument> considered,
- Holder<HandleException> handleException) {
- ErrorDocument found = null;
- ErrorDocument errorDoc = toConsider.iterator().next();
-
- considered.add(errorDoc);
- toConsider.remove(errorDoc);
- String exceptionMessage = errorDoc.getExceptionMessage();
- for (HandleException he : exceptionHandling.getHandleExceptions()) {
- if (!he.matches(exceptionMessage))
- continue;
- handleException.value = he;
- found = errorDoc;
- }
- if (!errorDoc.getErrorReferences().isEmpty())
- for (T2Reference subRef : errorDoc.getErrorReferences())
- for (T2Reference newErrorRef : getErrors(subRef)) {
- ErrorDocument subDoc = errors.getError(newErrorRef);
- if (subDoc == null)
- logger.error("Error document contains references to non-existent sub-errors");
- else if (!considered.contains(subDoc))
- toConsider.add(subDoc);
- }
- return found;
- }
-
- private Set<T2Reference> getErrors(T2Reference ref) {
- Set<T2Reference> result = new HashSet<>();
- if (ref.getReferenceType().equals(ReferenceSet)) {
- // nothing
- } else if (ref.getReferenceType().equals(IdentifiedList)) {
- IdentifiedList<T2Reference> originalList = lists.getList(ref);
- for (T2Reference subValue : originalList)
- if (subValue.containsErrors())
- result.addAll(getErrors(subValue));
- } else
- result.add(ref);
- return result;
- }
-
- @Override
- public void receiveCompletion(int[] completionIndex) {
- proxiedCallback.receiveCompletion(completionIndex);
- }
-
- @Override
- public void fail(String message, Throwable t, DispatchErrorType errorType) {
- proxiedCallback.fail(message, t, errorType);
- }
-
- @Override
- public void fail(String message, Throwable t) {
- proxiedCallback.fail(message, t);
- }
-
- @Override
- public void fail(String message) {
- proxiedCallback.fail(message);
- }
-
- @Override
- public String getParentProcessIdentifier() {
- // return "";
- return proxiedCallback.getParentProcessIdentifier();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
deleted file mode 100644
index 086a49b..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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 io.github.taverna_extras.component.activity;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
deleted file mode 100644
index a948cd4..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package io.github.taverna_extras.component.profile;
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.github.taverna_extras.component.api.profile.ActivityProfile;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import io.github.taverna_extras.component.api.profile.doc.Activity;
-import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
-
-/**
- * Specifies the semantic annotations that an activity must have.
- *
- * @author David Withers
- */
-public class ActivityProfileImpl implements ActivityProfile {
- private final ComponentProfileImpl componentProfile;
- private final Activity activity;
-
- public ActivityProfileImpl(ComponentProfileImpl componentProfile,
- Activity activity) {
- this.componentProfile = componentProfile;
- this.activity = activity;
- }
-
- @Override
- public List<SemanticAnnotationProfile> getSemanticAnnotations() {
- List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
- for (SemanticAnnotation annotation : activity.getSemanticAnnotation())
- saProfiles.add(new SemanticAnnotationProfileImpl(componentProfile,
- annotation));
- return saProfiles;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
deleted file mode 100644
index 989f411..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package io.github.taverna_extras.component.profile;
-/*
- * 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.
- */
-
-import static java.util.Locale.UK;
-import static org.apache.commons.httpclient.HttpStatus.SC_OK;
-import static org.apache.commons.io.FileUtils.writeStringToFile;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.params.HttpClientParams;
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import org.apache.taverna.configuration.app.ApplicationConfiguration;
-
-public class BaseProfileLocator {
- private static final String BASE_PROFILE_PATH = "BaseProfile.xml";
- private static final String BASE_PROFILE_URI = "http://build.mygrid.org.uk/taverna/BaseProfile.xml";
- private static final int TIMEOUT = 5000;
- private static final String pattern = "EEE, dd MMM yyyy HH:mm:ss z";
- private static final SimpleDateFormat format = new SimpleDateFormat(
- pattern, UK);
-
- private Logger logger = getLogger(BaseProfileLocator.class);
- private ApplicationConfiguration appConfig;
- private ComponentProfileImpl profile;
-
- private void locateBaseProfile() {
- File baseProfileFile = getBaseProfileFile();
- @SuppressWarnings("unused")
- boolean load = false;
- Long remoteBaseProfileTime = null;
- long localBaseProfileTime = -1;
-
- HttpClientParams params = new HttpClientParams();
- params.setConnectionManagerTimeout(TIMEOUT);
- params.setSoTimeout(TIMEOUT);
- HttpClient client = new HttpClient(params);
-
- try {
- remoteBaseProfileTime = getRemoteBaseProfileTimestamp(client);
- logger.info("NoticeTime is " + remoteBaseProfileTime);
- } catch (URISyntaxException e) {
- logger.error("URI problem", e);
- } catch (IOException e) {
- logger.info("Could not read base profile", e);
- } catch (ParseException e) {
- logger.error("Could not parse last-modified time", e);
- }
- if (baseProfileFile.exists())
- localBaseProfileTime = baseProfileFile.lastModified();
-
- try {
- if ((remoteBaseProfileTime != null)
- && (remoteBaseProfileTime > localBaseProfileTime)) {
- profile = new ComponentProfileImpl(null, new URL(BASE_PROFILE_URI),
- null);
- writeStringToFile(baseProfileFile, profile.getXML());
- }
- } catch (MalformedURLException e) {
- logger.error("URI problem", e);
- profile = null;
- } catch (ComponentException e) {
- logger.error("Component Registry problem", e);
- profile = null;
- } catch (IOException e) {
- logger.error("Unable to write profile", e);
- profile = null;
- }
-
- try {
- if ((profile == null) && baseProfileFile.exists())
- profile = new ComponentProfileImpl(null, baseProfileFile.toURI()
- .toURL(), null);
- } catch (Exception e) {
- logger.error("URI problem", e);
- profile = null;
- }
- }
-
- private long parseTime(String timestamp) throws ParseException {
- timestamp = timestamp.trim();
- if (timestamp.endsWith(" GMT"))
- timestamp = timestamp.substring(0, timestamp.length() - 3)
- + " +0000";
- else if (timestamp.endsWith(" BST"))
- timestamp = timestamp.substring(0, timestamp.length() - 3)
- + " +0100";
- return format.parse(timestamp).getTime();
- }
-
- private long getRemoteBaseProfileTimestamp(HttpClient client)
- throws URISyntaxException, IOException, HttpException,
- ParseException {
- URI baseProfileURI = new URI(BASE_PROFILE_URI);
- HttpMethod method = new GetMethod(baseProfileURI.toString());
- int statusCode = client.executeMethod(method);
- if (statusCode != SC_OK) {
- logger.warn("HTTP status " + statusCode + " while getting "
- + baseProfileURI);
- return -1;
- }
- Header h = method.getResponseHeader("Last-Modified");
- if (h == null)
- return -1;
- return parseTime(h.getValue());
- }
-
- private File getBaseProfileFile() {
- File config = new File(appConfig.getApplicationHomeDir().toFile(), "conf");
- if (!config.exists())
- config.mkdir();
- return new File(config, BASE_PROFILE_PATH);
- }
-
- public synchronized ComponentProfileImpl getProfile() {
- if (profile == null)
- locateBaseProfile();
- return profile;
- }
-
- public void setAppConfig(ApplicationConfiguration appConfig) {
- this.appConfig = appConfig;
- }
-}
[25/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreationDialog.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreationDialog.java
new file mode 100644
index 0000000..3a467fd
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreationDialog.java
@@ -0,0 +1,666 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.util.Collections.sort;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.AbstractAction;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.ListCellRenderer;
+
+//import net.sf.taverna.t2.lang.ui.DeselectingButton;
+//import net.sf.taverna.t2.workbench.edits.CompoundEdit;
+//import net.sf.taverna.t2.workbench.edits.Edit;
+//import net.sf.taverna.t2.workbench.edits.EditException;
+//import net.sf.taverna.t2.workbench.edits.EditManager;
+//import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
+//import net.sf.taverna.t2.workbench.models.graph.GraphController;
+//import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+//import net.sf.taverna.t2.workflow.edits.AddActivityEdit;
+//import net.sf.taverna.t2.workflow.edits.AddActivityInputPortMappingEdit;
+//import net.sf.taverna.t2.workflow.edits.AddActivityOutputPortMappingEdit;
+//import net.sf.taverna.t2.workflow.edits.AddChildEdit;
+//import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
+//import net.sf.taverna.t2.workflow.edits.AddProcessorInputPortEdit;
+//import net.sf.taverna.t2.workflow.edits.AddProcessorOutputPortEdit;
+//import net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
+//import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
+//import net.sf.taverna.t2.workflow.edits.RemoveChildEdit;
+//import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
+//import net.sf.taverna.t2.workflow.edits.SetIterationStrategyStackEdit;
+
+import org.apache.log4j.Logger;
+import org.apache.taverna.annotation.annotationbeans.DescriptiveTitle;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.Named;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.ProcessorPort;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+import org.apache.taverna.scufl2.api.port.SenderPort;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+import org.apache.taverna.workflow.edits.AddActivityEdit;
+import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
+import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+import org.apache.taverna.workflow.edits.AddDataLinkEdit;
+import org.apache.taverna.workflow.edits.AddProcessorInputPortEdit;
+import org.apache.taverna.workflow.edits.AddProcessorOutputPortEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
+import org.apache.taverna.workflow.edits.RemoveChildEdit;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+import org.apache.taverna.workflow.edits.SetIterationStrategyStackEdit;
+import org.apache.taverna.workflowmodel.utils.AnnotationTools;
+
+/**
+ * @author alanrw
+ */
+public class NestedWorkflowCreationDialog extends HelpEnabledDialog {
+ private static final long serialVersionUID = 727059218457420449L;
+ private static final Logger logger = getLogger(NestedWorkflowCreationDialog.class);
+ private static final Comparator<Processor> processorComparator = new Comparator<Processor>() {
+ @Override
+ public int compare(Processor o1, Processor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+ private static final ListCellRenderer<Object> defaultRenderer = new DefaultListCellRenderer();
+ private static final ListCellRenderer<Processor> processorRenderer = new ListCellRenderer<Processor>() {
+ @Override
+ public Component getListCellRendererComponent(
+ JList<? extends Processor> list,
+ Processor value, int index, boolean isSelected,
+ boolean cellHasFocus) {
+ return defaultRenderer.getListCellRendererComponent(list,
+ value.getName(), index, isSelected, cellHasFocus);
+ }
+ };
+
+ private final EditManager em;
+ private final GraphViewComponent graphView;
+ private final List<Processor> includedProcessors = new ArrayList<>();
+ private List<Processor> allProcessors;
+ private final List<Processor> includableProcessors = new ArrayList<>();
+
+ private JList<Processor> includableList = new JList<>();
+ private JList<Processor> includedList = new JList<>();
+ private final Workflow currentDataflow;
+ private JButton excludeButton;
+ private JButton includeButton;
+ private JButton okButton;
+ private JButton resetButton;
+ private JTextField nameField = new JTextField(30);
+
+ public NestedWorkflowCreationDialog(Frame owner, Object o,
+ Workflow dataflow, EditManager em, GraphViewComponent graphView) {
+ super(owner, "Nested workflow creation", true, null);
+ this.em = em;
+ this.graphView = graphView;
+
+ if (o instanceof Processor)
+ includedProcessors.add((Processor) o);
+ this.currentDataflow = dataflow;
+
+ allProcessors = new ArrayList<>(dataflow.getProcessors());
+
+ this.setLayout(new BorderLayout());
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout());
+
+ okButton = new DeselectingButton(new OKAction(this));
+ buttonPanel.add(okButton);
+
+ resetButton = new DeselectingButton(new ResetAction(this));
+ buttonPanel.add(resetButton);
+
+ JButton cancelButton = new DeselectingButton(new CancelAction(this));
+ buttonPanel.add(cancelButton);
+
+ JPanel innerPanel = new JPanel(new BorderLayout());
+ JPanel processorChoice = createProcessorChoicePanel(dataflow);
+ innerPanel.add(processorChoice, CENTER);
+
+ JPanel namePanel = new JPanel(new FlowLayout());
+ namePanel.add(new JLabel("Workflow name: "));
+ nameField.setText("nested");
+ namePanel.add(nameField);
+ innerPanel.add(namePanel, SOUTH);
+
+ this.add(innerPanel, CENTER);
+
+ this.add(buttonPanel, SOUTH);
+ this.pack();
+ this.setSize(new Dimension(500, 800));
+ }
+
+ private JPanel createProcessorChoicePanel(Workflow dataflow) {
+ JPanel result = new JPanel();
+ result.setLayout(new GridLayout(0, 2));
+
+ JPanel includedProcessorsPanel = createIncludedProcessorsPanel();
+ JPanel includableProcessorsPanel = createIncludableProcessorsPanel();
+ result.add(includableProcessorsPanel);
+ result.add(includedProcessorsPanel);
+ updateLists();
+ return result;
+ }
+
+ private JPanel createIncludableProcessorsPanel() {
+ JPanel result = new JPanel();
+ result.setLayout(new BorderLayout());
+ result.add(new JLabel("Possible services"), NORTH);
+ includableList.setModel(new DefaultComboBoxModel<>(new Vector<>(
+ includableProcessors)));
+ includableList.setCellRenderer(processorRenderer);
+ result.add(new JScrollPane(includableList), CENTER);
+
+ includeButton = new DeselectingButton("Include", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ includedProcessors.addAll(includableList
+ .getSelectedValuesList());
+ calculateIncludableProcessors();
+ updateLists();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout());
+ buttonPanel.add(includeButton);
+ result.add(buttonPanel, SOUTH);
+ return result;
+ }
+
+ private void resetLists() {
+ includedProcessors.clear();
+ updateLists();
+ }
+
+ private JPanel createIncludedProcessorsPanel() {
+ JPanel result = new JPanel();
+ result.setLayout(new BorderLayout());
+ result.add(new JLabel("Included services"), NORTH);
+ includedList.setModel(new DefaultComboBoxModel<>(new Vector<>(
+ includedProcessors)));
+ includedList.setCellRenderer(processorRenderer);
+ result.add(new JScrollPane(includedList), CENTER);
+
+ excludeButton = new DeselectingButton("Exclude", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ includedProcessors.removeAll(includedList
+ .getSelectedValuesList());
+ calculateIncludableProcessors();
+ updateLists();
+ }
+ });
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new FlowLayout());
+ buttonPanel.add(excludeButton);
+
+ result.add(buttonPanel, SOUTH);
+ return result;
+ }
+
+ private void updateLists() {
+ calculateIncludableProcessors();
+ sort(includedProcessors, processorComparator);
+ sort(includableProcessors, processorComparator);
+ includedList.setModel(new DefaultComboBoxModel<>(new Vector<>(
+ includedProcessors)));
+ includableList.setModel(new DefaultComboBoxModel<>(new Vector<>(
+ includableProcessors)));
+ boolean someIncludedProcessors = includedProcessors.size() > 0;
+ excludeButton.setEnabled(someIncludedProcessors);
+ okButton.setEnabled(someIncludedProcessors);
+ resetButton.setEnabled(someIncludedProcessors);
+ boolean someIncludableProcessors = includableProcessors.size() > 0;
+ includeButton.setEnabled(someIncludableProcessors);
+ }
+
+ public void calculateIncludableProcessors() {
+ includableProcessors.clear();
+ if (includedProcessors.isEmpty())
+ includableProcessors.addAll(allProcessors);
+ else
+ for (Processor p : includedProcessors) {
+ considerNearestUpstream(p);
+ considerNearestDownstream(p);
+ }
+ sort(includableProcessors, processorComparator);
+ }
+
+ private void considerNearestDownstream(Processor investigate) {
+ for (BlockingControlLink condition : investigate.controlLinksWaitingFor())
+ considerInclusion(condition.getBlock());
+
+ for (OutputProcessorPort outputPort : investigate.getOutputPorts())
+ for (DataLink datalink : outputPort.getDatalinksFrom()) {
+ ReceiverPort sink = datalink.getSendsTo();
+ if (sink instanceof InputProcessorPort)
+ considerInclusion(((InputProcessorPort) sink).getParent());
+ }
+ }
+
+ private void considerNearestUpstream(Processor investigate) {
+ for (BlockingControlLink condition : investigate.controlLinksBlocking())
+ considerInclusion(condition.getUntilFinished());
+ for (InputProcessorPort inputPort : investigate.getInputPorts())
+ for (DataLink incomingLink : inputPort.getDatalinksTo()) {
+ if (incomingLink == null)
+ continue;
+ SenderPort source = incomingLink.getReceivesFrom();
+ if (source instanceof OutputProcessorPort)
+ considerInclusion(((OutputProcessorPort) source).getParent());
+ }
+ }
+
+ private void considerInclusion(Processor p) {
+ if (!includedProcessors.contains(p)
+ && !includableProcessors.contains(p))
+ includableProcessors.add(p);
+ }
+
+ private void createNestedWorkflow() {
+ final List<Edit<?>> currentWorkflowEditList = new ArrayList<>();
+ Map<Object, Object> oldNewMapping = new HashMap<>();
+ Map<DataLink, String> linkProcessorPortMapping = new HashMap<>();
+ Map<SenderPort, OutputWorkflowPort> outputPortMap = new HashMap<>();
+ Map<ReceiverPort, InputWorkflowPort> inputPortMap = new HashMap<>();
+
+ Profile profile;//FIXME
+ Processor nestingProcessor = createNestingProcessor(currentWorkflowEditList);
+ Workflow nestedDataflow = createNestedDataflow();
+
+ transferProcessors(currentWorkflowEditList, oldNewMapping,
+ nestedDataflow);
+ transferDatalinks(oldNewMapping, linkProcessorPortMapping,
+ outputPortMap, inputPortMap, nestedDataflow);
+ transferConditions(currentWorkflowEditList, oldNewMapping,
+ nestingProcessor);
+ addDataflowToNestingProcessor(nestingProcessor, nestedDataflow, profile);
+ currentWorkflowEditList.add(new AddChildEdit<>(currentDataflow,
+ nestingProcessor));
+ createDatalinkEdits(currentWorkflowEditList, oldNewMapping,
+ linkProcessorPortMapping, nestingProcessor);
+
+ try {
+ GraphController gc = graphView.getGraphController(currentDataflow);
+ gc.setExpandNestedDataflow(nestingProcessor.getActivity(profile), true);
+ em.doDataflowEdit(currentDataflow.getParent(), new CompoundEdit(
+ currentWorkflowEditList));
+ gc.redraw();
+ } catch (EditException e1) {
+ logger.error("failed to manufacture nested workflow", e1);
+ }
+ }
+
+ private void addDataflowToNestingProcessor(Processor nestingProcessor,
+ Workflow nestedDataflow, Profile profile) {
+ Activity da = new Activity();
+ da.setParent(profile);
+ da.createConfiguration(NESTED_WORKFLOW).getJsonAsObjectNode()
+ .put("nestedWorkflow", nestedDataflow.getName());
+ try {
+ new AddActivityEdit(nestingProcessor, da).doEdit();
+ new SetIterationStrategyStackEdit(nestingProcessor, null/*FIXME*/).doEdit();
+ for (InputActivityPort aip : da.getInputPorts()) {
+ InputProcessorPort pip = new InputProcessorPort();
+ pip.setName(aip.getName());
+ pip.setDepth(aip.getDepth());
+ new AddProcessorInputPortEdit(nestingProcessor, pip).doEdit();
+ new AddActivityInputPortMappingEdit(da, pip, aip).doEdit();
+ }
+ for (OutputActivityPort aop : da.getOutputPorts()) {
+ OutputProcessorPort pop = new OutputProcessorPort();
+ pop.setName(aop.getName());
+ pop.setDepth(aop.getDepth());
+ pop.setGranularDepth(aop.getGranularDepth());
+ new AddProcessorOutputPortEdit(nestingProcessor, pop).doEdit();
+ new AddActivityOutputPortMappingEdit(da, pop, aop).doEdit();
+ }
+ } catch (EditException e1) {
+ logger.error("failed to add ports to processor", e1);
+ }
+ }
+
+ private void createDatalinkEdits(List<Edit<?>> editList,
+ Map<Object, Object> oldNewMapping,
+ Map<DataLink, String> linkProcessorPortMapping,
+ Processor nestingProcessor) {
+ for (DataLink dl : currentDataflow.getDataLinks())
+ if (oldNewMapping.containsKey(dl.getReceivesFrom())
+ && oldNewMapping.containsKey(dl.getSendsTo()))
+ // Internal to nested workflow
+ editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
+ else if (oldNewMapping.containsKey(dl.getReceivesFrom())) {
+ // Coming out of nested workflow
+ OutputProcessorPort nestedPort = nestingProcessor
+ .getOutputPorts().getByName(
+ linkProcessorPortMapping.get(dl));
+ if (nestedPort != null) {
+ DataLink replacementDatalink = new DataLink(nestedPort
+ .getParent().getParent(), nestedPort,
+ dl.getSendsTo());
+ editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
+ editList.add(new AddDataLinkEdit(nestedPort.getParent()
+ .getParent(), replacementDatalink));
+ }
+ } else if (oldNewMapping.containsKey(dl.getSendsTo())) {
+ // Coming into nested workflow
+ InputProcessorPort nestedPort = nestingProcessor
+ .getInputPorts().getByName(
+ linkProcessorPortMapping.get(dl));
+ if (nestedPort != null) {
+ DataLink replacementDatalink = new DataLink(nestedPort
+ .getParent().getParent(), dl.getReceivesFrom(),
+ nestedPort);
+ editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
+ editList.add(new AddDataLinkEdit(nestedPort.getParent()
+ .getParent(), replacementDatalink));
+ }
+ }
+ }
+
+ private void transferConditions(List<Edit<?>> editList,
+ Map<Object, Object> oldNewMapping, Processor nestingProcessor) {
+ for (Processor p : currentDataflow.getProcessors()) {
+ boolean isTargetMoved = oldNewMapping.containsKey(p);
+ for (BlockingControlLink c : p.controlLinksWaitingFor()) {
+ Processor pre = c.getUntilFinished();
+ boolean isControlMoved = oldNewMapping.containsKey(pre);
+ if (isTargetMoved && isControlMoved) {
+ // Add in new condition
+ new BlockingControlLink(
+ (Processor) oldNewMapping.get(pre),
+ (Processor) oldNewMapping.get(p));
+ } else if (isTargetMoved) {
+ editList.add(new RemoveChildEdit<>(c.getParent(),c));
+ editList.add(new AddChildEdit<>(c.getParent(),
+ new BlockingControlLink(pre, nestingProcessor)));
+ } else if (isControlMoved) {
+ editList.add(new RemoveChildEdit<>(c.getParent(), c));
+ editList.add(new AddChildEdit<>(c.getParent(),
+ new BlockingControlLink(nestingProcessor, p)));
+ }
+ }
+ }
+ }
+
+ private void transferDatalinks(Map<Object, Object> oldNewMapping,
+ Map<DataLink, String> linkProcessorPortMapping,
+ Map<SenderPort, OutputWorkflowPort> outputPortMap,
+ Map<ReceiverPort, InputWorkflowPort> inputPortMap,
+ Workflow nestedDataflow) {
+ NamedSet<InputWorkflowPort> inputPorts = new NamedSet<>();
+ NamedSet<OutputWorkflowPort> outputPorts = new NamedSet<>();
+
+ for (DataLink dl : currentDataflow.getDataLinks()) {
+ final SenderPort datalinkSource = dl.getReceivesFrom();
+ final ReceiverPort datalinkSink = dl.getSendsTo();
+ if (oldNewMapping.containsKey(datalinkSource)
+ && oldNewMapping.containsKey(datalinkSink)) {
+ // Internal to nested workflow
+ DataLink newDatalink = new DataLink(null,
+ (SenderPort) oldNewMapping.get(datalinkSource),
+ (ReceiverPort) oldNewMapping.get(datalinkSink));
+ try {
+ new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
+ } catch (EditException e1) {
+ logger.error("failed to connect datalink", e1);
+ }
+ } else if (oldNewMapping.containsKey(datalinkSource)) {
+ OutputWorkflowPort dop = null;
+ if (!outputPortMap.containsKey(datalinkSource)) {
+ dop = new OutputWorkflowPort(nestedDataflow, uniqueName(
+ datalinkSource.getName(), outputPorts));
+ outputPorts.add(dop);
+ outputPortMap.put(datalinkSource, dop);
+ } else
+ dop = outputPortMap.get(datalinkSource);
+ String portName = dop.getName();
+ // Coming out of nested workflow
+ linkProcessorPortMapping.put(dl, portName);
+ try {
+ new AddWorkflowOutputPortEdit(nestedDataflow, dop).doEdit();
+ DataLink newDatalink = new DataLink(
+ (SenderPort) oldNewMapping.get(datalinkSource),
+ dop.getInternalInputPort());
+ new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
+ } catch (EditException e1) {
+ logger.error("failed to add dataflow output", e1);
+ }
+ } else if (oldNewMapping.containsKey(datalinkSink)) {
+ InputWorkflowPort dip = null;
+ if (!inputPortMap.containsKey(datalinkSink)) {
+ dip = new InputWorkflowPort(nestedDataflow, uniqueName(
+ datalinkSink.getName(), inputPorts));
+ inputPorts.add(dip);
+ dip.setDepth(dl.getResolvedDepth());
+ inputPortMap.put(datalinkSink, dip);
+ } else
+ dip = inputPortMap.get(datalinkSink);
+ String portName = dip.getName();
+ // Coming into nested workflow
+ linkProcessorPortMapping.put(dl, portName);
+ try {
+ new AddWorkflowInputPortEdit(nestedDataflow, dip).doEdit();
+ DataLink newDatalink = new DataLink(
+ dip.getInternalOutputPort(),
+ (ReceiverPort) oldNewMapping.get(datalinkSink));
+ new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
+ } catch (EditException e1) {
+ logger.error("failed to add dataflow input", e1);
+ }
+ }
+ }
+ }
+
+ private void transferProcessors(List<Edit<?>> editList,
+ Map<Object, Object> oldNewMapping, Workflow nestedDataflow) {
+ for (Processor entity : includedProcessors)
+ try {
+ if (entity instanceof Processor)
+ transferProcessor(editList, oldNewMapping, nestedDataflow,
+ (Processor) entity);
+ /*else if (entity instanceof Merge)
+ //FIXME what to do here? Anything?
+ transferMerge(editList, oldNewMapping, nestedDataflow,
+ (Merge) entity);*/
+ } catch (Exception e1) {
+ logger.error("failed to transfer processor", e1);
+ }
+ }
+
+ /*private void transferMerge(List<Edit<?>> editList,
+ Map<Object, Object> oldNewMapping, Workflow nestedDataflow,
+ Merge merge) throws EditException {
+ editList.add(edits.getRemoveMergeEdit(currentDataflow, merge));
+ Merge newMerge = edits.createMerge(nestedDataflow);
+ edits.getAddMergeEdit(nestedDataflow, newMerge).doEdit();
+ oldNewMapping.put(merge, newMerge);
+ for (MergeInputPort mip : merge.getInputPorts()) {
+ MergeInputPort newMip = edits.createMergeInputPort(newMerge,
+ mip.getName(), mip.getDepth());
+ edits.getAddMergeInputPortEdit(newMerge, newMip).doEdit();
+ oldNewMapping.put(mip, newMip);
+ }
+ oldNewMapping.put(merge.getOutputPort(), newMerge.getOutputPort());
+ }*/
+
+ private void transferProcessor(List<Edit<?>> editList,
+ Map<Object, Object> oldNewMapping, Workflow nestedDataflow,
+ Processor p) throws Exception {
+ editList.add(new RemoveChildEdit<>(currentDataflow, p));
+ Processor newProcessor = (Processor) p.clone();
+ newProcessor.setParent(nestedDataflow);
+ oldNewMapping.put(p, newProcessor);
+ for (InputProcessorPort pip : p.getInputPorts())
+ for (InputProcessorPort newPip : newProcessor.getInputPorts())
+ if (pip.getName().equals(newPip.getName())) {
+ oldNewMapping.put(pip, newPip);
+ break;
+ }
+ for (OutputProcessorPort pop : p.getOutputPorts())
+ for (OutputProcessorPort newPop : newProcessor.getOutputPorts())
+ if (pop.getName().equals(newPop.getName())) {
+ oldNewMapping.put(pop, newPop);
+ break;
+ }
+ }
+
+ private Processor createNestingProcessor(List<Edit<?>> editList) {
+ //TODO check what workflow the new processor is going into
+ Processor nestingProcessor = new Processor(currentDataflow, uniqueName(
+ nameField.getText(), currentDataflow.getProcessors()));
+ if (includedProcessors.size() != 1)
+ return nestingProcessor;
+ Processor includedProcessor = includedProcessors.get(0);
+ for (Annotation a: includedProcessor.getAnnotations()) {
+ Annotation newAnn = (Annotation) a.clone();
+ newAnn.setTarget(nestingProcessor);
+ editList.add(new AddChildEdit<>(a.getParent(), newAnn));
+ }
+ return nestingProcessor;
+ }
+
+ private Workflow createNestedDataflow() {
+ Workflow nestedDataflow = new Workflow(uniqueName(nameField.getText(),
+ currentDataflow.getParent().getWorkflows()));
+ // Set the title of the nested workflow to the name suggested by the user
+ try {
+ new AnnotationTools().setAnnotationString(nestedDataflow,
+ DescriptiveTitle.class, nameField.getText()).doEdit();
+ } catch (EditException ex) {
+ logger.error("failed to put annotation on nested dataflow", ex);
+ }
+ return nestedDataflow;
+ }
+
+ private final class OKAction extends AbstractAction {
+ private static final long serialVersionUID = 6516891432445682857L;
+ private final JDialog dialog;
+
+ private OKAction(JDialog dialog) {
+ super("OK");
+ this.dialog = dialog;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (includedProcessors.isEmpty()) {
+ showMessageDialog(
+ null,
+ "At least one service must be included in the nested workflow",
+ "Nested workflow creation", WARNING_MESSAGE);
+ return;
+ }
+
+ createNestedWorkflow();
+ dialog.setVisible(false);
+ }
+ }
+
+ private final class ResetAction extends AbstractAction {
+ private static final long serialVersionUID = 7296742769289881218L;
+
+ private ResetAction(JDialog dialog) {
+ super("Reset");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ resetLists();
+ }
+ }
+
+ private final class CancelAction extends AbstractAction {
+ private static final long serialVersionUID = -7842176979437027091L;
+ private final JDialog dialog;
+
+ private CancelAction(JDialog dialog) {
+ super("Cancel");
+ this.dialog = dialog;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dialog.setVisible(false);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreatorMenuAction.java
new file mode 100644
index 0000000..0cdb2ba
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/NestedWorkflowCreatorMenuAction.java
@@ -0,0 +1,94 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import java.awt.Dialog;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class NestedWorkflowCreatorMenuAction extends
+ AbstractContextualMenuAction {
+ private static final URI configureSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/configure");
+
+ private SelectionManager sm;
+ private EditManager em;
+ private GraphViewComponent gv;
+
+ public NestedWorkflowCreatorMenuAction() {
+ super(configureSection, 70);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ em = editManager;
+ }
+ public void setGraphView(GraphViewComponent graphView) {
+ gv = graphView;
+ }
+ public void setSelectionManager(SelectionManager selectionManager) {
+ sm = selectionManager;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ Object selection = getContextualSelection().getSelection();
+ if (!super.isEnabled() || selection == null)
+ return false;
+ if (selection instanceof Processor)
+ return true;
+ if (!(selection instanceof Workflow))
+ return false;
+ return !((Workflow) selection).getProcessors().isEmpty();
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AbstractAction("Create nested workflow...",
+ DataflowActivityIcon.getDataflowIcon()) {
+ private static final long serialVersionUID = -3121307982540205215L;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ createNestedWorkflow();
+ }
+ };
+ }
+
+ private void createNestedWorkflow() {
+ Dialog dialog = new NestedWorkflowCreationDialog(null,
+ getContextualSelection().getSelection(),
+ sm.getSelectedWorkflow(), em, gv);
+ dialog.setVisible(true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityAction.java
new file mode 100644
index 0000000..2bce63a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityAction.java
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+import java.net.MalformedURLException;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class OpenComponentFromComponentActivityAction extends ComponentAction {
+ private static Logger logger = getLogger(OpenComponentFromComponentActivityAction.class);
+
+ private final FileManager fileManager;
+ private final ComponentFactory factory;
+ private final FileType fileType;
+
+ public OpenComponentFromComponentActivityAction(FileManager fileManager,
+ ComponentFactory factory, FileType ft,
+ GraphViewComponent graphView, ComponentServiceIcon icon) {
+ super("Open component...", graphView);
+ this.fileManager = fileManager;
+ this.factory = factory;
+ this.fileType = ft;
+ setIcon(icon);
+ }
+
+ private Activity selection;
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ try {
+ Version.ID ident = new ComponentActivityConfigurationBean(
+ selection.getConfiguration(), factory);
+ WorkflowBundle d = fileManager.openDataflow(fileType, ident);
+ markGraphAsBelongingToComponent(d);
+ } catch (OpenException e) {
+ logger.error("failed to open component", e);
+ } catch (MalformedURLException e) {
+ logger.error("bad URL in component description", e);
+ }
+ }
+
+ public void setSelection(Activity selection) {
+ this.selection = selection;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
new file mode 100644
index 0000000..6f28816
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
@@ -0,0 +1,104 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class OpenComponentFromComponentActivityMenuAction extends
+ AbstractContextualMenuAction {
+ private static final URI configureSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/configure");
+
+ private SelectionManager sm;
+ private FileManager fileManager;
+ private ComponentFactory factory;
+ private FileType fileType;
+ private GraphViewComponent graphView;
+ private ComponentServiceIcon icon;
+
+ public OpenComponentFromComponentActivityMenuAction() {
+ super(configureSection, 75);
+ }
+
+ public void setSelectionManager(SelectionManager sm) {
+ this.sm = sm;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileType(FileType fileType) {
+ this.fileType = fileType;
+ }
+
+ public void setGraphView(GraphViewComponent graphView) {
+ this.graphView = graphView;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return getSelectedActivity() != null;
+ }
+
+ @Override
+ protected Action createAction() {
+ OpenComponentFromComponentActivityAction action = new OpenComponentFromComponentActivityAction(
+ fileManager, factory, fileType, graphView, icon);
+ action.setSelection(getSelectedActivity());
+ return action;
+ }
+
+ private Activity getSelectedActivity() {
+ Object selection = getContextualSelection().getSelection();
+ if (!super.isEnabled() || !(selection instanceof Processor))
+ return null;
+
+ try {
+ return ((Processor) selection).getActivity(sm.getSelectedProfile());
+ } catch (RuntimeException e) {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentAction.java
new file mode 100644
index 0000000..ebb51a8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentAction.java
@@ -0,0 +1,275 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean.ignorableNames;
+import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+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.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddActivityEdit;
+import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
+import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
+import org.apache.taverna.workflow.edits.RemoveActivityEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+/**
+ * @author alanrw
+ */
+public class ReplaceByComponentAction extends AbstractAction {
+ private static final long serialVersionUID = 7364648399658711574L;
+
+ private final EditManager em;
+ private final ComponentPreference prefs;
+ private final SelectionManager sm;
+ private final ComponentFactory factory;
+ private final Scufl2Tools tools = new Scufl2Tools();
+
+ private Processor selection;
+
+ public ReplaceByComponentAction(ComponentPreference prefs,
+ ComponentFactory factory, EditManager em, SelectionManager sm,
+ ComponentServiceIcon icon) {
+ super("Replace by component...", icon.getIcon());
+ this.prefs = prefs;
+ this.em = em;
+ this.sm = sm;
+ this.factory = factory;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JPanel overallPanel = new JPanel(new BorderLayout());
+ ComponentChooserPanel panel = new ComponentChooserPanel(prefs);
+ overallPanel.add(panel, CENTER);
+ JPanel checkBoxPanel = new JPanel(new FlowLayout());
+ JCheckBox replaceAllCheckBox = new JCheckBox(
+ "Replace all matching services");
+ checkBoxPanel.add(replaceAllCheckBox);
+ checkBoxPanel.add(new JSeparator());
+ JCheckBox renameServicesCheckBox = new JCheckBox("Rename service(s)");
+ checkBoxPanel.add(renameServicesCheckBox);
+ renameServicesCheckBox.setSelected(true);
+ overallPanel.add(checkBoxPanel, SOUTH);
+ int answer = showConfirmDialog(null, overallPanel, "Component choice",
+ OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doReplace(panel.getChosenRegistry(), panel.getChosenFamily(),
+ replaceAllCheckBox.isSelected(),
+ renameServicesCheckBox.isSelected(),
+ panel.getChosenComponent());
+ }
+
+ private void doReplace(Registry chosenRegistry, Family chosenFamily,
+ boolean replaceAll, boolean rename, Component chosenComponent) {
+ Version chosenVersion = chosenComponent.getComponentVersionMap().get(
+ chosenComponent.getComponentVersionMap().lastKey());
+ Version.ID ident = new Version.Identifier(
+ chosenRegistry.getRegistryBase(), chosenFamily.getName(),
+ chosenComponent.getName(), chosenVersion.getVersionNumber());
+
+ ComponentActivityConfigurationBean cacb = new ComponentActivityConfigurationBean(
+ ident, factory);
+
+ try {
+ if (replaceAll) {
+ Activity baseActivity = selection.getActivity(sm
+ .getSelectedProfile());
+ URI activityType = baseActivity.getType();
+ String configString = getConfigString(baseActivity);
+
+ replaceAllMatchingActivities(activityType, cacb, configString,
+ rename, sm.getSelectedWorkflow());
+ } else
+ replaceActivity(cacb, selection, rename,
+ sm.getSelectedWorkflow());
+ } catch (Exception e) {
+ showMessageDialog(
+ null,
+ "Failed to replace nested workflow with component: "
+ + e.getMessage(), "Component Problem",
+ ERROR_MESSAGE);
+ }
+ }
+
+ private String getConfigString(Activity baseActivity) {
+ return baseActivity.getConfiguration().getJsonAsString();
+ }
+
+ private void replaceAllMatchingActivities(URI activityType,
+ ComponentActivityConfigurationBean cacb, String configString,
+ boolean rename, Workflow d) throws IntermediateException {
+ for (Processor p : d.getProcessors()) {
+ Activity a = p.getActivity(sm.getSelectedProfile());
+ if (a.getType().equals(activityType)
+ && getConfigString(a).equals(configString))
+ replaceActivity(cacb, p, rename, d);
+ else if (a.getType().equals(NESTED_WORKFLOW))
+ replaceAllMatchingActivities(activityType, cacb, configString,
+ rename,
+ tools.nestedWorkflowForProcessor(p, a.getParent()));
+ }
+ }
+
+ private void replaceActivity(ComponentActivityConfigurationBean cacb,
+ Processor p, boolean rename, Workflow d) throws IntermediateException {
+ final Activity originalActivity = p.getActivity(sm.getSelectedProfile());
+ final List<Edit<?>> currentWorkflowEditList = new ArrayList<>();
+
+ Activity replacementActivity = new Activity();
+ try {
+ URI configType;
+ replacementActivity.createConfiguration(configType);
+
+ replacementActivity.configure(cacb);
+ //FIXME
+ } catch (Exception e) {
+ throw new IntermediateException(
+ "Unable to configure component", e);
+ }
+ if (originalActivity.getInputPorts().size() != replacementActivity
+ .getInputPorts().size())
+ throw new IntermediateException(
+ "Component does not have matching ports", null);
+
+ int replacementOutputSize = replacementActivity.getOutputPorts().size();
+ int originalOutputSize = originalActivity.getOutputPorts().size();
+ for (String name : ignorableNames) {
+ if (originalActivity.getOutputPorts().getByName(name) != null)
+ originalOutputSize--;
+ if (replacementActivity.getOutputPorts().getByName(name) != null)
+ replacementOutputSize--;
+ }
+
+ int sizeDifference = replacementOutputSize - originalOutputSize;
+ if (sizeDifference != 0)
+ throw new IntermediateException(
+ "Component does not have matching ports", null);
+
+ for (InputActivityPort aip : originalActivity.getInputPorts()) {
+ String aipName = aip.getName();
+ int aipDepth = aip.getDepth();
+ InputActivityPort caip = replacementActivity.getInputPorts().getByName(aipName);
+ if ((caip == null) || (caip.getDepth() != aipDepth))
+ throw new RuntimeException("Original input port "
+ + aipName + " is not matched");
+ }
+ for (OutputActivityPort aop : originalActivity.getOutputPorts()) {
+ String aopName = aop.getName();
+ int aopDepth = aop.getDepth();
+ OutputActivityPort caop = replacementActivity.getOutputPorts().getByName(aopName);
+ if ((caop == null || aopDepth != caop.getDepth())
+ && !ignorableNames.contains(aopName))
+ throw new IntermediateException(
+ "Original output port " + aopName + " is not matched", null);
+ }
+
+ for (InputProcessorPort pip : p.getInputPorts()) {
+ InputActivityPort iap = replacementActivity.getInputPorts()
+ .getByName(pip.getName());
+ if (iap == null)
+ iap = new InputActivityPort(replacementActivity, pip.getName());
+ currentWorkflowEditList.add(new AddActivityInputPortMappingEdit(
+ replacementActivity, pip, iap));
+ }
+
+ for (OutputProcessorPort pop : p.getOutputPorts()) {
+ OutputActivityPort oap = replacementActivity.getOutputPorts()
+ .getByName(pop.getName());
+ if (oap == null)
+ oap = new OutputActivityPort(replacementActivity, pop.getName());
+ currentWorkflowEditList.add(new AddActivityOutputPortMappingEdit(
+ replacementActivity, pop, oap));
+ }
+
+ currentWorkflowEditList
+ .add(new AddActivityEdit(p, replacementActivity));
+ currentWorkflowEditList
+ .add(new RemoveActivityEdit(p, originalActivity));
+
+ if (rename) {
+ String possibleName = replacementActivity.getConfiguration()
+ .getJsonAsObjectNode().get(COMPONENT_NAME).textValue();
+ currentWorkflowEditList.add(new RenameEdit<>(p, uniqueName(
+ possibleName, d.getProcessors())));
+ }
+ try {
+ em.doDataflowEdit(d.getParent(), new CompoundEdit(
+ currentWorkflowEditList));
+ } catch (EditException e) {
+ throw new IntermediateException(
+ "Unable to replace with component", e);
+ }
+ }
+
+ public void setSelection(Processor selection) {
+ this.selection = selection;
+ }
+
+ @SuppressWarnings("serial")
+ private static class IntermediateException extends Exception {
+ IntermediateException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentMenuAction.java
new file mode 100644
index 0000000..470ad40
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ReplaceByComponentMenuAction.java
@@ -0,0 +1,87 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+/**
+ * @author alanrw
+ */
+public class ReplaceByComponentMenuAction extends AbstractContextualMenuAction {
+ private static final URI configureSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/configure");
+
+ private ComponentPreference preferences;
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+ private ComponentFactory factory;
+ private ComponentServiceIcon icon;
+
+ public ReplaceByComponentMenuAction() {
+ super(configureSection, 75);
+ }
+
+ public void setPreferences(ComponentPreference preferences) {
+ this.preferences = preferences;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ Object selection = getContextualSelection().getSelection();
+ if (!super.isEnabled())
+ return false;
+ return (selection instanceof Processor);
+ }
+
+ @Override
+ protected Action createAction() {
+ ReplaceByComponentAction action = new ReplaceByComponentAction(
+ preferences, factory, editManager, selectionManager, icon);
+ action.setSelection((Processor) getContextualSelection().getSelection());
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/AbstractComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/AbstractComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/AbstractComponentMenuAction.java
new file mode 100644
index 0000000..671e190
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/AbstractComponentMenuAction.java
@@ -0,0 +1,31 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+abstract class AbstractComponentMenuAction extends AbstractMenuAction {
+ public AbstractComponentMenuAction(int positionHint, URI id) {
+ super(COMPONENT_SECTION, positionHint, id);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseAction.java
new file mode 100644
index 0000000..da22a60
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseAction.java
@@ -0,0 +1,73 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.component;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+
+/**
+ * @author alanrw
+ */
+public class ComponentCloseAction extends AbstractAction implements
+ Observer<FileManagerEvent> {
+ private static final long serialVersionUID = -153986599735293879L;
+ private static final String CLOSE_COMPONENT = "Close component";
+ @SuppressWarnings("unused")
+ private static Logger logger = getLogger(ComponentCloseAction.class);
+
+ private Action closeAction;
+ private final Utils utils;
+
+ public ComponentCloseAction(Action closeWorkflowAction, FileManager fm,
+ ComponentServiceIcon icon, Utils utils) {
+ super(CLOSE_COMPONENT, icon.getIcon());
+ closeAction = closeWorkflowAction;
+ this.utils = utils;
+ fm.addObserver(this);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ closeAction.actionPerformed(arg0);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return utils.currentDataflowIsComponent();
+ }
+
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ setEnabled(utils.currentDataflowIsComponent());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseMenuAction.java
new file mode 100644
index 0000000..6c40a5f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCloseMenuAction.java
@@ -0,0 +1,66 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentCloseMenuAction extends AbstractComponentMenuAction {
+ private static final URI CLOSE_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentClose");
+
+ private Action action;
+ private FileManager fm;
+ private ComponentServiceIcon icon;
+ private Utils utils;
+
+ public ComponentCloseMenuAction() {
+ super(1000, CLOSE_COMPONENT_URI);
+ }
+
+ public void setCloseWorkflowAction(Action action) {
+ this.action = action;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentCloseAction(action, fm, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyAction.java
new file mode 100644
index 0000000..676a6c9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyAction.java
@@ -0,0 +1,164 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.border.TitledBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class ComponentCopyAction extends AbstractAction {
+ private static final long serialVersionUID = -4440978712410081685L;
+ private static final Logger logger = getLogger(ComponentCopyAction.class);
+ private static final String COPY_COMPONENT = "Copy component...";
+
+ private final ComponentPreference prefs;
+ private final Utils utils;
+
+ public ComponentCopyAction(ComponentPreference pref, ComponentServiceIcon icon, Utils utils) {
+ super(COPY_COMPONENT, icon.getIcon());
+ this.prefs = pref;
+ this.utils = utils;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ JPanel overallPanel = new JPanel();
+ overallPanel.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ ComponentChooserPanel source = new ComponentChooserPanel(prefs);
+ source.setBorder(new TitledBorder("Source component"));
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(source, gbc);
+
+ final RegistryAndFamilyChooserPanel target = new RegistryAndFamilyChooserPanel(prefs);
+ target.setBorder(new TitledBorder("Target family"));
+ gbc.gridy++;
+ overallPanel.add(target, gbc);
+
+ source.addObserver(new Observer<ComponentChoiceMessage>() {
+ @Override
+ public void notify(Observable<ComponentChoiceMessage> sender,
+ ComponentChoiceMessage message) throws Exception {
+ Profile componentProfile = null;
+ Family componentFamily = message.getComponentFamily();
+ if (componentFamily != null)
+ componentProfile = componentFamily.getComponentProfile();
+ ProfileChoiceMessage profileMessage = new ProfileChoiceMessage(
+ componentProfile);
+ target.notify(null, profileMessage);
+ }
+ });
+
+ int answer = showConfirmDialog(null, overallPanel, "Copy Component",
+ OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doCopy(source.getChosenComponent(), target.getChosenFamily());
+ }
+
+ private void doCopy(Component sourceComponent, Family targetFamily) {
+ if (sourceComponent == null) {
+ showMessageDialog(null, "Unable to determine source component",
+ "Component Copy Problem", ERROR_MESSAGE);
+ return;
+ } else if (targetFamily == null) {
+ showMessageDialog(null, "Unable to determine target family",
+ "Component Copy Problem", ERROR_MESSAGE);
+ return;
+ }
+
+ try {
+ String componentName = sourceComponent.getName();
+ boolean alreadyUsed = targetFamily.getComponent(componentName) != null;
+ if (alreadyUsed)
+ showMessageDialog(null, componentName + " is already used",
+ "Duplicate component name", ERROR_MESSAGE);
+ else {
+ Version targetVersion = doCopy(sourceComponent, targetFamily,
+ componentName);
+ try {
+ utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
+ targetVersion.getID()).getConfiguration());
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ } catch (ComponentException e) {
+ logger.error("failed to copy component", e);
+ showMessageDialog(null,
+ "Unable to create component: " + e.getMessage(),
+ "Component Copy Problem", ERROR_MESSAGE);
+ }
+ }
+
+ private Version doCopy(Component sourceComponent, Family targetFamily,
+ String componentName) throws ComponentException {
+ return targetFamily
+ .createComponentBasedOn(
+ componentName,
+ sourceComponent.getDescription(),
+ sourceComponent
+ .getComponentVersionMap()
+ .get(sourceComponent.getComponentVersionMap()
+ .lastKey()).getImplementation());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyMenuAction.java
new file mode 100644
index 0000000..3c6db63
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCopyMenuAction.java
@@ -0,0 +1,61 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+/**
+ * @author alanrw
+ */
+public class ComponentCopyMenuAction extends AbstractComponentMenuAction {
+ private static final URI COPY_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentCopy");
+
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+ private Utils utils;
+
+ public ComponentCopyMenuAction() {
+ super(800, COPY_COMPONENT_URI);
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {//FIXME beaninject
+ this.prefs = prefs;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentCopyAction(prefs, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCreatorSupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCreatorSupport.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCreatorSupport.java
new file mode 100644
index 0000000..ffe26d8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentCreatorSupport.java
@@ -0,0 +1,257 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddActivityEdit;
+import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
+import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
+import org.apache.taverna.workflow.edits.AddDataLinkEdit;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
+import org.apache.taverna.workflow.edits.RemoveActivityEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
+import org.apache.taverna.workflowmodel.processor.activity.NestedDataflow;
+import org.apache.taverna.workflowmodel.utils.Tools;
+
+public class ComponentCreatorSupport {
+ private static final Logger logger = getLogger(ComponentCreatorSupport.class);
+
+ private ComponentFactory factory;
+ private FileManager fm;
+ private EditManager em;
+ private ComponentPreference prefs;
+ private FileType ft;
+ private SelectionManager sm;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setPreferences(ComponentPreference pref) {
+ this.prefs = pref;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setEditManager(EditManager em) {
+ this.em = em;
+ }
+
+ public void setFileType(FileType ft) {
+ this.ft = ft;
+ }
+
+ public void setSelectionManager(SelectionManager sm) {
+ this.sm = sm;
+ }
+
+ public class CopiedProcessor {
+ Processor processor;
+ Map<String,Workflow> requiredSubworkflows;
+ }
+
+ void moveComponentActivityIntoPlace(Activity toReplace, Processor contextProcessor,
+ Activity replacingActivity) throws EditException {
+ List<Edit<?>> editsToDo = new ArrayList<>();
+ for (InputProcessorPort pip : contextProcessor.getInputPorts())
+ editsToDo.add(new AddActivityInputPortMappingEdit(toReplace, pip, null/*FIXME*/));
+ for (OutputProcessorPort pop : contextProcessor.getOutputPorts())
+ editsToDo.add(new AddActivityOutputPortMappingEdit(toReplace, pop, null/*FIXME*/));
+ editsToDo.add(new RemoveActivityEdit(contextProcessor, toReplace));
+ editsToDo.add(new AddActivityEdit(contextProcessor, replacingActivity));
+ em.doDataflowEdit(contextProcessor.getParent().getParent(),
+ new CompoundEdit(editsToDo));
+ }
+
+ void connectNewProcessor(Workflow d, Processor newProcessor)
+ throws EditException {
+ List<Edit<?>> editsToDo = new ArrayList<>();
+
+ for (InputProcessorPort pip : newProcessor.getInputPorts()) {
+ InputWorkflowPort dip = new InputWorkflowPort(d, pip.getName());
+ // FIXME How to set depth?
+ editsToDo.add(new AddWorkflowInputPortEdit(d, dip));
+ editsToDo.add(new AddDataLinkEdit(d, new DataLink(d, dip, pip)));
+ }
+
+ for (OutputProcessorPort pop : newProcessor.getOutputPorts()) {
+ OutputWorkflowPort dop = new OutputWorkflowPort(d, pop.getName());
+ // TODO How to indicate depth?
+ editsToDo.add(new AddWorkflowOutputPortEdit(d, dop));
+ editsToDo.add(new AddDataLinkEdit(d, new DataLink(d, pop, dop)));
+ }
+ em.doDataflowEdit(d.getParent(), new CompoundEdit(editsToDo));
+ }
+
+ public ComponentActivityConfigurationBean saveWorkflowAsComponent(
+ WorkflowBundle d, Version.ID ident) throws SaveException, IOException,
+ ComponentException {
+ if (ident == null)
+ return null;
+
+ createInitialComponent(d, ident);
+
+ Utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
+ ident));
+ return new ComponentActivityConfigurationBean(ident, factory);
+ }
+
+ public ComponentActivityConfigurationBean saveWorkflowAsComponent(
+ Workflow d, Version.ID ident) throws SaveException, IOException,
+ ComponentException {
+ WorkflowBundle b = new WorkflowBundle();
+ ((Workflow)d.clone()).setParent(b);
+ //FIXME also must copy profile parts!
+ return saveWorkflowAsComponent(b, ident);
+ }
+
+ Version.ID getNewComponentIdentification(String defaultName) {
+ RegistryAndFamilyChooserComponentEntryPanel panel = new RegistryAndFamilyChooserComponentEntryPanel(prefs);
+ panel.setComponentName(defaultName);
+ int result = showConfirmDialog(null, panel, "Component location",
+ OK_CANCEL_OPTION);
+ if (result != OK_OPTION)
+ return null;
+
+ Version.ID ident = panel.getComponentVersionIdentification();
+ if (ident == null) {
+ showMessageDialog(null,
+ "Not enough information to create component",
+ "Component creation problem", ERROR_MESSAGE);
+ return null;
+ }
+
+ try {
+ Component existingComponent = factory.getComponent(ident);
+ if (existingComponent != null) {
+ showMessageDialog(null,
+ "Component with this name already exists",
+ "Component creation problem", ERROR_MESSAGE);
+ return null;
+ }
+ } catch (ComponentException e) {
+ logger.error("failed to search registry", e);
+ showMessageDialog(null,
+ "Problem searching registry: " + e.getMessage(),
+ "Component creation problem", ERROR_MESSAGE);
+ return null;
+ }
+ return ident;
+ }
+
+ CopiedProcessor copyProcessor(Processor p) throws IOException {
+ CopiedProcessor copy = new CopiedProcessor();
+ copy.processor = ProcessorXMLSerializer.getInstance().processorToXML(p);
+ copy.requiredSubworkflows = new HashMap<>();
+ rememberSubworkflows(p, copy);
+ return copy;
+ }
+
+ void rememberSubworkflows(Processor p, CopiedProcessor copy) {
+ for (Activity a : p.getActivity(sm.getSelectedProfile()))
+ if (a instanceof NestedDataflow) {
+ NestedDataflow da = (NestedDataflow) a;
+ Workflow df = da.getNestedDataflow();
+ if (!copy.requiredSubworkflows.containsKey(df.getIdentifier())) {
+ copy.requiredSubworkflows.put(df.getIdentifier(),
+ DataflowXMLSerializer.getInstance()
+ .serializeDataflow(df));
+ for (Processor sp : df.getProcessors())
+ rememberSubworkflows(sp, copy);
+ }
+ }
+ }
+
+ public Processor pasteProcessor(CopiedProcessor copy, Workflow d)
+ throws
+ ClassNotFoundException, InstantiationException,
+ IllegalAccessException, EditException {
+ Processor result = ProcessorXMLDeserializer.getInstance()
+ .deserializeProcessor(copy.processor, copy.requiredSubworkflows);
+ if (result == null)
+ return null;
+
+ String newName = Tools.uniqueProcessorName(result.getName(), d);
+
+ List<Edit<?>> editList = new ArrayList<>();
+ if (!newName.equals(result.getName()))
+ editList.add(new RenameEdit<>(result, newName));
+ editList.add(new AddProcessorEdit(d, result));
+ em.doDataflowEdit(d.getParent(), new CompoundEdit(editList));
+
+ return result;
+ }
+
+ public Version.ID createInitialComponent(WorkflowBundle d, Version.ID ident)
+ throws ComponentException {
+ try {
+ fm.saveDataflow(d, ft, ident, false);
+
+ em.doDataflowEdit(d, new RenameEdit<>(d, d.getName()));
+ } catch (SaveException | IllegalStateException | EditException e) {
+ throw new ComponentException(e);
+ }
+ return ident;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteAction.java
new file mode 100644
index 0000000..72141c9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteAction.java
@@ -0,0 +1,143 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static java.lang.String.format;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.AbstractAction;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentDeleteAction extends AbstractAction {
+ private static final String COMPONENT_PROBLEM_TITLE = "Component Problem";
+ private static final String CONFIRM_MSG = "Are you sure you want to delete %s?";
+ private static final String CONFIRM_TITLE = "Delete Component Confirmation";
+ private static final String DELETE_COMPONENT_LABEL = "Delete component...";
+ private static final String DELETE_FAILED_TITLE = "Component Deletion Error";
+ private static final String FAILED_MSG = "Unable to delete %s: %s";
+ private static final String OPEN_COMPONENT_MSG = "The component is open";
+ private static final String TITLE = "Component choice";
+ private static final String WHAT_COMPONENT_MSG = "Unable to determine component";
+ private static final long serialVersionUID = -2992743162132614936L;
+ private static final Logger logger = getLogger(ComponentDeleteAction.class);
+
+ private final FileManager fm;
+ private final ComponentPreference prefs;
+ private final Utils utils;
+
+ public ComponentDeleteAction(FileManager fm, ComponentPreference prefs,
+ ComponentServiceIcon icon, Utils utils) {
+ super(DELETE_COMPONENT_LABEL, icon.getIcon());
+ this.fm = fm;
+ this.prefs = prefs;
+ this.utils = utils;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent evt) {
+ ComponentChooserPanel panel = new ComponentChooserPanel(prefs);
+ int answer = showConfirmDialog(null, panel, TITLE, OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doDelete(panel.getChosenComponent());
+ }
+
+ private void doDelete(final Component chosenComponent) {
+ if (chosenComponent == null) {
+ showMessageDialog(null, WHAT_COMPONENT_MSG,
+ COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE);
+ } else if (componentIsInUse(chosenComponent)) {
+ showMessageDialog(null, OPEN_COMPONENT_MSG,
+ COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE);
+ } else if (showConfirmDialog(null,
+ format(CONFIRM_MSG, chosenComponent.getName()), CONFIRM_TITLE,
+ YES_NO_OPTION) == YES_OPTION)
+ new SwingWorker<Configuration, Object>() {
+ @Override
+ protected Configuration doInBackground() throws Exception {
+ return deleteComponent(chosenComponent);
+ }
+
+ @Override
+ protected void done() {
+ refresh(chosenComponent, this);
+ }
+ }.execute();
+ }
+
+ private Configuration deleteComponent(Component component)
+ throws ComponentException {
+ ComponentServiceProviderConfig config = new ComponentServiceProviderConfig(
+ component.getFamily());
+ component.delete();
+ return config.getConfiguration();
+ }
+
+ protected void refresh(Component component,
+ SwingWorker<Configuration, Object> worker) {
+ try {
+ utils.refreshComponentServiceProvider(worker.get());
+ } catch (ExecutionException e) {
+ logger.error("failed to delete component", e.getCause());
+ showMessageDialog(
+ null,
+ format(FAILED_MSG, component.getName(), e.getCause()
+ .getMessage()), DELETE_FAILED_TITLE, ERROR_MESSAGE);
+ } catch (InterruptedException e) {
+ logger.warn("interrupted during component deletion", e);
+ }
+ }
+
+ private boolean componentIsInUse(Component component) {
+ for (WorkflowBundle d : fm.getOpenDataflows()) {
+ Object dataflowSource = fm.getDataflowSource(d);
+ if (dataflowSource instanceof Version.ID
+ && ((Version.ID) dataflowSource).mostlyEqualTo(component))
+ return true;
+ }
+ return false;
+ }
+}
[15/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
deleted file mode 100644
index a3585f4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.util;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor;
-import org.apache.taverna.visit.VisitKind;
-import org.apache.taverna.visit.VisitReport;
-
-public class ComponentHealthCheck extends VisitKind {
- public static final int NO_PROBLEM = 0;
- public static final int OUT_OF_DATE = 10;
- public static final int NON_SHAREABLE = 20;
- public static final int FAILS_PROFILE = 30;
- private static Logger logger = getLogger(ComponentHealthCheck.class);
- private static final String OUTDATED_MSG = "Component out of date";
-
- private ComponentFactory factory;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public List<Object> checkForOutdatedComponents(WorkflowBundle bundle) {
- UpgradeChecker uc = new UpgradeChecker();
- bundle.accept(uc);
- return uc.warnings;
- }
-
- private class UpgradeChecker extends DefaultDispatchingVisitor {
- ComponentFactory factory;
- List<Object> warnings = new ArrayList<>();
-
- @Override
- public void visitActivity(Activity activity) {
- ComponentActivityConfigurationBean config = new ComponentActivityConfigurationBean(
- activity.getConfiguration().getJson(), factory);
- Version v;
- try {
- v = config.getVersion();
- } catch (ComponentException e) {
- logger.error("failed to get component description", e);
- warnings.add(e);//FIXME Just putting the exception in here isn't good
- return;
- }
- visitComponent(activity, v);
- }
- protected void visitComponent(Activity activity, Version version) {
- int latest = version.getComponent().getComponentVersionMap().lastKey();
- if (latest > version.getVersionNumber())
- warnings.add(new VisitReport(ComponentHealthCheck.this,
- activity, OUTDATED_MSG, OUT_OF_DATE,
- VisitReport.Status.WARNING));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
deleted file mode 100644
index e81cbf6..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.util;
-
-import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
-import org.apache.taverna.workbench.file.FileManager;
-//import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-//import net.sf.taverna.t2.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class Utils {
- // From http://stackoverflow.com/questions/163360/regular-expresion-to-match-urls-in-java
- public static String URL_PATTERN = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
- public static final String LONG_STRING = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
- public static final String SHORT_STRING = "XXX";
-
- private FileManager fileManager;
- private ServiceDescriptionRegistry registry;
- private ComponentFactory factory;
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPrefs(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setRegistry(ServiceDescriptionRegistry registry) {
- this.registry = registry;
- }
-
- public void refreshComponentServiceProvider(Configuration config) {
- ComponentServiceProvider provider = new ComponentServiceProvider(
- factory, prefs, icon, this);
- provider.configure(config);
- registry.removeServiceDescriptionProvider(provider);
- registry.addServiceDescriptionProvider(provider);
- }
-
- public void removeComponentServiceProvider(Configuration config) {
- ComponentServiceProvider provider = new ComponentServiceProvider(
- factory, prefs, icon, this);
- provider.configure(config);
- registry.removeServiceDescriptionProvider(provider);
- }
-
- public boolean dataflowIsComponent(WorkflowBundle d) {
- if (d == null)
- return false;
- Object dataflowSource = fileManager.getDataflowSource(d);
- return dataflowSource instanceof Version.ID;// FIXME Really?
- }
-
- public boolean currentDataflowIsComponent() {
- return dataflowIsComponent(fileManager.getCurrentDataflow());
- }
-
- public static boolean isComponentActivity(Object obj) {
- if (obj == null || !(obj instanceof Activity))
- return false;
- Configuration cfg = ((Activity) obj).getConfiguration();
- return cfg != null && ACTIVITY_URI.equals(cfg.getType());
- }
-
- private static final Pattern SANITIZER_RE = Pattern
- .compile("[^a-zA-Z0-9]+");
- private static final Pattern SUFFIXED_RE = Pattern
- .compile("^(.+)_([0-9]+)$");
-
- /**
- * Pick a name that is unique within the context set. This is done by
- * appending "<tt>_<i>n</i></tt>" as necessary, where <tt><i>n</i></tt> is a
- * number.
- *
- * @param name
- * The suggested name; this is always checked first.
- * @param context
- * The set of things that the name will have to be unique within.
- * @return A name that is definitely not the name of anything in the given
- * set.
- */
- public static String uniqueName(String name, NamedSet<? extends Named> context) {
- String candidate = SANITIZER_RE.matcher(name).replaceAll("_");
- if (context.getByName(candidate) == null)
- return candidate;
- int counter = 0;
- String prefix = candidate;
- Matcher m = SUFFIXED_RE.matcher(candidate);
- if (m.matches()) {
- prefix = m.group(1);
- counter = Integer.parseInt(m.group(2));
- }
- do {
- candidate = prefix + "_" + (++counter);
- } while (context.getByName(candidate) != null);
- return candidate;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
deleted file mode 100644
index c27278f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
-
-import java.awt.Frame;
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.workbench.activityicons.ActivityIconManager;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-public class ComponentActivityContextViewFactory implements
- ContextualViewFactory<Activity> {
- private ColourManager colourManager;
- private ViewUtil util;
- private ComponentFactory factory;
- private ActivityIconManager aim;
- private ServiceDescriptionRegistry sdr;
- private EditManager em;
- private FileManager fm;
- private ServiceRegistry sr;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setColourManager(ColourManager colourManager) {
- this.colourManager = colourManager;
- }
-
- public void setViewUtils(ViewUtil util) {
- this.util = util;
- }
-
- public void setIconManager(ActivityIconManager aim) {
- this.aim = aim;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry sdr) {
- this.sdr = sdr;
- }
-
- public void setEditManager(EditManager em) {
- this.em = em;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setServiceTypeRegistry(ServiceRegistry sr) {
- this.sr = sr;
- }
-
- @Override
- public boolean canHandle(Object selection) {
- return selection instanceof Activity
- && ((Activity) selection).getType().equals(URI);
- }
-
- @Override
- public List<ContextualView> getViews(Activity selection) {
- return Arrays.<ContextualView>asList(new ComponentActivityContextualView(selection));
- }
-
- @SuppressWarnings("serial")
- private class ComponentActivityContextualView extends
- HTMLBasedActivityContextualView {
- public ComponentActivityContextualView(Activity activity) {
- super(activity, colourManager);
- init();
- }
-
- private void init() {
- }
-
- @Override
- public String getViewTitle() {
- return "Component service";
- }
-
- /**
- * View position hint
- */
- @Override
- public int getPreferredPosition() {
- // We want to be on top
- return 100;
- }
-
- @Override
- public Action getConfigureAction(Frame owner) {
- return new ComponentConfigureAction(getActivity(), owner, factory,
- aim, sdr, em, fm, sr);
- }
-
- @Override
- protected String getRawTableRowsHtml() {
- try {
- return util.getRawTablesHtml(getConfigBean());
- } catch (MalformedURLException e) {
- return "<tr><td>malformed URL: <pre>" + e.getMessage()
- + "</pre></td></tr>";
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
deleted file mode 100644
index fcb6e4a..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
-
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-import io.github.taverna_extras.component.ui.annotation.AbstractSemanticAnnotationContextualView;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-public class ComponentActivitySemanticAnnotationContextViewFactory implements
- ContextualViewFactory<Object> {
- public static final String VIEW_TITLE = "Inherited Semantic Annotations";
- private static final Logger logger = getLogger(ComponentActivitySemanticAnnotationContextViewFactory.class);
-
- private FileManager fm;
- private ComponentFactory factory;
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- @Override
- public boolean canHandle(Object selection) {
- return getContainingComponentActivity(selection) != null;
- }
-
- public Activity getContainingComponentActivity(Object selection) {
- if (selection instanceof Activity) {
- Activity a = (Activity) selection;
- if (a.getType().equals(URI))
- return a;
- }
- if (selection instanceof InputActivityPort
- || selection instanceof OutputActivityPort)
- return getContainingComponentActivity(((OutputActivityPort) selection)
- .getParent());
- return null;
- }
-
- @Override
- public List<ContextualView> getViews(Object selection) {
- return Arrays
- .<ContextualView> asList(new SemanticAnnotationCV(
- selection));
- }
-
- @SuppressWarnings("serial")
- private class SemanticAnnotationCV extends
- AbstractSemanticAnnotationContextualView {
- private Profile componentProfile;
-
- public SemanticAnnotationCV(Object selection) {
- super(fm, false);
- Activity componentActivity = getContainingComponentActivity(selection);
- try {
- ComponentActivityConfigurationBean configuration = new ComponentActivityConfigurationBean(
- componentActivity.getConfiguration(), factory);
- setAnnotatedThing(selection, configuration.getVersion()
- .getImplementation().getMainWorkflow());
- componentProfile = configuration.getComponent().getFamily()
- .getComponentProfile();
- setProfile(selection);
- super.initialise();
- } catch (ComponentException e) {
- logger.error("problem querying registry", e);
- } catch (MalformedURLException e) {
- logger.error("malformed URL in component description", e);
- }
- }
-
- private void setAnnotatedThing(Object selection,
- Workflow underlyingDataflow) {
- if (selection instanceof Activity) {
- setAnnotated(underlyingDataflow);
- } else if (selection instanceof InputActivityPort) {
- String name = ((Port) selection).getName();
- for (InputWorkflowPort dip : underlyingDataflow.getInputPorts())
- if (dip.getName().equals(name)) {
- setAnnotated(dip);
- break;
- }
- } else if (selection instanceof OutputActivityPort) {
- String name = ((Port) selection).getName();
- for (OutputWorkflowPort dop : underlyingDataflow
- .getOutputPorts())
- if (dop.getName().equals(name)) {
- setAnnotated(dop);
- break;
- }
- }
- }
-
- private void setProfile(Object selection) throws ComponentException {
- if (componentProfile == null)
- return;
- if (selection instanceof Activity) {
- setSemanticAnnotationProfiles(componentProfile
- .getSemanticAnnotations());
- } else if (selection instanceof InputActivityPort) {
- setSemanticAnnotationProfiles(componentProfile
- .getInputSemanticAnnotationProfiles());
- } else if (selection instanceof OutputActivityPort) {
- setSemanticAnnotationProfiles(componentProfile
- .getOutputSemanticAnnotationProfiles());
- }
- }
-
- @Override
- public String getViewTitle() {
- return VIEW_TITLE;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
deleted file mode 100644
index d3580a8..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static java.awt.Color.GRAY;
-import static java.awt.Color.WHITE;
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.EAST;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.SOUTHEAST;
-import static java.lang.String.format;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
-
-import java.awt.Component;
-import java.awt.Graphics;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.util.Set;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.border.AbstractBorder;
-import javax.swing.border.EmptyBorder;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.Statement;
-
-public class ComponentActivitySemanticAnnotationPanel extends JPanel {
- private static final long serialVersionUID = 3599768150252711758L;
- private static final String ANNTYPE_MSG = "Annotation type : %s";
- private static final String NONE_MSG = "No semantic annotations";
- private SemanticAnnotationProfile profile;
- private final Set<Statement> statements;
-
- public ComponentActivitySemanticAnnotationPanel(
- SemanticAnnotationProfile profile, Set<Statement> statements) {
- this.profile = profile;
- this.statements = statements;
- initialize();
- }
-
- private void initialize() {
- setLayout(new GridBagLayout());
- setBorder(new AbstractBorder() {
- private static final long serialVersionUID = -5921448975807056953L;
-
- @Override
- public void paintBorder(Component c, Graphics g, int x, int y,
- int width, int height) {
- g.setColor(GRAY);
- g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
- }
- });
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = SOUTHEAST;
- c.fill = BOTH;
- c.weightx = 1;
- c.gridx = 0;
-
- OntProperty predicate = profile.getPredicate();
- c.gridwidth = 2;
- JLabel label = new JLabel(format(ANNTYPE_MSG, getDisplayName(predicate)));
- label.setBorder(new EmptyBorder(5, 5, 5, 5));
- label.setBackground(WHITE);
- label.setOpaque(true);
- add(label, c);
-
- c.insets = new Insets(5, 7, 0, 0);
- c.anchor = EAST;
- c.fill = HORIZONTAL;
- if (statements.isEmpty()) {
- c.gridwidth = 2;
- // c.weightx = 1;
- // c.gridy++;
- add(new JLabel(NONE_MSG), c);
- } else {
- c.gridwidth = 1;
- for (Statement statement : statements) {
- c.gridx = 0;
- c.weightx = 1;
- JTextArea value = new JTextArea(getObjectName(statement));
- value.setBackground(WHITE);
- value.setOpaque(true);
- value.setBorder(new EmptyBorder(2, 4, 2, 4));
- add(value, c);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
deleted file mode 100644
index 938a32e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
-
-import java.util.Arrays;
-import java.util.List;
-
-import io.github.taverna_extras.component.api.Version;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-public class ComponentContextViewFactory implements
- ContextualViewFactory<WorkflowBundle> {
- private FileManager fileManager;
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- @Override
- public boolean canHandle(Object selection) {
- if (selection instanceof WorkflowBundle) {
- Object dataflowSource = fileManager
- .getDataflowSource((WorkflowBundle) selection);
- //FIXME Is this right?
- return dataflowSource instanceof Version.ID;
- }
- return selection instanceof Activity
- && ((Activity) selection).getType().equals(URI);
- }
-
- @Override
- public List<ContextualView> getViews(WorkflowBundle selection) {
- Object dataflowSource = fileManager.getDataflowSource(selection);
- return Arrays.<ContextualView> asList(new ComponentContextualView(
- (Version.ID) dataflowSource));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
deleted file mode 100644
index c763d06..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static java.lang.String.format;
-
-import java.awt.Color;
-
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-
-import io.github.taverna_extras.component.api.Version;
-import org.apache.taverna.lang.ui.HtmlUtils;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-
-@SuppressWarnings("serial")
-public class ComponentContextualView extends ContextualView {
- private JEditorPane editorPane;
- private final Version.ID component;
- ColourManager colourManager;//FIXME beaninject
- ViewUtil viewUtils;//FIXME beaninject;
-
- public ComponentContextualView(Version.ID component) {
- this.component = component;
- initView();
- }
-
- @Override
- public JComponent getMainFrame() {
- editorPane = HtmlUtils.createEditorPane(buildHtml());
- return HtmlUtils.panelForHtml(editorPane);
- }
-
- private String buildHtml() {
- StringBuilder html = new StringBuilder(HtmlUtils.getHtmlHead(getBackgroundColour()));
- html.append(HtmlUtils.buildTableOpeningTag());
- viewUtils.getRawTablesHtml(component, html);
- return html.append("</table></body></html>").toString();
- }
-
- public String getBackgroundColour() {
- Color colour = colourManager.getPreferredColour(
- "io.github.taverna_extras.component.registry.Component");
- return format("#%1$2x%2$2x%3$2x", colour.getRed(), colour.getGreen(),
- colour.getBlue());
- }
-
- @Override
- public int getPreferredPosition() {
- return 50;
- }
-
- private static int MAX_LENGTH = 50;
-
- private String limitName(String fullName) {
- if (fullName.length() > MAX_LENGTH)
- return fullName.substring(0, MAX_LENGTH - 3) + "...";
- return fullName;
- }
-
- @Override
- public String getViewTitle() {
- return "Component " + limitName(component.getComponentName());
- }
-
- @Override
- public void refreshView() {
- editorPane.setText(buildHtml());
- repaint();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
deleted file mode 100644
index 5764f6c..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.view;
-
-import static java.lang.String.format;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * @author alanrw
- */
-public class ViewUtil {
- private static Logger logger = getLogger(ViewUtil.class);
-
- private static final String VERSION_DESCRIPTION_LABEL = "Component version description";
- private static final String COMPONENT_DESCRIPTION_LABEL = "Component description";
- private static final String FAMILY_DESCRIPTION_LABEL = "Family description";
-
- private static final String plainFormat = "<tr><td><b>%1$s</b></td><td nowrap=\"wrap\" style=\"width:100px;\">%2$s</td></tr>";
- private static final String headerFormat = "<tr><th>%1$s</th><th>%2$s</th></tr>";
- private static final String rowFormat = "<tr><td><b>%1$s</b></td><td>%2$s</td></tr>";
- private static final String rowLinkFormat = "<tr><td><b>%1$s</b></td><td><a href=\"%3$s\">%2$s</a></td></tr>";
- private static final String descriptionFormat = "<tr><td colspan=\"2\"><b>%1$s</b></td></tr><tr><td colspan=\"2\" nowrap=\"wrap\" style=\"width:100px;\">%2$s</td></tr>";
-
- private ComponentFactory factory;//FIXME beaninject
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public String getRawTablesHtml(Version.ID id) {
- StringBuilder html = new StringBuilder();
- getRawTablesHtml(id, html);
- return html.toString();
- }
-
- public String getRawTablesHtml(Configuration config) throws MalformedURLException {
- StringBuilder html = new StringBuilder();
- getRawTablesHtml(
- new ComponentActivityConfigurationBean(
- config.getJsonAsObjectNode(), factory), html);
- return html.toString();
- }
-
- public void getRawTablesHtml(Version.ID id, StringBuilder html) {
- URL registryBase = id.getRegistryBase();
- String registryLink = null;
- if (registryBase.getProtocol().startsWith("http"))
- registryLink = registryBase.toExternalForm();
- /*
- * \u200b is a zero-width space, so the HTML renderer can know to break
- * lines.
- */
- String registryName = registryBase.toString().replaceAll("/", "\u200b/");
- appendRow(html, "Component registry base", registryName, registryLink);
-
- String familyName = id.getFamilyName();
- appendRow(html, "Component family", familyName, null);
- try {
- Family family = factory.getFamily(registryBase, familyName);
- if (family != null)
- appendDescriptionHtml(html, FAMILY_DESCRIPTION_LABEL,
- family.getDescription());
- } catch (Exception e) {
- logger.error("failed to get component family description", e);
- }
-
- String componentName = id.getComponentName();
- String helpLink = null;
- try {
- URL helpURL = factory.getVersion(id).getHelpURL();
- if (helpURL != null)
- helpLink = helpURL.toExternalForm();
- } catch (Exception e) {
- logger.error(e);
- }
-
- appendRow(html, "Component name", componentName, helpLink);
- try {
- Component component = factory.getComponent(registryBase,
- familyName, componentName);
- if (component != null)
- appendDescriptionHtml(html, COMPONENT_DESCRIPTION_LABEL,
- component.getDescription());
- } catch (Exception e) {
- logger.error("failed to get component description", e);
- }
-
- Integer componentVersion = id.getComponentVersion();
-
- if (componentVersion == null)
- appendRow(html, "Component version", "N/A", helpLink);
- else {
- appendRow(html, "Component version", componentVersion, helpLink);
- try {
- Version version = factory.getVersion(registryBase,
- familyName, componentName, componentVersion);
- if (version != null) {
- appendDescriptionHtml(html, VERSION_DESCRIPTION_LABEL,
- version.getDescription());
- WorkflowBundle impl = version.getImplementation();
- Set<InputWorkflowPort> inputs = impl.getMainWorkflow().getInputPorts();
- if (!inputs.isEmpty()) {
- appendHeaderRow(html, "Input Port Name", "Depth");
- for (InputWorkflowPort input : inputs)
- appendPlainRow(html, input.getName(), input.getDepth());
- }
- Set<OutputWorkflowPort> outputs = impl.getMainWorkflow().getOutputPorts();
- if (!outputs.isEmpty()) {
- appendHeaderRow(html, "Output Port Name", "Depth");
- for (OutputWorkflowPort output : outputs) {
- //FIXME get depth of output ports!
- appendPlainRow(html, output.getName(), -1 /*output.getDepth()*/);
- }
- }
- }
- } catch (Exception e) {
- logger.error("failed to get component version description", e);
- }
- }
- }
-
- private static void appendRow(StringBuilder html, Object label,
- Object value, String link) {
- if (link == null)
- html.append(format(rowFormat, label, value));
- else
- html.append(format(rowLinkFormat, label, value, link));
- }
-
- private static void appendHeaderRow(StringBuilder html, Object label1,
- Object label2) {
- html.append(format(headerFormat, label1, label2));
- }
-
- private static void appendPlainRow(StringBuilder html, Object value1,
- Object value2) {
- html.append(format(plainFormat, value1, value2));
- }
-
- private static void appendDescriptionHtml(StringBuilder html,
- String header, String description) {
- if ((description != null) && !description.isEmpty())
- html.append(format(descriptionFormat, header, description));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivity.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivity.java
new file mode 100644
index 0000000..9619297
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivity.java
@@ -0,0 +1,167 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.taverna.activities.dataflow.DataflowActivity;
+import org.apache.taverna.annotation.annotationbeans.SemanticAnnotation;
+import org.apache.taverna.invocation.InvocationContext;
+import org.apache.taverna.invocation.impl.InvocationContextImpl;
+import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
+import org.apache.taverna.reference.ReferenceService;
+import org.apache.taverna.reference.T2Reference;
+import org.apache.taverna.workflowmodel.Dataflow;
+import org.apache.taverna.workflowmodel.EditException;
+import org.apache.taverna.workflowmodel.Edits;
+import org.apache.taverna.workflowmodel.processor.activity.AbstractAsynchronousActivity;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
+import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
+import org.apache.taverna.workflowmodel.utils.AnnotationTools;
+
+public class ComponentActivity extends
+ AbstractAsynchronousActivity<JsonNode> {
+ public static final String URI = "http://ns.taverna.org.uk/2010/activity/component";
+ private Logger logger = getLogger(ComponentActivity.class);
+
+ private ComponentUtil util;
+ private ComponentImplementationCache cache;
+ private volatile DataflowActivity componentRealization;
+ private JsonNode json;
+ private ComponentActivityConfigurationBean bean;
+ private SystemUtils system;
+ private AnnotationUtils annUtils;
+ private ComponentExceptionFactory cef;
+
+ private Dataflow realizingDataflow = null;
+
+ ComponentActivity(ComponentUtil util, ComponentImplementationCache cache,
+ Edits edits, SystemUtils system, AnnotationUtils annUtils, ComponentExceptionFactory exnFactory) {
+ this.util = util;
+ this.cache = cache;
+ this.system = system;
+ this.annUtils = annUtils;
+ setEdits(edits);
+ this.componentRealization = new DataflowActivity();
+ this.cef = exnFactory;
+ }
+
+ @Override
+ public void configure(JsonNode json) throws ActivityConfigurationException {
+ this.json = json;
+ try {
+ bean = new ComponentActivityConfigurationBean(json, util, cache);
+ } catch (MalformedURLException e) {
+ throw new ActivityConfigurationException(
+ "failed to understand configuration", e);
+ }
+ try {
+ configurePorts(bean.getPorts());
+ } catch (ComponentException e) {
+ throw new ActivityConfigurationException(
+ "failed to get component realization", e);
+ }
+ }
+
+ @Override
+ public void executeAsynch(Map<String, T2Reference> inputs,
+ AsynchronousActivityCallback callback) {
+ try {
+ ExceptionHandling exceptionHandling = bean.getExceptionHandling();
+ // InvocationContextImpl newContext = copyInvocationContext(callback);
+
+ getComponentRealization().executeAsynch(inputs, new ProxyCallback(
+ callback, callback.getContext(), exceptionHandling, cef));
+ } catch (ActivityConfigurationException e) {
+ callback.fail("Unable to execute component", e);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private InvocationContextImpl copyInvocationContext(
+ AsynchronousActivityCallback callback) {
+ InvocationContext originalContext = callback.getContext();
+ ReferenceService rs = originalContext.getReferenceService();
+ InvocationContextImpl newContext = new InvocationContextImpl(rs, null);
+ // for (Object o : originalContext.getEntities(Object.class)) {
+ // newContext.addEntity(o);
+ // }
+ return newContext;
+ }
+
+ @Override
+ public JsonNode getConfiguration() {
+ return json;
+ }
+
+ ComponentActivityConfigurationBean getConfigBean() {
+ return bean;
+ }
+
+ private DataflowActivity getComponentRealization()
+ throws ActivityConfigurationException {
+ synchronized (componentRealization) {
+ try {
+ if (componentRealization.getNestedDataflow() == null) {
+ if (realizingDataflow == null)
+ realizingDataflow = system.compile(util
+ .getVersion(bean).getImplementation());
+ componentRealization.setNestedDataflow(realizingDataflow);
+ copyAnnotations();
+ }
+ } catch (ComponentException e) {
+ logger.error("unable to read workflow", e);
+ throw new ActivityConfigurationException(
+ "unable to read workflow", e);
+ } catch (InvalidWorkflowException e) {
+ logger.error("unable to compile workflow", e);
+ throw new ActivityConfigurationException(
+ "unable to compile workflow", e);
+ }
+ }
+
+ return componentRealization;
+ }
+
+ private void copyAnnotations() {
+ // FIXME Completely wrong way of doing this!
+ try {
+ //annUtils.getAnnotation(subject, uriForAnnotation)
+ String annotationValue = AnnotationTools.getAnnotationString(realizingDataflow,
+ SemanticAnnotation.class, null);
+ if (annotationValue != null)
+ AnnotationTools.setAnnotationString(this, SemanticAnnotation.class,
+ annotationValue, getEdits()).doEdit();
+ } catch (EditException e) {
+ logger.error("failed to set annotation string", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityConfigurationBean.java
new file mode 100644
index 0000000..6819b3f
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityConfigurationBean.java
@@ -0,0 +1,168 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+import org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+import org.apache.taverna.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
+
+/**
+ * Component activity configuration bean.
+ */
+public class ComponentActivityConfigurationBean extends
+ ComponentVersionIdentification implements Serializable {
+ public static final String ERROR_CHANNEL = "error_channel";
+ public static final List<String> ignorableNames = Arrays
+ .asList(ERROR_CHANNEL);
+ private static final long serialVersionUID = 5774901665863468058L;
+ private static final Logger logger = getLogger(ComponentActivity.class);
+
+ private transient ActivityPortsDefinitionBean ports = null;
+ private transient ExceptionHandling eh;
+ private transient ComponentUtil util;
+ private transient ComponentImplementationCache cache;
+
+ public ComponentActivityConfigurationBean(Version.ID toBeCopied,
+ ComponentUtil util, ComponentImplementationCache cache) {
+ super(toBeCopied);
+ this.util = util;
+ this.cache = cache;
+ try {
+ getPorts();
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
+ logger.error("failed to get component realization", e);
+ }
+ }
+
+ public ComponentActivityConfigurationBean(JsonNode json,
+ ComponentUtil util, ComponentImplementationCache cache) throws MalformedURLException {
+ super(getUrl(json), getFamily(json), getComponent(json),
+ getVersion(json));
+ this.util = util;
+ this.cache = cache;
+ }
+
+ private static URL getUrl(JsonNode json) throws MalformedURLException {
+ return new URL(json.get(REGISTRY_BASE).textValue());
+ }
+
+ private static String getFamily(JsonNode json) {
+ return json.get(FAMILY_NAME).textValue();
+ }
+
+ private static String getComponent(JsonNode json) {
+ return json.get(COMPONENT_NAME).textValue();
+ }
+
+ private static Integer getVersion(JsonNode json) {
+ JsonNode node = json.get(COMPONENT_VERSION);
+ if (node == null || !node.isInt())
+ return null;
+ return node.intValue();
+ }
+
+ private ActivityPortsDefinitionBean getPortsDefinition(WorkflowBundle w) {
+ ActivityPortsDefinitionBean result = new ActivityPortsDefinitionBean();
+ List<ActivityInputPortDefinitionBean> inputs = result
+ .getInputPortDefinitions();
+ List<ActivityOutputPortDefinitionBean> outputs = result
+ .getOutputPortDefinitions();
+
+ for (InputWorkflowPort iwp : w.getMainWorkflow().getInputPorts())
+ inputs.add(makeInputDefinition(iwp));
+ // FIXME: Get the ValidatorState (so we can get getPortResolvedDepth()
+ ValidatorState vs = ... ;
+ for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
+ outputs.add(makeOutputDefinition(vs.getPortResolvedDepth(owp), owp.getName()));
+
+ try {
+ eh = util.getFamily(getRegistryBase(), getFamilyName())
+ .getComponentProfile().getExceptionHandling();
+ if (eh != null)
+ outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
+ logger.error("failed to get exception handling for family", e);
+ }
+ return result;
+ }
+
+ private ActivityInputPortDefinitionBean makeInputDefinition(
+ InputWorkflowPort dip) {
+ ActivityInputPortDefinitionBean activityInputPortDefinitionBean = new ActivityInputPortDefinitionBean();
+ activityInputPortDefinitionBean.setHandledReferenceSchemes(null);
+ activityInputPortDefinitionBean.setMimeTypes((List<String>) null);
+ activityInputPortDefinitionBean.setTranslatedElementType(String.class);
+ activityInputPortDefinitionBean.setAllowsLiteralValues(true);
+ activityInputPortDefinitionBean.setDepth(dip.getDepth());
+ activityInputPortDefinitionBean.setName(dip.getName());
+ return activityInputPortDefinitionBean;
+ }
+
+ private ActivityOutputPortDefinitionBean makeOutputDefinition(int depth,
+ String name) {
+ ActivityOutputPortDefinitionBean activityOutputPortDefinitionBean = new ActivityOutputPortDefinitionBean();
+ activityOutputPortDefinitionBean.setMimeTypes(new ArrayList<String>());
+ activityOutputPortDefinitionBean.setDepth(depth);
+ activityOutputPortDefinitionBean.setGranularDepth(depth);
+ activityOutputPortDefinitionBean.setName(name);
+ return activityOutputPortDefinitionBean;
+ }
+
+ /**
+ * @return the ports
+ */
+ public ActivityPortsDefinitionBean getPorts() throws io.github.taverna_extras.component.api.ComponentException{
+ if (ports == null)
+ ports = getPortsDefinition(cache.getImplementation(this));
+ return ports;
+ }
+
+ public ExceptionHandling getExceptionHandling() {
+ return eh;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityFactory.java
new file mode 100644
index 0000000..c90ea1a
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityFactory.java
@@ -0,0 +1,142 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
+import org.springframework.beans.factory.annotation.Required;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.taverna.workflowmodel.Edits;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityConfigurationException;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityFactory;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityInputPort;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
+import org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
+import org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
+
+public class ComponentActivityFactory extends ComponentExceptionFactory
+ implements ActivityFactory {
+ private ComponentUtil util;
+ private ComponentImplementationCache cache;
+ private Edits edits;
+ private SystemUtils system;
+ private AnnotationUtils annUtils;
+
+ @Override
+ public ComponentActivity createActivity() {
+ return new ComponentActivity(util, cache, edits, system, annUtils, this);
+ }
+
+ @Override
+ public URI getActivityType() {
+ return URI.create(ComponentActivity.URI);
+ }
+
+ @Override
+ public JsonNode getActivityConfigurationSchema() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ return objectMapper
+ .readTree(getClass().getResource("/schema.json"));
+ } catch (IOException e) {
+ return objectMapper.createObjectNode();
+ }
+ }
+
+ @Override
+ public Set<ActivityInputPort> getInputPorts(JsonNode configuration)
+ throws ActivityConfigurationException {
+ try {
+ Set<ActivityInputPort> activityInputPorts = new HashSet<>();
+ for (ActivityInputPortDefinitionBean ipd : createConfiguration(
+ configuration).getPorts().getInputPortDefinitions())
+ activityInputPorts.add(edits.createActivityInputPort(
+ ipd.getName(), ipd.getDepth(), true, null,
+ ipd.getTranslatedElementType()));
+ return activityInputPorts;
+ } catch (MalformedURLException | ComponentException | RuntimeException e) {
+ throw new ActivityConfigurationException(
+ "failed to get implementation for configuration of inputs",
+ e);
+ }
+ }
+
+ @Override
+ public Set<ActivityOutputPort> getOutputPorts(JsonNode configuration)
+ throws ActivityConfigurationException {
+ try {
+ Set<ActivityOutputPort> activityOutputPorts = new HashSet<>();
+ for (ActivityOutputPortDefinitionBean opd : createConfiguration(
+ configuration).getPorts().getOutputPortDefinitions())
+ activityOutputPorts.add(edits.createActivityOutputPort(
+ opd.getName(), opd.getDepth(), opd.getGranularDepth()));
+ return activityOutputPorts;
+ } catch (MalformedURLException | ComponentException | RuntimeException e) {
+ throw new ActivityConfigurationException(
+ "failed to get implementation for configuration of outputs",
+ e);
+ }
+ }
+
+ public ComponentActivityConfigurationBean createConfiguration(ID id) {
+ return new ComponentActivityConfigurationBean(id, util, cache);
+ }
+
+ public ComponentActivityConfigurationBean createConfiguration(JsonNode json)
+ throws MalformedURLException {
+ return new ComponentActivityConfigurationBean(json, util, cache);
+ }
+
+ @Required
+ public void setComponentUtil(ComponentUtil util) {
+ this.util = util;
+ }
+
+ @Required
+ public void setDataflowCache(ComponentImplementationCache cache) {
+ this.cache = cache;
+ }
+
+ @Required
+ public void setEdits(Edits edits) {
+ this.edits = edits;
+ }
+
+ @Required
+ public void setSystemUtil(SystemUtils system) {
+ this.system = system;
+ }
+
+ @Required
+ public void setAnnotationUtils(AnnotationUtils annUtils) {
+ this.annUtils = annUtils;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityLocalChecker.java
new file mode 100644
index 0000000..d874241
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityLocalChecker.java
@@ -0,0 +1,69 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import static io.github.taverna_extras.component.activity.ComponentHealthCheck.NON_SHAREABLE;
+
+import java.util.List;
+import org.apache.taverna.visit.VisitKind;
+import org.apache.taverna.visit.VisitReport;
+import static org.apache.taverna.visit.VisitReport.Status.WARNING;
+import org.apache.taverna.workflowmodel.health.HealthChecker;
+
+/**
+ * Component health checker
+ *
+ */
+public class ComponentActivityLocalChecker implements
+ HealthChecker<ComponentActivity> {
+ private static final VisitKind visitKind = ComponentHealthCheck
+ .getInstance();
+
+ @Override
+ public boolean canVisit(Object o) {
+ /*
+ * Return True if we can visit the object. We could do deeper (but not
+ * time consuming) checks here, for instance if the health checker only
+ * deals with ComponentActivity where a certain configuration option is
+ * enabled.
+ */
+ return o instanceof ComponentActivity;
+ }
+
+ @Override
+ public boolean isTimeConsuming() {
+ /*
+ * Return true if the health checker does a network lookup or similar
+ * time consuming checks, in which case it would only be performed when
+ * using File->Validate workflow or File->Run.
+ */
+ return false;
+ }
+
+ @Override
+ public VisitReport visit(ComponentActivity activity, List<Object> ancestry) {
+ if (!activity.getConfigBean().getRegistryBase().getProtocol()
+ .startsWith("http"))
+ return new VisitReport(visitKind, activity,
+ "Local component makes workflow non-shareable",
+ NON_SHAREABLE, WARNING);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityUpgradeChecker.java
new file mode 100644
index 0000000..4d45b60
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentActivityUpgradeChecker.java
@@ -0,0 +1,83 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.activity.ComponentHealthCheck.OUT_OF_DATE;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import org.apache.taverna.visit.VisitKind;
+import org.apache.taverna.visit.VisitReport;
+import static org.apache.taverna.visit.VisitReport.Status.WARNING;
+import org.apache.taverna.workflowmodel.health.HealthChecker;
+import org.springframework.beans.factory.annotation.Required;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentActivityUpgradeChecker implements
+ HealthChecker<ComponentActivity> {
+ private static final String OUTDATED_MSG = "Component out of date";
+ private static final VisitKind visitKind = ComponentHealthCheck
+ .getInstance();
+ private static Logger logger = getLogger(ComponentActivityUpgradeChecker.class);
+ private ComponentUtil utils;
+
+ @Required
+ public void setComponentUtil(ComponentUtil util) {
+ this.utils = util;
+ }
+
+ @Override
+ public boolean canVisit(Object o) {
+ return o instanceof ComponentActivity;
+ }
+
+ @Override
+ public boolean isTimeConsuming() {
+ return false;
+ }
+
+ @Override
+ public VisitReport visit(ComponentActivity activity, List<Object> ancestry) {
+ ComponentActivityConfigurationBean config = activity.getConfigBean();
+ int versionNumber = config.getComponentVersion();
+ int latestVersion = 0;
+
+ try {
+ latestVersion = utils
+ .getComponent(config.getRegistryBase(),
+ config.getFamilyName(), config.getComponentName())
+ .getComponentVersionMap().lastKey();
+ } catch (ComponentException e) {
+ logger.error("failed to get component description", e);
+ }
+
+ if (latestVersion > versionNumber)
+ return new VisitReport(visitKind, activity, OUTDATED_MSG,
+ OUT_OF_DATE, WARNING);
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentExceptionFactory.java
new file mode 100644
index 0000000..243fe84
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentExceptionFactory.java
@@ -0,0 +1,38 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+class ComponentExceptionFactory {
+ private static final String UNEXPECTED_ID = "http://ns.taverna.org.uk/2012/component/unexpected";
+
+ ComponentExceptionFactory() {
+ }
+
+ public ComponentImplementationException createComponentException(
+ String exceptionId, String message) {
+ ComponentImplementationException result = new ComponentImplementationException(message);
+ result.setExceptionId(exceptionId);
+ return result;
+ }
+
+ public ComponentImplementationException createUnexpectedComponentException(
+ String message) {
+ return createComponentException(UNEXPECTED_ID, message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentHealthCheck.java
new file mode 100644
index 0000000..0381de1
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentHealthCheck.java
@@ -0,0 +1,42 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import org.apache.taverna.visit.VisitKind;
+import org.apache.taverna.visit.Visitor;
+
+public class ComponentHealthCheck extends VisitKind {
+ public static final int NO_PROBLEM = 0;
+ public static final int OUT_OF_DATE = 10;
+ public static final int NON_SHAREABLE = 20;
+ public static final int FAILS_PROFILE = 30;
+
+ @Override
+ public Class<? extends Visitor<?>> getVisitorClass() {
+ return ComponentActivityUpgradeChecker.class;
+ }
+
+ private static class Singleton {
+ private static ComponentHealthCheck instance = new ComponentHealthCheck();
+ }
+
+ public static ComponentHealthCheck getInstance() {
+ return Singleton.instance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentImplementationException.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentImplementationException.java
new file mode 100644
index 0000000..7ef77f7
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ComponentImplementationException.java
@@ -0,0 +1,37 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+public class ComponentImplementationException extends Exception {
+ public ComponentImplementationException(String string) {
+ super(string);
+ this.setStackTrace(new StackTraceElement[] {});
+ }
+
+ private static final long serialVersionUID = -3844030382222698090L;
+ private String exceptionId;
+
+ public void setExceptionId(String exceptionId) {
+ this.exceptionId = exceptionId;
+ }
+
+ public String getExceptionId() {
+ return exceptionId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ProxyCallback.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ProxyCallback.java
new file mode 100644
index 0000000..3a04af3
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/ProxyCallback.java
@@ -0,0 +1,264 @@
+package io.github.taverna_extras.component.activity;
+/*
+ * 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.
+ */
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.xml.ws.Holder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.api.profile.ExceptionReplacement;
+import io.github.taverna_extras.component.api.profile.HandleException;
+import org.apache.taverna.invocation.InvocationContext;
+import org.apache.taverna.reference.ErrorDocument;
+import org.apache.taverna.reference.ErrorDocumentService;
+import org.apache.taverna.reference.IdentifiedList;
+import org.apache.taverna.reference.ListService;
+import org.apache.taverna.reference.ReferenceService;
+import org.apache.taverna.reference.T2Reference;
+import static org.apache.taverna.reference.T2ReferenceType.ErrorDocument;
+import static org.apache.taverna.reference.T2ReferenceType.IdentifiedList;
+import static org.apache.taverna.reference.T2ReferenceType.ReferenceSet;
+import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivityCallback;
+import org.apache.taverna.workflowmodel.processor.dispatch.events.DispatchErrorType;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ProxyCallback implements AsynchronousActivityCallback {
+ private static final Logger logger = getLogger(ProxyCallback.class);
+
+ private final ComponentExceptionFactory cef;
+ private final AsynchronousActivityCallback proxiedCallback;
+ private final ReferenceService references;
+ private final InvocationContext context;
+ private final ExceptionHandling exceptionHandling;
+ private final ListService lists;
+ private final ErrorDocumentService errors;
+
+ /**
+ * @param proxiedCallback
+ * @param invocationContext
+ * @param exceptionHandling
+ * @param exnFactory
+ */
+ ProxyCallback(AsynchronousActivityCallback proxiedCallback,
+ InvocationContext invocationContext,
+ ExceptionHandling exceptionHandling,
+ ComponentExceptionFactory exnFactory) {
+ this.proxiedCallback = proxiedCallback;
+ this.exceptionHandling = exceptionHandling;
+ context = invocationContext;
+ references = context.getReferenceService();
+ lists = references.getListService();
+ errors = references.getErrorDocumentService();
+ cef = exnFactory;
+ }
+
+ @Override
+ public InvocationContext getContext() {
+ return context;
+ }
+
+ @Override
+ public void requestRun(Runnable runMe) {
+ proxiedCallback.requestRun(runMe);
+ }
+
+ @Override
+ public void receiveResult(Map<String, T2Reference> data, int[] index) {
+ if (exceptionHandling == null) {
+ proxiedCallback.receiveResult(data, index);
+ return;
+ }
+
+ List<T2Reference> exceptions = new ArrayList<>();
+ Map<String, T2Reference> replacement = new HashMap<>();
+ for (Entry<String, T2Reference> entry : data.entrySet())
+ replacement.put(entry.getKey(),
+ considerReference(entry.getValue(), exceptions));
+ replacement.put("error_channel",
+ references.register(exceptions, 1, true, context));
+ proxiedCallback.receiveResult(replacement, index);
+ }
+
+ private T2Reference considerReference(T2Reference value,
+ List<T2Reference> exceptions) {
+ if (!value.containsErrors())
+ return value;
+ else if (!value.getReferenceType().equals(IdentifiedList))
+ return replaceErrors(value, value.getDepth(), exceptions);
+ else if (exceptionHandling.failLists())
+ return replaceErrors(findFirstFailure(value), value.getDepth(),
+ exceptions);
+
+ List<T2Reference> replacementList = new ArrayList<>();
+ for (T2Reference subValue : lists.getList(value))
+ replacementList.add(considerReference(subValue, exceptions));
+ return references.register(replacementList, value.getDepth(), true,
+ context);
+ }
+
+ private T2Reference findFirstFailure(T2Reference value) {
+ IdentifiedList<T2Reference> originalList = lists.getList(value);
+ for (T2Reference subValue : originalList) {
+ if (subValue.getReferenceType().equals(ErrorDocument))
+ return subValue;
+ if (subValue.getReferenceType().equals(IdentifiedList))
+ if (subValue.containsErrors())
+ return findFirstFailure(subValue);
+ // No need to consider value
+ }
+ return null;
+ }
+
+ private T2Reference replaceErrors(T2Reference value, int depth,
+ List<T2Reference> exceptions) {
+ ErrorDocument doc = errors.getError(value);
+
+ Holder<HandleException> handleException = new Holder<>();
+ Set<ErrorDocument> toConsider = new HashSet<>();
+ Set<ErrorDocument> considered = new HashSet<>();
+ toConsider.add(doc);
+
+ while (!toConsider.isEmpty())
+ try {
+ ErrorDocument nudoc = remapException(toConsider, considered,
+ handleException);
+ if (nudoc != null) {
+ doc = nudoc;
+ break;
+ }
+ } catch (Exception e) {
+ logger.error("failed to locate exception mapping", e);
+ }
+
+ String exceptionMessage = doc.getExceptionMessage();
+ // An exception that is not mentioned
+ if (handleException.value == null) {
+ ComponentImplementationException newException = cef
+ .createUnexpectedComponentException(exceptionMessage);
+ T2Reference replacement = errors.registerError(exceptionMessage,
+ newException, depth, context).getId();
+ exceptions.add(errors.registerError(exceptionMessage, newException,
+ 0, context).getId());
+ return replacement;
+ }
+
+ if (handleException.value.pruneStack())
+ doc.getStackTraceStrings().clear();
+
+ ExceptionReplacement exnReplacement = handleException.value
+ .getReplacement();
+ if (exnReplacement == null) {
+ T2Reference replacement = references.register(doc, depth, true,
+ context);
+ exceptions.add(references.register(doc, 0, true, context));
+ return replacement;
+ }
+
+ ComponentImplementationException newException = cef
+ .createComponentException(exnReplacement.getReplacementId(),
+ exnReplacement.getReplacementMessage());
+ T2Reference replacement = errors.registerError(
+ exnReplacement.getReplacementMessage(), newException, depth,
+ context).getId();
+ exceptions.add(errors.registerError(
+ exnReplacement.getReplacementMessage(), newException, 0,
+ context).getId());
+ return replacement;
+ }
+
+ private ErrorDocument remapException(Set<ErrorDocument> toConsider,
+ Set<ErrorDocument> considered,
+ Holder<HandleException> handleException) {
+ ErrorDocument found = null;
+ ErrorDocument errorDoc = toConsider.iterator().next();
+
+ considered.add(errorDoc);
+ toConsider.remove(errorDoc);
+ String exceptionMessage = errorDoc.getExceptionMessage();
+ for (HandleException he : exceptionHandling.getHandleExceptions()) {
+ if (!he.matches(exceptionMessage))
+ continue;
+ handleException.value = he;
+ found = errorDoc;
+ }
+ if (!errorDoc.getErrorReferences().isEmpty())
+ for (T2Reference subRef : errorDoc.getErrorReferences())
+ for (T2Reference newErrorRef : getErrors(subRef)) {
+ ErrorDocument subDoc = errors.getError(newErrorRef);
+ if (subDoc == null)
+ logger.error("Error document contains references to non-existent sub-errors");
+ else if (!considered.contains(subDoc))
+ toConsider.add(subDoc);
+ }
+ return found;
+ }
+
+ private Set<T2Reference> getErrors(T2Reference ref) {
+ Set<T2Reference> result = new HashSet<>();
+ if (ref.getReferenceType().equals(ReferenceSet)) {
+ // nothing
+ } else if (ref.getReferenceType().equals(IdentifiedList)) {
+ IdentifiedList<T2Reference> originalList = lists.getList(ref);
+ for (T2Reference subValue : originalList)
+ if (subValue.containsErrors())
+ result.addAll(getErrors(subValue));
+ } else
+ result.add(ref);
+ return result;
+ }
+
+ @Override
+ public void receiveCompletion(int[] completionIndex) {
+ proxiedCallback.receiveCompletion(completionIndex);
+ }
+
+ @Override
+ public void fail(String message, Throwable t, DispatchErrorType errorType) {
+ proxiedCallback.fail(message, t, errorType);
+ }
+
+ @Override
+ public void fail(String message, Throwable t) {
+ proxiedCallback.fail(message, t);
+ }
+
+ @Override
+ public void fail(String message) {
+ proxiedCallback.fail(message);
+ }
+
+ @Override
+ public String getParentProcessIdentifier() {
+ // return "";
+ return proxiedCallback.getParentProcessIdentifier();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/package-info.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/package-info.java
new file mode 100644
index 0000000..086a49b
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/activity/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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 io.github.taverna_extras.component.activity;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ActivityProfileImpl.java
new file mode 100644
index 0000000..a948cd4
--- /dev/null
+++ b/taverna-component-activity/src/main/java/io/github/taverna_extras/component/profile/ActivityProfileImpl.java
@@ -0,0 +1,53 @@
+package io.github.taverna_extras.component.profile;
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.github.taverna_extras.component.api.profile.ActivityProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import io.github.taverna_extras.component.api.profile.doc.Activity;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
+
+/**
+ * Specifies the semantic annotations that an activity must have.
+ *
+ * @author David Withers
+ */
+public class ActivityProfileImpl implements ActivityProfile {
+ private final ComponentProfileImpl componentProfile;
+ private final Activity activity;
+
+ public ActivityProfileImpl(ComponentProfileImpl componentProfile,
+ Activity activity) {
+ this.componentProfile = componentProfile;
+ this.activity = activity;
+ }
+
+ @Override
+ public List<SemanticAnnotationProfile> getSemanticAnnotations() {
+ List<SemanticAnnotationProfile> saProfiles = new ArrayList<>();
+ for (SemanticAnnotation annotation : activity.getSemanticAnnotation())
+ saProfiles.add(new SemanticAnnotationProfileImpl(componentProfile,
+ annotation));
+ return saProfiles;
+ }
+}
[07/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/PortProfile.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/PortProfile.java
new file mode 100644
index 0000000..d89b571
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/PortProfile.java
@@ -0,0 +1,22 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+public interface PortProfile extends AnnotatedElement {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/Profile.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/Profile.java
new file mode 100644
index 0000000..c08ddc9
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/Profile.java
@@ -0,0 +1,65 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+import java.util.List;
+import java.util.Map;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.NamedItem;
+import io.github.taverna_extras.component.api.Registry;
+
+import org.apache.jena.ontology.OntModel;
+
+public interface Profile extends NamedItem, AnnotatedElement {
+
+ Registry getComponentRegistry();
+
+ String getXML() throws ComponentException;
+
+ io.github.taverna_extras.component.api.profile.doc.Profile getProfileDocument()
+ throws ComponentException;
+
+ String getId();
+
+ String getOntologyLocation(String ontologyId);
+
+ Map<String, String> getPrefixMap() throws ComponentException;
+
+ OntModel getOntology(String ontologyId);
+
+ List<PortProfile> getInputPortProfiles();
+
+ List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles()
+ throws ComponentException;
+
+ List<PortProfile> getOutputPortProfiles();
+
+ List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles()
+ throws ComponentException;
+
+ List<ActivityProfile> getActivityProfiles();
+
+ List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles()
+ throws ComponentException;
+
+ ExceptionHandling getExceptionHandling();
+
+ void delete() throws ComponentException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/SemanticAnnotationProfile.java
new file mode 100644
index 0000000..c7e040f
--- /dev/null
+++ b/taverna-component-repository-api/src/main/java/io/github/taverna_extras/component/api/profile/SemanticAnnotationProfile.java
@@ -0,0 +1,72 @@
+package io.github.taverna_extras.component.api.profile;
+/*
+ * 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.
+ */
+
+import java.util.List;
+
+import org.apache.jena.ontology.Individual;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.ontology.OntProperty;
+
+public interface SemanticAnnotationProfile {
+
+ /**
+ * Returns the ontology that defines semantic annotation.
+ *
+ * @return the ontology that defines semantic annotation
+ */
+ OntModel getOntology();
+
+ /**
+ * Returns the predicate for the semantic annotation.
+ *
+ * @return the predicate for the semantic annotation
+ */
+ OntProperty getPredicate();
+
+ String getPredicateString();
+
+ String getClassString();
+
+ /**
+ * Returns the individual that the semantic annotation must use.
+ *
+ * May be null if no explicit individual is required.
+ *
+ * @return the individual that the semantic annotation must use
+ */
+ Individual getIndividual();
+
+ /**
+ * Returns the individuals in the range of the predicate defined in the
+ * ontology.
+ *
+ * @return the individuals in the range of the predicate defined in the
+ * ontology
+ */
+ List<Individual> getIndividuals();
+
+ Integer getMinOccurs();
+
+ Integer getMaxOccurs();
+
+ OntClass getRangeClass();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
deleted file mode 100644
index e014fb9..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Component.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-import java.net.URL;
-import java.util.SortedMap;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * The abstract interface supported by a component.
- *
- * @author Donal Fellows
- * @author David Withers
- */
-public interface Component extends NamedItem {
- /**
- * @return the name of the Component.
- */
- @Override
- String getName();
-
- /**
- * Returns the URL for the Component.
- *
- * @return the URL for the Component.
- */
- URL getComponentURL();
-
- /**
- * Creates a new version of this Component.
- *
- * @param bundle
- * the workflow that the new ComponentVersion will use.
- * @return a new version of this Component.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- Version addVersionBasedOn(WorkflowBundle bundle, String revisionComment)
- throws ComponentException;
-
- /**
- * Returns the ComponentVersion that has the specified version number.
- *
- * @param version
- * the version number of the ComponentVersion to return.
- * @return the ComponentVersion that has the specified version number.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- Version getComponentVersion(Integer version) throws ComponentException;
-
- /**
- * @return the description of the Component.
- */
- @Override
- String getDescription();
-
- /**
- * Returns a SortedMap of version number to ComponentVersion.
- * <p>
- * The returned map is sorted increasing numeric order.
- *
- * @return a SortedMap of version number to ComponentVersion.
- */
- SortedMap<Integer, Version> getComponentVersionMap();
-
- Registry getRegistry();
-
- Family getFamily();
-
- void delete() throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
deleted file mode 100644
index 044903e..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-/**
- * Thrown when there is a problem interacting with a ComponentRegistry.
- *
- * @author David Withers
- */
-public class ComponentException extends Exception {
- private static final long serialVersionUID = -5222074350812438467L;
-
- public ComponentException() {
- super();
- }
-
- public ComponentException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ComponentException(String message) {
- super(message);
- }
-
- public ComponentException(Throwable cause) {
- super(cause);
- }
-
- public ComponentException(String messageTemplate, Object...parameters) {
- super(String.format(messageTemplate, parameters));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
deleted file mode 100644
index 5b69b61..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/ComponentFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.profile.Profile;
-
-public interface ComponentFactory {
- public Registry getRegistry(URL registryBase) throws ComponentException;
-
- public Family getFamily(URL registryBase, String familyName)
- throws ComponentException;
-
- public Component getComponent(URL registryBase, String familyName,
- String componentName) throws ComponentException;
-
- public Version getVersion(URL registryBase, String familyName,
- String componentName, Integer componentVersion)
- throws ComponentException;
-
- public Version getVersion(Version.ID ident) throws ComponentException;
-
- public Component getComponent(Version.ID ident) throws ComponentException;
-
- public Profile getProfile(URL url) throws ComponentException;
-
- public Profile getBaseProfile() throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
deleted file mode 100644
index ca4ec54..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Family.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-import java.util.List;
-
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public interface Family extends NamedItem {
- /**
- * Creates a new Component and adds it to this ComponentFamily.
- *
- * @param componentName
- * the name of the Component to create. Must not be null.
- * @param bundle
- * the workflow for the Component. Must not be null.
- * @return the new Component.
- * @throws ComponentException
- * <ul>
- * <li>if componentName is null,
- * <li>if dataflow is null,
- * <li>if a Component with this name already exists,
- * <li>if there is a problem accessing the ComponentRegistry.
- * </ul>
- */
- Version createComponentBasedOn(String componentName, String description,
- WorkflowBundle bundle) throws ComponentException;
-
- /**
- * Returns the Component with the specified name.
- * <p>
- * If this ComponentFamily does not contain a Component with the specified
- * name <code>null</code> is returned.
- *
- * @param componentName
- * the name of the Component to return. Must not be null.
- * @return the Component with the specified name.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- Component getComponent(String componentName) throws ComponentException;
-
- /**
- * Removes the specified Component from this ComponentFamily.
- * <p>
- * If this ComponentFamily does not contain the Component this method has no
- * effect.
- *
- * @param component
- * the Component to remove.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- void removeComponent(Component component) throws ComponentException;
-
- /**
- * Returns all the Components in this ComponentFamily.
- * <p>
- * If this ComponentFamily does not contain any Components an empty list is
- * returned.
- *
- * @return all the Components in this ComponentFamilies.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- List<Component> getComponents() throws ComponentException;
-
- /**
- * Returns the ComponentProfile for this ComponentFamily.
- *
- * @return the ComponentProfile for this ComponentFamily.
- * @throws ComponentException
- */
- Profile getComponentProfile() throws ComponentException;
-
- /**
- * Returns the ComponentRegistry that contains this ComponentFamily.
- *
- * @return the ComponentRegistry that contains this ComponentFamily.
- */
- Registry getComponentRegistry();
-
- /**
- * @return the name of the component Family.
- */
- @Override
- String getName();
-
- /**
- * @return the description of the component Family.
- */
- @Override
- String getDescription();
-
- /**
- * Delete this family from its registry.
- * @throws ComponentException
- */
- void delete() throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
deleted file mode 100644
index 2906288..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/License.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-public interface License extends NamedItem {
- public String getAbbreviation();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
deleted file mode 100644
index 775e515..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/NamedItem.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-public interface NamedItem {
- /** Name this entity. */
- public String getName();
- /** Describe this entity. */
- public String getDescription();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
deleted file mode 100644
index e6d1e23..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Registry.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import io.github.taverna_extras.component.api.profile.Profile;
-
-public interface Registry {
-
- License getPreferredLicense() throws ComponentException;
-
- Set<Version.ID> searchForComponents(String prefixString, String text)
- throws ComponentException;
-
- /**
- * Returns all the ComponentFamilies in this ComponetRegistry.
- * <p>
- * If this ComponentRegistry does not contain any ComponentFamilies an empty
- * list is returned.
- *
- * @return all the ComponentFamilies in this ComponetRegistry.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- List<Family> getComponentFamilies() throws ComponentException;
-
- List<License> getLicenses() throws ComponentException;
-
- List<SharingPolicy> getPermissions() throws ComponentException;
-
- /**
- * Adds a ComponentProfile to this ComponentRegistry.
- *
- * @param componentProfile
- * the ComponentProfile to add. Must not be null.
- * @param sharingPolicy
- * @param license
- * @return the ComponentProfile added to this ComponentRegistry.
- * @throws ComponentException
- * <ul>
- * <li>if componentProfile is null,
- * <li>if there is a problem accessing the ComponentRegistry.
- * </ul>
- */
- Profile addComponentProfile(Profile componentProfile, License license,
- SharingPolicy sharingPolicy) throws ComponentException;
-
- /**
- * Returns all the ComponentProfiles in this ComponetRegistry.
- * <p>
- * If this ComponentRegistry does not contain any ComponentProfiles an empty
- * list is returned.
- *
- * @return all the ComponentProfiles in this ComponetRegistry.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- List<Profile> getComponentProfiles() throws ComponentException;
-
- /**
- * Returns the ComponentProfile with the given ID in this ComponetRegistry.
- * <p>
- * If this ComponentRegistry does not contain the ComponentProfile, a
- * <tt>null</tt> is returned.
- *
- * @return the matching ComponentProfile in this ComponetRegistry, or
- * <tt>null</tt> if there is no such thing.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- Profile getComponentProfile(String id) throws ComponentException;
-
- String getRegistryBaseString();
-
- /**
- * Returns the location of this ComponentRepository.
- *
- * @return the location of this ComponentRepository
- */
- URL getRegistryBase();
-
- /**
- * Removes a the ComponentFamily with the specified name from this
- * ComponentRegistry.
- * <p>
- * If this ComponentRegistry does not contain a ComponentFamily with the
- * specified name this method has no effect.
- *
- * @param componentFamily
- * the ComponentFamily to remove.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- void removeComponentFamily(Family componentFamily) throws ComponentException;
-
- /**
- * Creates a new ComponentFamily and adds it to this ComponentRegistry.
- *
- * @param familyName
- * the name of the ComponentFamily to create. Must not be null.
- * @param componentProfile
- * the ComponentProfile for the new ComponentFamily. Must not be
- * null.
- * @param sharingPolicy
- * the SharingPolicy to use for the new ComponentFamily.
- * @return the new ComponentFamily
- * @throws ComponentException
- * <ul>
- * <li>if familyName is null,
- * <li>if componentProfile is null,
- * <li>if a ComponentFamily with this name already exists,
- * <li>if there is a problem accessing the ComponentRegistry.
- * </ul>
- */
- Family createComponentFamily(String familyName, Profile componentProfile,
- String description, License license, SharingPolicy sharingPolicy)
- throws ComponentException;
-
- /**
- * Returns the ComponentFamily with the specified name.
- * <p>
- * If this ComponentRegistry does not contain a ComponentFamily with the
- * specified name <code>null</code> is returned.
- *
- * @param familyName
- * the name of the ComponentFamily to return. Must not be null.
- * @return the ComponentFamily with the specified name in this
- * ComponentRepository or null if none exists.
- * @throws ComponentException
- * if there is a problem accessing the ComponentRegistry.
- */
- Family getComponentFamily(String familyName) throws ComponentException;
-
- /**
- * @return A description of the type of registry this is.
- */
- String getRegistryTypeName();
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
deleted file mode 100644
index 9965339..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/SharingPolicy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-/**
- * @author alanrw
- *
- */
-public interface SharingPolicy {
-
- /**
- * @return The user-relevant name of the permission
- */
- public abstract String getName();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
deleted file mode 100644
index 2929ed0..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package io.github.taverna_extras.component.api;
-/*
- * 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.
- */
-
-import java.io.Serializable;
-import java.net.URL;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public interface Version {
- /** @return The version number of this version */
- Integer getVersionNumber();
-
- /** @return The description of this version */
- String getDescription();
-
- /** @return The implementation for this version */
- WorkflowBundle getImplementation() throws ComponentException;
-
- /** @return The component of which this is a version */
- Component getComponent();
-
- /** @return The identification token for this version */
- ID getID();
-
- URL getHelpURL();
-
- interface ID extends Serializable {
- /** @return The name of the family of the component to which we refer to */
- String getFamilyName();
-
- /** @return The base URL of the registry containing the component */
- URL getRegistryBase();
-
- /**
- * @return The name of the component referred to, unique within its
- * family
- */
- String getComponentName();
-
- /**
- * @return The version number of the version of the component referred
- * to
- */
- Integer getComponentVersion();
-
- /**
- * Tests whether this ID is equal to the given one, <i>excluding</i> the
- * version.
- *
- * @param id
- * The ID to compare to.
- * @return A boolean
- */
- boolean mostlyEqualTo(ID id);
-
- /**
- * Tests whether this ID is equal to the given component,
- * <i>excluding</i> the version.
- *
- * @param component
- * The component to compare to.
- * @return A boolean
- */
- boolean mostlyEqualTo(Component component);
- }
-
- class Identifier implements ID {
- private static final long serialVersionUID = 1139928258250264997L;
-
- private final URL registryBase;
- private final String familyName;
- private final String componentName;
- private final Integer componentVersion;
-
- public Identifier(URL registryBase, String familyName,
- String componentName, Integer componentVersion) {
- super();
- this.registryBase = registryBase;
- this.familyName = familyName;
- this.componentName = componentName;
- this.componentVersion = componentVersion;
- }
-
- /**
- * @return the registryBase
- */
- @Override
- public URL getRegistryBase() {
- return registryBase;
- }
-
- /**
- * @return the familyName
- */
- @Override
- public String getFamilyName() {
- return familyName;
- }
-
- /**
- * @return the componentName
- */
- @Override
- public String getComponentName() {
- return componentName;
- }
-
- /**
- * @return the componentVersion
- */
- @Override
- public Integer getComponentVersion() {
- return componentVersion;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result *= prime;
- result += (componentName == null) ? 0 : componentName.hashCode();
- result *= prime;
- result += (componentVersion == null) ? 0 : componentVersion
- .hashCode();
- result *= prime;
- result += (familyName == null) ? 0 : familyName.hashCode();
- result *= prime;
- result += (registryBase == null) ? 0 : registryBase.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!ID.class.isAssignableFrom(obj.getClass()))
- return false;
- ID other = (ID) obj;
- if (componentName == null) {
- if (other.getComponentName() != null)
- return false;
- } else if (!componentName.equals(other.getComponentName()))
- return false;
- if (componentVersion == null) {
- if (other.getComponentVersion() != null)
- return false;
- } else if (!componentVersion.equals(other.getComponentVersion()))
- return false;
- if (familyName == null) {
- if (other.getFamilyName() != null)
- return false;
- } else if (!familyName.equals(other.getFamilyName()))
- return false;
- if (registryBase == null) {
- if (other.getRegistryBase() != null)
- return false;
- } else if (!registryBase.toString().equals(
- other.getRegistryBase().toString()))
- // NB: Comparison of URLs is on their string form!
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return getComponentName() + " V. " + getComponentVersion()
- + " in family " + getFamilyName() + " on "
- + getRegistryBase().toExternalForm();
- }
-
- @Override
- public boolean mostlyEqualTo(ID id) {
- if (this == id)
- return true;
- if (id == null)
- return false;
- if (getClass() != id.getClass())
- return false;
- if (componentName == null) {
- if (id.getFamilyName() != null)
- return false;
- } else if (!componentName.equals(id.getComponentName()))
- return false;
- if (familyName == null) {
- if (id.getFamilyName() != null)
- return false;
- } else if (!familyName.equals(id.getFamilyName()))
- return false;
- if (registryBase == null) {
- if (id.getRegistryBase() != null)
- return false;
- } else if (!registryBase.toString().equals(
- id.getRegistryBase().toString()))
- // NB: Comparison of URLs is on their string form!
- return false;
- return true;
- }
-
- @Override
- public boolean mostlyEqualTo(Component c) {
- return mostlyEqualTo(new Identifier(c.getRegistry()
- .getRegistryBase(), c.getFamily().getName(), c.getName(), 0));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
deleted file mode 100644
index 7de348c..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.taverna_extras.component.api.config;
-/*
- * 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.
- */
-
-public interface ComponentConfig {
- String URI = "http://ns.taverna.org.uk/2010/activity/component";
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
deleted file mode 100644
index 457161d..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package io.github.taverna_extras.component.api.config;
-/*
- * 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.
- */
-
-/**
- * The names of properties used in JSON configurations associated with
- * components.
- *
- * @author Donal Fellows
- */
-public interface ComponentPropertyNames {
- String REGISTRY_BASE = "registryBase";
- String FAMILY_NAME = "familyName";
- String COMPONENT_NAME = "componentName";
- String COMPONENT_VERSION = "componentVersion";
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
deleted file mode 100644
index a0b3e2f..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * An abstract API for working with components in a registry.
- * @author Donal Fellows
- * @author David Withers
- */
-package io.github.taverna_extras.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
deleted file mode 100644
index 8795c8a..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-public interface ActivityProfile extends AnnotatedElement {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
deleted file mode 100644
index 0ad0da4..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-import java.util.List;
-
-import io.github.taverna_extras.component.api.ComponentException;
-
-public interface AnnotatedElement {
- List<SemanticAnnotationProfile> getSemanticAnnotations()
- throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
deleted file mode 100644
index ee5810d..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author alanrw
- *
- */
-public class ExceptionHandling {
- private final boolean failLists;
- private final List<HandleException> remapped = new ArrayList<HandleException>();
-
- public ExceptionHandling(
- io.github.taverna_extras.component.api.profile.doc.ExceptionHandling proxied) {
- for (io.github.taverna_extras.component.api.profile.doc.HandleException he : proxied
- .getHandleException())
- remapped.add(new HandleException(he));
- this.failLists = proxied.getFailLists() != null;
- }
-
- public boolean failLists() {
- return failLists;
- }
-
- public List<HandleException> getHandleExceptions() {
- return remapped;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
deleted file mode 100644
index 69163cf..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-
-import io.github.taverna_extras.component.api.profile.doc.Replacement;
-
-/**
- * @author alanrw
- *
- */
-public class ExceptionReplacement {
- private final String id, message;
-
- public ExceptionReplacement(Replacement replacement) {
- id = replacement.getReplacementId();
- message = replacement.getReplacementMessage();
- }
-
- public String getReplacementId() {
- return id;
- }
-
- public String getReplacementMessage() {
- return message;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
deleted file mode 100644
index fb29cd6..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-
-import static java.util.regex.Pattern.DOTALL;
-import static java.util.regex.Pattern.compile;
-
-import java.util.regex.Pattern;
-
-/**
- * @author alanrw
- *
- */
-public class HandleException {
- private final Pattern pattern;
- private ExceptionReplacement replacement;
- private final boolean pruneStack;
-
- public HandleException(
- io.github.taverna_extras.component.api.profile.doc.HandleException proxied) {
- pruneStack = proxied.getPruneStack() != null;
- pattern = compile(proxied.getPattern(), DOTALL);
- if (proxied.getReplacement() != null)
- replacement = new ExceptionReplacement(proxied.getReplacement());
- }
-
- public boolean matches(String s) {
- return pattern.matcher(s).matches();
- }
-
- public boolean pruneStack() {
- return pruneStack;
- }
-
- public ExceptionReplacement getReplacement() {
- return replacement;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
deleted file mode 100644
index d89b571..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-public interface PortProfile extends AnnotatedElement {
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
deleted file mode 100644
index c08ddc9..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-import java.util.List;
-import java.util.Map;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.NamedItem;
-import io.github.taverna_extras.component.api.Registry;
-
-import org.apache.jena.ontology.OntModel;
-
-public interface Profile extends NamedItem, AnnotatedElement {
-
- Registry getComponentRegistry();
-
- String getXML() throws ComponentException;
-
- io.github.taverna_extras.component.api.profile.doc.Profile getProfileDocument()
- throws ComponentException;
-
- String getId();
-
- String getOntologyLocation(String ontologyId);
-
- Map<String, String> getPrefixMap() throws ComponentException;
-
- OntModel getOntology(String ontologyId);
-
- List<PortProfile> getInputPortProfiles();
-
- List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles()
- throws ComponentException;
-
- List<PortProfile> getOutputPortProfiles();
-
- List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles()
- throws ComponentException;
-
- List<ActivityProfile> getActivityProfiles();
-
- List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles()
- throws ComponentException;
-
- ExceptionHandling getExceptionHandling();
-
- void delete() throws ComponentException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
deleted file mode 100644
index c7e040f..0000000
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package io.github.taverna_extras.component.api.profile;
-/*
- * 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.
- */
-
-import java.util.List;
-
-import org.apache.jena.ontology.Individual;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntProperty;
-
-public interface SemanticAnnotationProfile {
-
- /**
- * Returns the ontology that defines semantic annotation.
- *
- * @return the ontology that defines semantic annotation
- */
- OntModel getOntology();
-
- /**
- * Returns the predicate for the semantic annotation.
- *
- * @return the predicate for the semantic annotation
- */
- OntProperty getPredicate();
-
- String getPredicateString();
-
- String getClassString();
-
- /**
- * Returns the individual that the semantic annotation must use.
- *
- * May be null if no explicit individual is required.
- *
- * @return the individual that the semantic annotation must use
- */
- Individual getIndividual();
-
- /**
- * Returns the individuals in the range of the predicate defined in the
- * ontology.
- *
- * @return the individuals in the range of the predicate defined in the
- * ontology
- */
- List<Individual> getIndividuals();
-
- Integer getMinOccurs();
-
- Integer getMaxOccurs();
-
- OntClass getRangeClass();
-
-}
\ No newline at end of file
[09/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
deleted file mode 100644
index 6a89454..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/annotations/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-/**
- * Miscellaneous annotations on other parts of the component engine.
- *
- * @author Donal Fellows
- */
-package io.github.taverna_extras.component.registry.standard.annotations;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
deleted file mode 100644
index 89df01a..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/standard/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * This is the new interface to the myExperiment registry, a.k.a. μExperiment.
- * @author Donal Fellows
- */
-package io.github.taverna_extras.component.registry.standard;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
deleted file mode 100644
index a3ac463..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/AnnotationUtils.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package io.github.taverna_extras.component.utils;
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.WeakHashMap;
-
-import org.apache.taverna.scufl2.api.annotation.Annotation;
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.common.URITools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.ucfpackage.UCFPackage.ResourceEntry;
-
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.ModelFactory;
-import org.apache.jena.rdf.model.Property;
-import org.apache.jena.rdf.model.Statement;
-
-public class AnnotationUtils {
- private static final String TITLE_ANNOTATION = "http://purl.org/dc/terms/title";
- private static final String DESCRIPTION_ANNOTATION = "http://purl.org/dc/terms/description";
- private Scufl2Tools tools = new Scufl2Tools();
- private URITools uris = new URITools();
-
- public Model getAnnotationModel(Child<WorkflowBundle> subject) throws IOException {
- return ModelFactory.createDefaultModel().add(getModel(subject));
- }
-
- private WeakHashMap<Child<?>, Model> cache = new WeakHashMap<>();
-
- private static void readParse(Model model, WorkflowBundle bundle, String path)
- throws IOException {
- model.read(
- new StringReader(bundle.getResources()
- .getResourceAsString(path)), bundle.getGlobalBaseURI()
- .resolve(path).toString(), "TTL");
- }
-
- public Model getModel(Child<WorkflowBundle> subject) throws IOException {
- WorkflowBundle bundle = subject.getParent();
- Model m = cache.get(subject);
- if (m == null) {
- m = ModelFactory.createDefaultModel();
- long initialSize = m.size();
- for (Annotation a : tools.annotationsFor(subject,
- subject.getParent()))
- if (!a.getBody().isAbsolute())
- readParse(m, bundle, a.getBody().getPath());
- if (m.size() == initialSize)
- for (ResourceEntry o : bundle.getResources()
- .listResources("annotation").values())
- readParse(m, bundle, o.getPath());
- cache.put(subject, m);
- }
- return m;
- }
-
- public Statement getAnnotation(Child<WorkflowBundle> subject,
- String uriForAnnotation) throws IOException {
- Model m = getModel(subject);
- Property p = m.getProperty(uriForAnnotation);
- return m.getResource(uris.uriForBean(subject).toString()).getProperty(
- p);
- }
-
- /** Get the title of the main workflow in a workflow bundle. */
- public String getTitle(WorkflowBundle bundle, String defaultTitle) {
- try {
- Statement s = getAnnotation(bundle.getMainWorkflow(),
- TITLE_ANNOTATION);
- if (s != null && s.getObject().isLiteral())
- return s.getObject().asLiteral().getString();
- } catch (IOException e) {
- // TODO log this error?
- }
- return defaultTitle;
- }
-
- /** Get the description of the main workflow in a workflow bundle. */
- public String getDescription(WorkflowBundle bundle, String defaultDescription) {
- try {
- Statement s = getAnnotation(bundle.getMainWorkflow(),
- DESCRIPTION_ANNOTATION);
- if (s != null && s.getObject().isLiteral())
- return s.getObject().asLiteral().getString();
- } catch (IOException e) {
- // TODO log this error?
- }
- return defaultDescription;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
deleted file mode 100644
index 9a57122..0000000
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/utils/SystemUtils.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package io.github.taverna_extras.component.utils;
-/*
- * 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.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBElement;
-
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.registry.api.Description;
-import org.apache.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.platform.execution.api.InvalidWorkflowException;
-import org.apache.taverna.platform.execution.api.WorkflowCompiler;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.workflowmodel.Dataflow;
-
-public class SystemUtils {
- private static final String T2FLOW_TYPE = "application/vnd.taverna.t2flow+xml";
- private static final String SCUFL2_TYPE = "application/vnd.taverna.scufl2.workflow-bundle";
- private ApplicationConfiguration appConfig;
- private WorkflowBundleIO workflowBundleIO;
- private List<WorkflowCompiler> compilers;
-
- public byte[] serializeBundle(WorkflowBundle bundle) throws ComponentException {
- try {
- ByteArrayOutputStream dataflowStream = new ByteArrayOutputStream();
- workflowBundleIO.writeBundle(bundle, dataflowStream, SCUFL2_TYPE);
- return dataflowStream.toByteArray();
- } catch (Exception e) {
- throw new ComponentException(
- "failed to serialize component implementation", e);
- }
- }
-
- private String determineMediaTypeForFilename(File file) {
- String[] pieces = file.getName().split("\\.");
- switch (pieces[pieces.length - 1]) {
- case "t2flow":
- return T2FLOW_TYPE;
- default:
- return SCUFL2_TYPE;
- }
- }
-
- public void saveBundle(WorkflowBundle bundle, File file) throws Exception {
- workflowBundleIO.writeBundle(bundle, file,
- determineMediaTypeForFilename(file));
- }
-
- public WorkflowBundle getBundleFromUri(String uri) throws Exception {
- return workflowBundleIO.readBundle(new URL(uri), null);
- }
-
- public WorkflowBundle getBundle(File file) throws Exception {
- return workflowBundleIO.readBundle(file, null);
- }
-
- public static JAXBElement<?> getElement(Description d, String name)
- throws ComponentException {
- for (Object o : d.getContent())
- if (o instanceof JAXBElement) {
- JAXBElement<?> el = (JAXBElement<?>) o;
- if (el.getName().getLocalPart().equals(name))
- return el;
- }
- throw new ComponentException("no " + name + " element");
- }
-
- public static String getElementString(Description d, String name)
- throws ComponentException {
- return getElement(d, name).getValue().toString().trim();
- }
-
- public static String getValue(Description d) {
- StringBuilder sb = new StringBuilder();
- for (Object o : d.getContent())
- if (!(o instanceof JAXBElement))
- sb.append(o);
- return sb.toString();
- }
-
- public File getApplicationHomeDir() {
- return appConfig.getApplicationHomeDir().toFile();
- }
-
- public void setAppConfig(ApplicationConfiguration appConfig) {
- this.appConfig = appConfig;
- }
-
- public void setWorkflowBundler(WorkflowBundleIO workflowBundler) {
- this.workflowBundleIO = workflowBundler;
- }
-
- public void setCompilers(List<WorkflowCompiler> compilers) {
- this.compilers = compilers;
- }
-
- public Dataflow compile(WorkflowBundle implementation)
- throws InvalidWorkflowException {
- InvalidWorkflowException exn = null;
- if (compilers != null)
- for (WorkflowCompiler c : new ArrayList<>(compilers))
- try {
- return c.getDataflow(implementation);
- } catch (InvalidWorkflowException e) {
- if (exn == null)
- exn = e;
- continue;
- }
- if (exn != null)
- throw exn;
- throw new InvalidWorkflowException("no compiler available");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/AnnotationTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/AnnotationTest.java
new file mode 100644
index 0000000..6b885c3
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/AnnotationTest.java
@@ -0,0 +1,48 @@
+package io.github.taverna_extras.component;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.ReaderException;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class AnnotationTest {
+ //org.apache.taverna.scufl2.annotation.AnnotationTools anntoo;
+ @Test
+ public void test() throws ReaderException, IOException {
+ AnnotationUtils au = new AnnotationUtils();
+ WorkflowBundleIO b = new WorkflowBundleIO();
+ final String WORKFLOW_FILE = "/hello_anyone.wfbundle";
+ final String TITLE = "Hello Anyone";
+ final String DESC = "An extension to helloworld.t2flow - this workflow takes a workflow input \"name\" which is combined with the string constant \"Hello, \" using the local worker \"Concatenate two strings\", and outputs the produced string to the workflow output \"greeting\".";
+
+ WorkflowBundle bdl = b.readBundle(
+ getClass().getResource(WORKFLOW_FILE), null);
+ assertEquals(TITLE, au.getTitle(bdl, "---NOT---GIVEN---"));
+ assertEquals(DESC, au.getDescription(bdl, "---NOT---GIVEN---"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/ComponentActivityTest.java
new file mode 100644
index 0000000..63ce804
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/ComponentActivityTest.java
@@ -0,0 +1,125 @@
+package io.github.taverna_extras.component;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.activity.ComponentActivity;
+import io.github.taverna_extras.component.activity.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.activity.ComponentActivityFactory;
+
+
+public class ComponentActivityTest {
+
+ @SuppressWarnings("unused")
+ private ComponentActivityConfigurationBean configBean;
+
+ @SuppressWarnings("unused")
+ private ComponentActivity activity = new ComponentActivityFactory().createActivity(); // FIXME
+
+/* @Before
+ public void makeConfigBean() throws Exception {
+ configBean = new ComponentActivityConfigurationBean();
+ configBean.setExampleString("something");
+ configBean
+ .setExampleUri(URI.create("http://localhost:8080/myEndPoint"));
+ }
+
+ @Test(expected = ActivityConfigurationException.class)
+ public void invalidConfiguration() throws ActivityConfigurationException {
+ ComponentActivityConfigurationBean invalidBean = new ComponentActivityConfigurationBean();
+ invalidBean.setExampleString("invalidExample");
+ // Should throw ActivityConfigurationException
+ activity.configure(invalidBean);
+ }
+
+ @Test
+ public void executeAsynch() throws Exception {
+ activity.configure(configBean);
+
+ Map<String, Object> inputs = new HashMap<String, Object>();
+ inputs.put("firstInput", "hello");
+
+ Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
+ expectedOutputTypes.put("simpleOutput", String.class);
+ expectedOutputTypes.put("moreOutputs", String.class);
+
+ Map<String, Object> outputs = ActivityInvoker.invokeAsyncActivity(
+ activity, inputs, expectedOutputTypes);
+
+ assertEquals("Unexpected outputs", 2, outputs.size());
+ assertEquals("simple", outputs.get("simpleOutput"));
+ assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
+ .get("moreOutputs"));
+
+ }
+
+ @Test
+ public void reConfiguredActivity() throws Exception {
+ assertEquals("Unexpected inputs", 0, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 0, activity.getOutputPorts().size());
+
+ activity.configure(configBean);
+ assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
+
+ activity.configure(configBean);
+ // Should not change on reconfigure
+ assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
+ }
+
+ @Test
+ public void reConfiguredSpecialPorts() throws Exception {
+ activity.configure(configBean);
+
+ ComponentActivityConfigurationBean specialBean = new ComponentActivityConfigurationBean();
+ specialBean.setExampleString("specialCase");
+ specialBean.setExampleUri(URI
+ .create("http://localhost:8080/myEndPoint"));
+ activity.configure(specialBean);
+ // Should now have added the optional ports
+ assertEquals("Unexpected inputs", 2, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 3, activity.getOutputPorts().size());
+ }
+
+ @Test
+ public void configureActivity() throws Exception {
+ Set<String> expectedInputs = new HashSet<String>();
+ expectedInputs.add("firstInput");
+
+ Set<String> expectedOutputs = new HashSet<String>();
+ expectedOutputs.add("simpleOutput");
+ expectedOutputs.add("moreOutputs");
+
+ activity.configure(configBean);
+
+ Set<ActivityInputPort> inputPorts = activity.getInputPorts();
+ assertEquals(expectedInputs.size(), inputPorts.size());
+ for (ActivityInputPort inputPort : inputPorts) {
+ assertTrue("Wrong input : " + inputPort.getName(), expectedInputs
+ .remove(inputPort.getName()));
+ }
+
+ Set<OutputPort> outputPorts = activity.getOutputPorts();
+ assertEquals(expectedOutputs.size(), outputPorts.size());
+ for (OutputPort outputPort : outputPorts) {
+ assertTrue("Wrong output : " + outputPort.getName(),
+ expectedOutputs.remove(outputPort.getName()));
+ }
+ }*/
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentFamilyTest.java
new file mode 100644
index 0000000..29e4473
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentFamilyTest.java
@@ -0,0 +1,122 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentFamilyTest extends Harness {
+ private Family componentFamily;
+ private Profile componentProfile;
+ private WorkflowBundle bundle;
+
+ @Before
+ public void setup() throws Exception {
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ componentProfile = util.getProfile(componentProfileUrl);
+ componentRegistry.addComponentProfile(componentProfile, null, null);
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetComponentRegistry() throws Exception {
+ assertEquals(componentRegistry, componentFamily.getComponentRegistry());
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ assertEquals("Test Component Family", componentFamily.getName());
+ assertEquals("Test Component Family", componentFamily.getName());
+ }
+
+ @Test
+ public void testGetComponentProfile() throws Exception {
+ Profile componentProfile2 = componentFamily.getComponentProfile();
+ assertNotNull(componentProfile2);
+ String id = componentProfile.getId();
+ String id2 = componentProfile2.getId();
+ assertEquals(id, id2);
+ }
+
+ @Test
+ public void testGetComponents() throws Exception {
+ assertEquals(0, componentFamily.getComponents().size());
+ assertEquals(0, componentFamily.getComponents().size());
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertEquals(1, componentFamily.getComponents().size());
+ assertTrue(componentFamily.getComponents().contains(
+ componentVersion.getComponent()));
+ // componentFamily.removeComponent(componentVersion.getComponent());
+ // assertEquals(0, componentFamily.getComponents().size());
+ }
+
+ @Test
+ public void testCreateComponentBasedOn() throws Exception {
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertEquals("Test Component", componentVersion.getComponent()
+ .getName());
+ }
+
+ @Test
+ public void testGetComponent() throws Exception {
+ assertNull(componentFamily.getComponent("Test Component"));
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertNotNull(componentFamily.getComponent("Test Component"));
+ assertEquals(componentVersion.getComponent(),
+ componentFamily.getComponent("Test Component"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentRegistryTest.java
new file mode 100644
index 0000000..f5328cc
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentRegistryTest.java
@@ -0,0 +1,181 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.List;
+
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public abstract class ComponentRegistryTest extends Harness {
+ private Profile componentProfile;
+
+ @Before
+ public void setup() throws Exception {
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ componentProfile = util.getProfile(componentProfileUrl);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ for (Family componentFamily : componentRegistry.getComponentFamilies()) {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+ }
+
+ @Test
+ public void testGetComponentFamilies() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertTrue(componentRegistry.getComponentFamilies().contains(
+ componentFamily));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ }
+
+ @Test
+ public void testGetComponentFamily() throws Exception {
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test
+ public void testCreateComponentFamily() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals("TestComponentFamily", componentFamily.getName());
+ assertEquals(componentRegistry, componentFamily.getComponentRegistry());
+ assertEquals(0, componentFamily.getComponents().size());
+ // assertEquals(componentProfile,
+ // componentFamily.getComponentProfile());
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyDuplicate() throws Exception {
+ componentRegistry.createComponentFamily("TestComponentFamily",
+ componentProfile, "Some description", null, null);
+ componentRegistry.createComponentFamily("TestComponentFamily",
+ componentProfile, "Some description", null, null);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyNullProfile() throws Exception {
+ componentRegistry.createComponentFamily("TestComponentFamily", null,
+ "Some description", null, null);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyNullName() throws Exception {
+ componentRegistry.createComponentFamily(null, componentProfile,
+ "Some description", null, null);
+ }
+
+ @Test
+ public void testRemoveComponentFamily() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test
+ public void testGetResistryBase() throws Exception {
+ assertEquals(componentRegistryUrl, componentRegistry.getRegistryBase());
+ }
+
+ @Test
+ public void testGetComponentProfiles() throws Exception {
+ assertNotNull(componentRegistry.getComponentProfiles());
+ }
+
+ @Test
+ public void testAddComponentProfile() throws Exception {
+ List<Profile> componentProfiles = componentRegistry
+ .getComponentProfiles();
+ boolean contained = false;
+ for (Profile p : componentProfiles) {
+ if (p.getId().equals(componentProfile.getId())) {
+ contained = true;
+ }
+ }
+ assertFalse(contained);
+ int componentProfileCount = componentProfiles.size();
+ componentRegistry.addComponentProfile(componentProfile, null, null);
+ int newSize = componentRegistry.getComponentProfiles().size();
+ assertEquals(componentProfileCount + 1, newSize);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testAddComponentProfileNullProfile() throws Exception {
+ componentRegistry.addComponentProfile(null, null, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentTest.java
new file mode 100644
index 0000000..0ced0c8
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentTest.java
@@ -0,0 +1,111 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentTest extends Harness {
+ private Family componentFamily;
+ private Component component;
+ private WorkflowBundle bundle;
+
+ @Before
+ public void setUp() throws Exception {
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ Profile componentProfile = util
+ .getProfile(componentProfileUrl);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ component = componentFamily.createComponentBasedOn("Test Component",
+ "Some description", bundle).getComponent();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ assertEquals("Test Component", component.getName());
+ assertEquals("Test Component", component.getName());
+ }
+
+ @Test
+ public void testGetComponentVersionMap() throws Exception {
+ assertNotNull(component.getComponentVersionMap());
+ assertEquals(1, component.getComponentVersionMap().size());
+ assertEquals(component, component.getComponentVersionMap().get(1)
+ .getComponent());
+ }
+
+ @Test
+ public void testGetComponentVersion() throws Exception {
+ assertNotNull(component.getComponentVersion(1));
+ assertNull(component.getComponentVersion(2));
+ }
+
+ @Test
+ public void testAddVersionBasedOn() throws Exception {
+ assertNotNull(component.getComponentVersion(1));
+ assertNull(component.getComponentVersion(2));
+ Version componentVersion = component.addVersionBasedOn(bundle,
+ "Some description");
+ assertNotNull(componentVersion);
+ assertEquals(component, componentVersion.getComponent());
+ assertEquals(2, componentVersion.getVersionNumber().intValue());
+ assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
+ .getIdentifier());
+ }
+
+ @Test
+ public void testGetComponentURL() throws Exception {
+ assertNotNull(component.getComponentURL());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentVersionTest.java
new file mode 100644
index 0000000..48b320b
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/ComponentVersionTest.java
@@ -0,0 +1,94 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentVersionTest extends Harness {
+ private Family componentFamily;
+ private WorkflowBundle bundle;
+ private Version componentVersion;
+
+ @Before
+ public void setUp() throws Exception {
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ Profile componentProfile = util.getProfile(componentProfileUrl);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetVersionNumber() throws Exception {
+ assertNotNull(componentVersion.getVersionNumber());
+ assertEquals(componentVersion.getVersionNumber(),
+ componentVersion.getVersionNumber());
+ }
+
+ @Test
+ public void testGetDescription() throws Exception {
+ assertNotNull(componentVersion.getDescription());
+ }
+
+ @Test
+ public void testGetDataflow() throws Exception {
+ assertNotNull(componentVersion.getImplementation());
+ assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
+ .getIdentifier());
+ }
+
+ @Test
+ public void testGetComponent() throws Exception {
+ assertNotNull(componentVersion.getComponent());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/Harness.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/Harness.java
new file mode 100644
index 0000000..663704c
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/Harness.java
@@ -0,0 +1,30 @@
+package io.github.taverna_extras.component.registry;
+/*
+ * 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.
+ */
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+
+public class Harness {
+ public static URL componentRegistryUrl;
+ public static Registry componentRegistry;
+ public static ComponentUtil util;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentFamilyTest.java
new file mode 100644
index 0000000..b5791e8
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentFamilyTest.java
@@ -0,0 +1,40 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentFamilyTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentFamilyTest extends ComponentFamilyTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryTest.java
new file mode 100644
index 0000000..2a57e1c
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentRegistryTest.java
@@ -0,0 +1,59 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertSame;
+
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.registry.ComponentRegistryTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentRegistryTest extends ComponentRegistryTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+
+ @Test
+ public void testGetComponentRegistry() throws Exception {
+ Registry getAgain = RegistrySupport.factory
+ .getComponentRegistry(componentRegistryUrl);
+ assertSame(componentRegistry, getAgain);
+ }
+
+ @Test
+ @Ignore("broken")
+ @Override
+ public void testAddComponentProfile() throws Exception {
+ super.testAddComponentProfile();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentTest.java
new file mode 100644
index 0000000..f82e591
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentTest.java
@@ -0,0 +1,40 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentTest extends ComponentTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentVersionTest.java
new file mode 100644
index 0000000..f08425e
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/LocalComponentVersionTest.java
@@ -0,0 +1,40 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentVersionTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentVersionTest extends ComponentVersionTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/RegistrySupport.java
new file mode 100644
index 0000000..cac3eff
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/local/RegistrySupport.java
@@ -0,0 +1,44 @@
+package io.github.taverna_extras.component.registry.local;
+/*
+ * 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.
+ */
+
+import static java.lang.System.getProperty;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
+
+import java.io.File;
+
+import io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory;
+
+class RegistrySupport {
+ private static File testRegistry;
+ final static LocalComponentRegistryFactory factory = new LocalComponentRegistryFactory();
+
+ public static void pre() throws Exception {
+ testRegistry = new File(getProperty("java.io.tmpdir"), "TestRegistry");
+ testRegistry.mkdir();
+ componentRegistryUrl = testRegistry.toURI().toURL();
+ componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
+ }
+
+ public static void post() throws Exception {
+ deleteDirectory(testRegistry);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentFamilyTest.java
new file mode 100644
index 0000000..bb06af5
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentFamilyTest.java
@@ -0,0 +1,42 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentFamilyTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class NewComponentFamilyTest extends ComponentFamilyTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryTest.java
new file mode 100644
index 0000000..86417d5
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentRegistryTest.java
@@ -0,0 +1,75 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.registry.ComponentRegistryTest;
+import io.github.taverna_extras.component.registry.standard.NewComponent;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
+import io.github.taverna_extras.component.registry.standard.Policy;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore("affects remote service")
+public class NewComponentRegistryTest extends ComponentRegistryTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+
+ @Test
+ public void testGetComponentRegistry() throws Exception {
+ assertSame(componentRegistry,
+ RegistrySupport.factory.getComponentRegistry(componentRegistryUrl));
+ }
+
+ @Test
+ public void testUploadWorkflow() throws Exception {
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ WorkflowBundle bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+
+ NewComponentRegistry registry = (NewComponentRegistry) RegistrySupport.factory.getComponentRegistry(componentRegistryUrl);
+ Version v = registry.createComponentFrom(null, "Test Workflow",
+ "test description", bundle, null, Policy.PRIVATE);
+ assertEquals("test description", v.getDescription());
+ registry.deleteComponent((NewComponent) v.getComponent());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentTest.java
new file mode 100644
index 0000000..2281cb0
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentTest.java
@@ -0,0 +1,42 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class NewComponentTest extends ComponentTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentVersionTest.java
new file mode 100644
index 0000000..cad04eb
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/NewComponentVersionTest.java
@@ -0,0 +1,42 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import io.github.taverna_extras.component.registry.ComponentVersionTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class NewComponentVersionTest extends ComponentVersionTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/RegistrySupport.java
new file mode 100644
index 0000000..a1d0fef
--- /dev/null
+++ b/taverna-component-activity/src/test/java/io/github/taverna_extras/component/registry/standard/RegistrySupport.java
@@ -0,0 +1,55 @@
+package io.github.taverna_extras.component.registry.standard;
+/*
+ * 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.
+ */
+
+import static io.github.taverna_extras.component.registry.Harness.componentRegistry;
+import static io.github.taverna_extras.component.registry.Harness.componentRegistryUrl;
+
+import java.net.URL;
+
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.registry.standard.NewComponent;
+import io.github.taverna_extras.component.registry.standard.NewComponentFamily;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistry;
+import io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory;
+
+class RegistrySupport {
+ static final String DEPLOYMENT = "http://aeon.cs.man.ac.uk:3006";
+ static final NewComponentRegistryFactory factory = new NewComponentRegistryFactory();// FIXME
+
+ public static void pre() throws Exception {
+ componentRegistryUrl = new URL(DEPLOYMENT);
+ componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
+ }
+
+ public static void post() throws Exception {
+ NewComponentRegistry registry = (NewComponentRegistry) factory
+ .getComponentRegistry(componentRegistryUrl);
+ for (Profile p : registry.getComponentProfiles())
+ registry.client.delete("/file.xml", "id=" + p.getId());
+ for (Family f : registry.getComponentFamilies()) {
+ for (Component c : f.getComponents())
+ registry.deleteComponent((NewComponent) c);
+ registry.client.delete("/pack.xml", "id="
+ + ((NewComponentFamily) f).getId());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
deleted file mode 100644
index 6b885c3..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.github.taverna_extras.component;
-/*
- * 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.
- */
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import io.github.taverna_extras.component.utils.AnnotationUtils;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class AnnotationTest {
- //org.apache.taverna.scufl2.annotation.AnnotationTools anntoo;
- @Test
- public void test() throws ReaderException, IOException {
- AnnotationUtils au = new AnnotationUtils();
- WorkflowBundleIO b = new WorkflowBundleIO();
- final String WORKFLOW_FILE = "/hello_anyone.wfbundle";
- final String TITLE = "Hello Anyone";
- final String DESC = "An extension to helloworld.t2flow - this workflow takes a workflow input \"name\" which is combined with the string constant \"Hello, \" using the local worker \"Concatenate two strings\", and outputs the produced string to the workflow output \"greeting\".";
-
- WorkflowBundle bdl = b.readBundle(
- getClass().getResource(WORKFLOW_FILE), null);
- assertEquals(TITLE, au.getTitle(bdl, "---NOT---GIVEN---"));
- assertEquals(DESC, au.getDescription(bdl, "---NOT---GIVEN---"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
deleted file mode 100644
index 63ce804..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package io.github.taverna_extras.component;
-/*
- * 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.
- */
-
-import io.github.taverna_extras.component.activity.ComponentActivity;
-import io.github.taverna_extras.component.activity.ComponentActivityConfigurationBean;
-import io.github.taverna_extras.component.activity.ComponentActivityFactory;
-
-
-public class ComponentActivityTest {
-
- @SuppressWarnings("unused")
- private ComponentActivityConfigurationBean configBean;
-
- @SuppressWarnings("unused")
- private ComponentActivity activity = new ComponentActivityFactory().createActivity(); // FIXME
-
-/* @Before
- public void makeConfigBean() throws Exception {
- configBean = new ComponentActivityConfigurationBean();
- configBean.setExampleString("something");
- configBean
- .setExampleUri(URI.create("http://localhost:8080/myEndPoint"));
- }
-
- @Test(expected = ActivityConfigurationException.class)
- public void invalidConfiguration() throws ActivityConfigurationException {
- ComponentActivityConfigurationBean invalidBean = new ComponentActivityConfigurationBean();
- invalidBean.setExampleString("invalidExample");
- // Should throw ActivityConfigurationException
- activity.configure(invalidBean);
- }
-
- @Test
- public void executeAsynch() throws Exception {
- activity.configure(configBean);
-
- Map<String, Object> inputs = new HashMap<String, Object>();
- inputs.put("firstInput", "hello");
-
- Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
- expectedOutputTypes.put("simpleOutput", String.class);
- expectedOutputTypes.put("moreOutputs", String.class);
-
- Map<String, Object> outputs = ActivityInvoker.invokeAsyncActivity(
- activity, inputs, expectedOutputTypes);
-
- assertEquals("Unexpected outputs", 2, outputs.size());
- assertEquals("simple", outputs.get("simpleOutput"));
- assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
- .get("moreOutputs"));
-
- }
-
- @Test
- public void reConfiguredActivity() throws Exception {
- assertEquals("Unexpected inputs", 0, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 0, activity.getOutputPorts().size());
-
- activity.configure(configBean);
- assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
-
- activity.configure(configBean);
- // Should not change on reconfigure
- assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
- }
-
- @Test
- public void reConfiguredSpecialPorts() throws Exception {
- activity.configure(configBean);
-
- ComponentActivityConfigurationBean specialBean = new ComponentActivityConfigurationBean();
- specialBean.setExampleString("specialCase");
- specialBean.setExampleUri(URI
- .create("http://localhost:8080/myEndPoint"));
- activity.configure(specialBean);
- // Should now have added the optional ports
- assertEquals("Unexpected inputs", 2, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 3, activity.getOutputPorts().size());
- }
-
- @Test
- public void configureActivity() throws Exception {
- Set<String> expectedInputs = new HashSet<String>();
- expectedInputs.add("firstInput");
-
- Set<String> expectedOutputs = new HashSet<String>();
- expectedOutputs.add("simpleOutput");
- expectedOutputs.add("moreOutputs");
-
- activity.configure(configBean);
-
- Set<ActivityInputPort> inputPorts = activity.getInputPorts();
- assertEquals(expectedInputs.size(), inputPorts.size());
- for (ActivityInputPort inputPort : inputPorts) {
- assertTrue("Wrong input : " + inputPort.getName(), expectedInputs
- .remove(inputPort.getName()));
- }
-
- Set<OutputPort> outputPorts = activity.getOutputPorts();
- assertEquals(expectedOutputs.size(), outputPorts.size());
- for (OutputPort outputPort : outputPorts) {
- assertTrue("Wrong output : " + outputPort.getName(),
- expectedOutputs.remove(outputPort.getName()));
- }
- }*/
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
deleted file mode 100644
index 29e4473..0000000
--- a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package io.github.taverna_extras.component.registry;
-/*
- * 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.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentFamilyTest extends Harness {
- private Family componentFamily;
- private Profile componentProfile;
- private WorkflowBundle bundle;
-
- @Before
- public void setup() throws Exception {
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- componentProfile = util.getProfile(componentProfileUrl);
- componentRegistry.addComponentProfile(componentProfile, null, null);
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- assertEquals(componentRegistry, componentFamily.getComponentRegistry());
- }
-
- @Test
- public void testGetName() throws Exception {
- assertEquals("Test Component Family", componentFamily.getName());
- assertEquals("Test Component Family", componentFamily.getName());
- }
-
- @Test
- public void testGetComponentProfile() throws Exception {
- Profile componentProfile2 = componentFamily.getComponentProfile();
- assertNotNull(componentProfile2);
- String id = componentProfile.getId();
- String id2 = componentProfile2.getId();
- assertEquals(id, id2);
- }
-
- @Test
- public void testGetComponents() throws Exception {
- assertEquals(0, componentFamily.getComponents().size());
- assertEquals(0, componentFamily.getComponents().size());
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertEquals(1, componentFamily.getComponents().size());
- assertTrue(componentFamily.getComponents().contains(
- componentVersion.getComponent()));
- // componentFamily.removeComponent(componentVersion.getComponent());
- // assertEquals(0, componentFamily.getComponents().size());
- }
-
- @Test
- public void testCreateComponentBasedOn() throws Exception {
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertEquals("Test Component", componentVersion.getComponent()
- .getName());
- }
-
- @Test
- public void testGetComponent() throws Exception {
- assertNull(componentFamily.getComponent("Test Component"));
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertNotNull(componentFamily.getComponent("Test Component"));
- assertEquals(componentVersion.getComponent(),
- componentFamily.getComponent("Test Component"));
- }
-
-}
[16/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
deleted file mode 100644
index 1d393c5..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-
-/**
- * @author alanrw
- */
-public class RegistryAndFamilyChooserComponentEntryPanel extends JPanel {
- private static final long serialVersionUID = -6675545311458594678L;
- private static final String T2FLOW = ".t2flow";
- private static final String WFBUNDLE = ".wfbundle";
-
- private JTextField componentNameField = new JTextField(20);
- private RegistryAndFamilyChooserPanel registryAndFamilyChooserPanel;
-
- public RegistryAndFamilyChooserComponentEntryPanel(ComponentPreference prefs) {
- super(new GridBagLayout());
- registryAndFamilyChooserPanel = new RegistryAndFamilyChooserPanel(prefs);
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- this.add(registryAndFamilyChooserPanel, gbc);
- gbc.gridy = 1;
-
- gbc.gridwidth = 1;
- gbc.gridx = 0;
- gbc.weightx = 0;
- gbc.fill = GridBagConstraints.NONE;
- this.add(new JLabel("Component name:"), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- this.add(componentNameField, gbc);
- }
-
- public String getComponentName() {
- return componentNameField.getText();
- }
-
- public void setComponentName(String name) {
- componentNameField.setText(name);
- }
-
- public Version.ID getComponentVersionIdentification() {
- String componentName = getComponentName();
- Family familyChoice = registryAndFamilyChooserPanel.getChosenFamily();
- Registry registry = registryAndFamilyChooserPanel.getChosenRegistry();
-
- if (familyChoice == null || registry == null || componentName == null
- || componentName.isEmpty())
- return null;
-
- return new Version.Identifier(registry.getRegistryBase(),
- familyChoice.getName(), trim(componentName), -1);
- }
-
- private static String trim(String name) {
- if (name.endsWith(WFBUNDLE))
- return name.substring(0, name.length() - WFBUNDLE.length());
- else if (name.endsWith(T2FLOW))
- return name.substring(0, name.length() - T2FLOW.length());
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
deleted file mode 100644
index bc24dca..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.List;
-
-import javax.swing.JPanel;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class RegistryAndFamilyChooserPanel extends JPanel implements
- Observer<ProfileChoiceMessage>, Observable<FamilyChoiceMessage> {
- private static Logger logger = getLogger(RegistryAndFamilyChooserPanel.class);
- private static final long serialVersionUID = -535518473593617735L;
- final RegistryChooserPanel registryPanel;
- final FamilyChooserPanel familyPanel;
-
- public RegistryAndFamilyChooserPanel(ComponentPreference prefs) {
- super(new GridBagLayout());
- registryPanel = new RegistryChooserPanel(prefs);
- familyPanel = new FamilyChooserPanel(registryPanel);
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- add(registryPanel, gbc);
-
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weighty = 1;
- add(familyPanel, gbc);
- }
-
- public Registry getChosenRegistry() {
- return registryPanel.getChosenRegistry();
- }
-
- public Family getChosenFamily() {
- return familyPanel.getChosenFamily();
- }
-
- @Override
- public void addObserver(Observer<FamilyChoiceMessage> observer) {
- familyPanel.addObserver(observer);
- }
-
- @Override
- public List<Observer<FamilyChoiceMessage>> getObservers() {
- return familyPanel.getObservers();
- }
-
- @Override
- public void removeObserver(Observer<FamilyChoiceMessage> observer) {
- familyPanel.removeObserver(observer);
- }
-
- @Override
- public void notify(Observable<ProfileChoiceMessage> sender,
- ProfileChoiceMessage message) {
- try {
- familyPanel.notify(sender, message);
- } catch (Exception e) {
- logger.error("problem handling notification about profile choice",
- e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
deleted file mode 100644
index 85249ca..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import io.github.taverna_extras.component.api.Registry;
-
-/**
- * @author alanrw
- */
-public class RegistryChoiceMessage {
- private final Registry chosenRegistry;
-
- public RegistryChoiceMessage(Registry chosenRegistry) {
- this.chosenRegistry = chosenRegistry;
- }
-
- /**
- * @return the chosenRegistry
- */
- public Registry getChosenRegistry() {
- return chosenRegistry;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
deleted file mode 100644
index 1e2bf78..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.Vector;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class RegistryChooserPanel extends JPanel implements
- Observable<RegistryChoiceMessage> {
- private static final String REGISTRY_LABEL = "Component registry:";
- private static final long serialVersionUID = 8390860727800654604L;
- private static final Logger logger = getLogger(RegistryChooserPanel.class);
-
- private final List<Observer<RegistryChoiceMessage>> observers = new ArrayList<>();
- private final JComboBox<String> registryBox;
- private final SortedMap<String, Registry> registryMap;
-
- public RegistryChooserPanel(ComponentPreference pref) {
- setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- registryMap = pref.getRegistryMap();
- registryBox = new JComboBox<>(new Vector<>(registryMap.keySet()));
- registryBox.setPrototypeDisplayValue(LONG_STRING);
- registryBox.setEditable(false);
-
- gbc.gridx = 0;
- gbc.anchor = WEST;
- this.add(new JLabel(REGISTRY_LABEL), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = BOTH;
- this.add(registryBox, gbc);
-
- registryBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED)
- dealWithSelection();
- }
- });
-
- String firstKey = registryMap.firstKey();
- registryBox.setSelectedItem(firstKey);
- dealWithSelection();
- }
-
- private void updateToolTipText() {
- String key = (String) registryBox.getSelectedItem();
- Registry registry = registryMap.get(key);
- registryBox.setToolTipText(registry.getRegistryBase().toString());
- }
-
- private void dealWithSelection() {
- updateToolTipText();
- Registry chosenRegistry = getChosenRegistry();
- RegistryChoiceMessage message = new RegistryChoiceMessage(
- chosenRegistry);
- for (Observer<RegistryChoiceMessage> o : getObservers())
- try {
- o.notify(this, message);
- } catch (Exception e) {
- logger.error("problem handling selection update", e);
- }
- }
-
- @Override
- public void addObserver(Observer<RegistryChoiceMessage> observer) {
- observers.add(observer);
- Registry chosenRegistry = getChosenRegistry();
- RegistryChoiceMessage message = new RegistryChoiceMessage(
- chosenRegistry);
- try {
- observer.notify(this, message);
- } catch (Exception e) {
- logger.error("problem handling addition of observer", e);
- }
- }
-
- @Override
- public List<Observer<RegistryChoiceMessage>> getObservers() {
- return observers;
- }
-
- @Override
- public void removeObserver(Observer<RegistryChoiceMessage> observer) {
- observers.remove(observer);
- }
-
- public Registry getChosenRegistry() {
- if (registryBox.getSelectedIndex() < 0)
- return null;
- return registryMap.get(registryBox.getSelectedItem());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
deleted file mode 100644
index f26cf6b..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class SearchChoicePanel extends JPanel {
- private static final Logger logger = getLogger(SearchChoicePanel.class);
- private static final String SEARCHING = "Searching...";
- private static final String[] SEARCHING_ARRAY = new String[] { SEARCHING };
- private static final String NO_MATCHES = "No matches";
- private static final String SEARCH_FAILED = "Search failed";
- private static final List<String> RESERVED_WORDS = Arrays.asList(SEARCHING,
- NO_MATCHES, SEARCH_FAILED);
-
- private ComponentPreference preference;//FIXME beaninject from constructor
- private ComponentFactory factory;//FIXME beaninject from constructor
- private Registry registry;
- private String prefixes;
- private String queryText;
- private JLabel registryURLLabel;
- private JComboBox<String> familyBox;
- private JComboBox<String> componentBox;
- private JComboBox<Object> versionBox;
-
- public SearchChoicePanel(Registry registry, String prefixes,
- String queryText) {
- super(new GridBagLayout());
- this.registry = registry;
- this.prefixes = prefixes;
- this.queryText = queryText;
-
- componentBox = new JComboBox<>(SEARCHING_ARRAY);
- componentBox.setPrototypeDisplayValue(LONG_STRING);
- familyBox = new JComboBox<>(SEARCHING_ARRAY);
- familyBox.setPrototypeDisplayValue(LONG_STRING);
- versionBox = new JComboBox<Object>(SEARCHING_ARRAY);
- versionBox.setPrototypeDisplayValue(LONG_STRING);
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- JLabel registryLabel = new JLabel("Component registry:");
-
- gbc.insets.left = 5;
- gbc.insets.right = 5;
- gbc.gridx = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 1;
- gbc.weightx = 1;
- gbc.gridy++;
- this.add(registryLabel, gbc);
- gbc.gridx = 1;
- registryURLLabel = new JLabel(SEARCHING);
- this.add(registryURLLabel, gbc);
- gbc.gridx = 0;
- gbc.gridy++;
- this.add(new JLabel("Component family:"), gbc);
- gbc.gridx = 1;
-
- this.add(familyBox, gbc);
- gbc.gridx = 0;
- gbc.gridy++;
- this.add(new JLabel("Component:"), gbc);
- gbc.gridx = 1;
- this.add(componentBox, gbc);
-
- gbc.gridx = 0;
- gbc.gridy++;
-
- this.add(new JLabel("Component version:"), gbc);
- gbc.gridx = 1;
- this.add(versionBox, gbc);
-
- new Searcher().execute();
- }
-
- private class Searcher extends SwingWorker<Set<Version.ID>, Object> {
- @Override
- protected Set<Version.ID> doInBackground() throws Exception {
- return registry.searchForComponents(prefixes, queryText);
- }
-
- @Override
- protected void done() {
- clearAll();
- try {
- Set<Version.ID> matches = get();
- if (matches.isEmpty())
- setAll(NO_MATCHES);
- else
- searchCompletedSuccessfully(matches);
- } catch (InterruptedException e) {
- logger.error("search was interrupted", e);
- setAll(SEARCH_FAILED);
- } catch (ExecutionException e) {
- logger.error("problem in execution", e.getCause());
- setAll(SEARCH_FAILED);
- }
- }
- }
-
- private void clearAll() {
- familyBox.removeAllItems();
- componentBox.removeAllItems();
- versionBox.removeAllItems();
- }
-
- private void setAll(String text) {
- registryURLLabel.setText(text);
- familyBox.addItem(text);
- componentBox.addItem(text);
- versionBox.addItem(text);
- }
-
- private String[] calculateMatchingFamilyNames(
- Set<Version.ID> matchingComponents) {
- Set<String> result = new TreeSet<>();
- for (Version.ID v : matchingComponents)
- result.add(v.getFamilyName());
- return result.toArray(new String[0]);
- }
-
- private void updateComponentBox(Set<Version.ID> matchingComponents,
- JComboBox<String> componentBox, String selectedItem) {
- componentBox.removeAllItems();
- String[] matchingComponentNames = calculateMatchingComponentNames(
- matchingComponents, selectedItem);
- for (String componentName : matchingComponentNames)
- componentBox.addItem(componentName);
- componentBox.setSelectedIndex(0);
- }
-
- private String[] calculateMatchingComponentNames(
- Set<Version.ID> matchingComponents, String familyName) {
- Set<String> result = new TreeSet<>();
- for (Version.ID v : matchingComponents)
- if (v.getFamilyName().equals(familyName))
- result.add(v.getComponentName());
- return result.toArray(new String[0]);
- }
-
- private void updateVersionBox(Set<Version.ID> matchingComponents,
- JComboBox<Object> versionBox, String componentName,
- String familyName) {
- versionBox.removeAllItems();
- for (Integer v : calculateMatchingVersionNumbers(matchingComponents,
- componentName, familyName))
- versionBox.addItem(v);
- versionBox.setSelectedIndex(0);
- }
-
- private Integer[] calculateMatchingVersionNumbers(
- Set<Version.ID> matchingComponents, String componentName,
- String familyName) {
- Set<Integer> result = new TreeSet<>();
- for (Version.ID v : matchingComponents)
- if (v.getFamilyName().equals(familyName)
- && v.getComponentName().equals(componentName))
- result.add(v.getComponentVersion());
- return result.toArray(new Integer[0]);
- }
-
- public Version.ID getVersionIdentification() {
- String registryString = registryURLLabel.getText();
- if (RESERVED_WORDS.contains(registryString))
- return null;
-
- try {
- return factory.getVersion(registry.getRegistryBase(),
- (String) familyBox.getSelectedItem(),
- (String) componentBox.getSelectedItem(),
- (Integer) versionBox.getSelectedItem()).getID();
- } catch (ComponentException e) {
- logger.warn(
- "unexpected failure to construct component version token",
- e);
- return null;
- }
- }
-
- private void searchCompletedSuccessfully(final Set<Version.ID> matches) {
- Version.ID one = (Version.ID) matches.toArray()[0];
- registryURLLabel.setText(preference.getRegistryName(one
- .getRegistryBase()));
- for (String familyName : calculateMatchingFamilyNames(matches))
- familyBox.addItem(familyName);
- familyBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == SELECTED)
- updateComponentBox(matches, componentBox,
- (String) familyBox.getSelectedItem());
- }
- });
- componentBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == SELECTED)
- updateVersionBox(matches, versionBox,
- (String) componentBox.getSelectedItem(),
- (String) familyBox.getSelectedItem());
- }
- });
- familyBox.setSelectedIndex(0);
- updateComponentBox(matches, componentBox,
- (String) familyBox.getSelectedItem());
- updateVersionBox(matches, versionBox,
- (String) componentBox.getSelectedItem(),
- (String) familyBox.getSelectedItem());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
deleted file mode 100644
index 3625a84..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.panel;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class SharingPolicyChooserPanel extends JPanel {
- private static final String SHARING_LABEL = "Sharing policy:";
- private static final String READING_MSG = "Reading sharing policies";
- private static final String NO_PERMISSIONS_MSG = "No permissions available";
- private static final long serialVersionUID = 2175274929391537032L;
- private static final Logger logger = getLogger(SharingPolicyChooserPanel.class);
-
- private final JComboBox<String> permissionBox = new JComboBox<>();
- private final SortedMap<String, SharingPolicy> permissionMap = new TreeMap<>();
- private Registry registry;
-
- public SharingPolicyChooserPanel(RegistryChooserPanel registryPanel) {
- this();
- registryPanel.addObserver(new Observer<RegistryChoiceMessage>(){
- @Override
- public void notify(Observable<RegistryChoiceMessage> sender,
- RegistryChoiceMessage message) throws Exception {
- try {
- registry = message.getChosenRegistry();
- updateProfileModel();
- } catch (Exception e) {
- logger.error("problem when handling notification of registry", e);
- }
- }
- });
- }
- public SharingPolicyChooserPanel() {
- super();
- permissionBox.setPrototypeDisplayValue(LONG_STRING);
- this.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = NONE;
- this.add(new JLabel(SHARING_LABEL), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- gbc.fill = BOTH;
- this.add(permissionBox, gbc);
-
- permissionBox.setEditable(false);
- }
-
- private void updateProfileModel() {
- permissionMap.clear();
- permissionBox.removeAllItems();
- permissionBox.addItem(READING_MSG);
- permissionBox.setEnabled(false);
- new SharingPolicyUpdater().execute();
- }
-
- public SharingPolicy getChosenPermission() {
- if (permissionBox.getSelectedIndex() < 0)
- return null;
- return permissionMap.get(permissionBox.getSelectedItem());
- }
-
- private class SharingPolicyUpdater extends SwingWorker<String, Object> {
- @Override
- protected String doInBackground() throws Exception {
- List<SharingPolicy> sharingPolicies;
- if (registry == null)
- return null;
- try {
- sharingPolicies = registry.getPermissions();
- if (sharingPolicies == null)
- return null;
- } catch (ComponentException e) {
- logger.error("problem getting permissions", e);
- throw e;
- } catch (NullPointerException e) {
- logger.error("null pointer getting permissions", e);
- throw e;
- }
-
- for (SharingPolicy policy : sharingPolicies)
- try {
- permissionMap.put(policy.getName(), policy);
- } catch (NullPointerException e) {
- logger.error("problem getting name of policy", e);
- }
- return null;
- }
-
- @Override
- protected void done() {
- permissionBox.removeAllItems();
- try {
- get();
- for (String name : permissionMap.keySet())
- permissionBox.addItem(name);
- if (!permissionMap.isEmpty()) {
- String firstKey = permissionMap.firstKey();
- permissionBox.setSelectedItem(firstKey);
- } else {
- permissionBox.addItem(NO_PERMISSIONS_MSG);
- }
- } catch (InterruptedException | ExecutionException e) {
- logger.error(e);
- permissionBox.addItem("Unable to read permissions");
- }
- permissionBox.setEnabled(!permissionMap.isEmpty());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
deleted file mode 100644
index faad899..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import java.io.File;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * Factored out defaults location system.
- *
- * @author Donal Fellows
- */
-public class ComponentDefaults {
- public static final String REGISTRY_LIST = "REGISTRY_NAMES";
- private static final String LOCAL_NAME = "local registry";
- private static final String MYEXPERIMENT_NAME = "myExperiment";
- private static final String MYEXPERIMENT_SITE = "http://www.myexperiment.org";
- public static final String DEFAULT_REGISTRY_LIST = LOCAL_NAME + "," + MYEXPERIMENT_NAME;
-
- public static Map<String, String> getDefaultProperties() {
- // Capacity = 3; we know that this is going to have 3 entries
- Map<String, String> defaults = new LinkedHashMap<>(3);
- defaults.put(LOCAL_NAME, calculateComponentsDirectoryPath());
- defaults.put(MYEXPERIMENT_NAME, MYEXPERIMENT_SITE);
- defaults.put(REGISTRY_LIST, DEFAULT_REGISTRY_LIST);
- return defaults;
- }
-
- static ApplicationConfiguration config;//FIXME beaninject (and beanify!)
-
- public static String calculateComponentsDirectoryPath() {
- return new File(config.getApplicationHomeDir(), "components").toURI()
- .toASCIIString();
- }
-
- private ComponentDefaults() {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
deleted file mode 100644
index b7ff333..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import static org.apache.commons.lang.StringUtils.join;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.REGISTRY_LIST;
-import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.getDefaultProperties;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Registry;
-import org.apache.taverna.configuration.AbstractConfigurable;
-import org.apache.taverna.configuration.ConfigurationManager;
-
-/**
- * @author alanrw
- */
-public class ComponentPreference extends AbstractConfigurable {
- public static final String DISPLAY_NAME = "Components";
- private final Logger logger = getLogger(ComponentPreference.class);
-
- private SortedMap<String, Registry> registryMap = new TreeMap<>();
- private ComponentFactory factory;
-
- public ComponentPreference(ConfigurationManager cm, ComponentFactory factory) {
- super(cm);
- this.factory = factory;
- updateRegistryMap();
- }
-
- private void updateRegistryMap() {
- registryMap.clear();
-
- for (String key : getRegistryKeys()) {
- String value = super.getProperty(key);
- try {
- registryMap.put(key, factory.getRegistry(new URL(
- value)));
- } catch (MalformedURLException e) {
- logger.error("bogus url (" + value
- + ") in configuration file", e);
- } catch (ComponentException e) {
- logger.error("failed to construct registry handle for "
- + value, e);
- }
- }
- }
-
- private String[] getRegistryKeys() {
- String registryNamesConcatenated = super.getProperty(REGISTRY_LIST);
- if (registryNamesConcatenated == null)
- return getDefaultPropertyMap().keySet().toArray(new String[]{});
- return registryNamesConcatenated.split(",");
- }
-
- @Override
- public String getFilePrefix() {
- return "Component";
- }
-
- @Override
- public String getUUID() {
- return "2317A297-2AE0-42B5-86DC-99C9B7C0524A";
- }
-
- /**
- * @return the registryMap
- */
- public SortedMap<String, Registry> getRegistryMap() {
- return registryMap;
- }
-
- public String getRegistryName(URL registryBase) {
- // Trim trailing '/' characters to ensure match.
- String base = registryBase.toString();
- while (base.endsWith("/"))
- base = base.substring(0, base.length() - 1);
-
- for (Entry<String, Registry> entry : registryMap.entrySet())
- if (entry.getValue().getRegistryBaseString().equals(base))
- return entry.getKey();
- return base;
- }
-
- public void setRegistryMap(SortedMap<String, Registry> registries) {
- registryMap.clear();
- registryMap.putAll(registries);
- super.clear();
- List<String> keyList = new ArrayList<>();
- for (Entry<String, Registry> entry : registryMap.entrySet()) {
- String key = entry.getKey();
- keyList.add(key);
- super.setProperty(key, entry.getValue().getRegistryBaseString());
- }
- Collections.sort(keyList);
- String registryNamesConcatenated = join(keyList, ",");
- super.setProperty(REGISTRY_LIST, registryNamesConcatenated);
- }
-
- @Override
- public Map<String, String> getDefaultPropertyMap() {
- return getDefaultProperties();
- }
-
- @Override
- public String getDisplayName() {
- return DISPLAY_NAME;
- }
-
- @Override
- public String getCategory() {
- return "general";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
deleted file mode 100644
index 4677c0c..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.CENTER;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN;
-import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.URL_PATTERN;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.awt.event.MouseEvent;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Registry;
-import org.apache.taverna.lang.ui.DeselectingButton;
-import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
-import org.apache.taverna.workbench.helper.Helper;
-
-public class ComponentPreferencePanel extends JPanel {
- private static final String BAD_URL_MESSAGE = "Invalid URL";
- private static final String SET_URL_MESSAGE = "Set the URL of the profile";
- private static final String HELP_LABEL = "Help";
- private static final String RESET_LABEL = "Reset";
- private static final String APPLY_LABEL = "Apply";
- private static final String ADD_REMOTE_TITLE = "Add Remote Component Registry";
- private static final String ADD_LOCAL_TITLE = "Add Local Component Registry";
- private static final String ADD_REMOTE_LABEL = "Add remote registry";
- private static final String ADD_LOCAL_LABEL = "Add local registry";
- private static final String REMOVE_LABEL = "Remove registry";
- private static final String TITLE = "Component registry management";
- private static final String VALIDATION_MESSAGE = "Set the registry name";
- private static final String EXCEPTION_MESSAGE = "Unable to access registry at ";
- private static final String EXCEPTION_TITLE = "Component registry problem";
- private static final String INVALID_NAME = "Invalid registry name";
- private static final String DUPLICATE = "Duplicate registry name";
- private static final long serialVersionUID = 1310173658718093383L;
-
- private final Logger logger = getLogger(ComponentPreferencePanel.class);
-
- private ComponentFactory factory;
- private ComponentPreference prefs;
- private RegistryTableModel tableModel = new RegistryTableModel();
-
- @SuppressWarnings("serial")
- private JTable registryTable = new JTable(tableModel) {
- @Override
- public String getToolTipText(MouseEvent me) {
- int row = rowAtPoint(me.getPoint());
- if (row >= 0)
- return tableModel.getRowTooltipText(row);
- return super.getToolTipText(me);
- }
- };
-
- public ComponentPreferencePanel(ComponentFactory componentFactory,
- ComponentPreference preferences) {
- super(new GridBagLayout());
- factory = componentFactory;
- prefs = preferences;
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- // Title describing what kind of settings we are configuring here
- JTextArea descriptionText = new JTextArea(TITLE);
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
- gbc.anchor = WEST;
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.gridwidth = 1;
- gbc.weightx = 1.0;
- gbc.weighty = 0.0;
- gbc.fill = HORIZONTAL;
- add(descriptionText, gbc);
-
- gbc.gridy++;
- gbc.insets = new Insets(10, 0, 0, 0);
-
- registryTable.getColumnModel().getColumn(0).setPreferredWidth(20);
- registryTable.setAutoResizeMode(AUTO_RESIZE_LAST_COLUMN);
- registryTable.setSelectionMode(SINGLE_SELECTION);
- JScrollPane scrollPane = new JScrollPane(registryTable);
- // registryTable.setFillsViewportHeight(true);
-
- gbc.weighty = 1.0;
- gbc.fill = BOTH;
-
- add(scrollPane, gbc);
-
- // Add buttons panel
- gbc.gridx = 0;
- gbc.gridy++;
- gbc.weightx = 0.0;
- gbc.weighty = 0.0;
- gbc.gridwidth = 1;
- gbc.fill = HORIZONTAL;
- gbc.anchor = CENTER;
- gbc.insets = new Insets(10, 0, 0, 0);
- add(createRegistryButtonPanel(), gbc);
-
- // Add buttons panel
- gbc.gridx = 0;
- gbc.gridy++;
- gbc.weightx = 0.0;
- gbc.weighty = 0.0;
- gbc.gridwidth = 1;
- gbc.fill = HORIZONTAL;
- gbc.anchor = CENTER;
- gbc.insets = new Insets(10, 0, 0, 0);
- add(createButtonPanel(), gbc);
-
- setFields();
- }
-
- /**
- * Create the buttons for managing the list of registries.
- * @return
- */
- @SuppressWarnings("serial")
- private Component createRegistryButtonPanel() {
- JPanel panel = new JPanel();
- panel.add(new DeselectingButton(new AbstractAction(REMOVE_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- remove();
- }
- }));
- panel.add(new DeselectingButton(new AbstractAction(ADD_LOCAL_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- addLocal();
- }
- }));
- panel.add(new DeselectingButton(new AbstractAction(ADD_REMOTE_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- addRemote();
- }
- }));
- return panel;
- }
-
- /**
- * Create the panel to contain the buttons
- *
- * @return
- */
- @SuppressWarnings("serial")
- private JPanel createButtonPanel() {
- final JPanel panel = new JPanel();
- panel.add(new DeselectingButton(new AbstractAction(HELP_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- Helper.showHelp(panel);
- }
- }));
- panel.add(new DeselectingButton(new AbstractAction(RESET_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- setFields();
- }
- }));
- panel.add(new DeselectingButton(new AbstractAction(APPLY_LABEL) {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- applySettings();
- setFields();
- }
- }));
- return panel;
- }
-
- void remove() {
- int selectedRow = registryTable.getSelectedRow();
- if (selectedRow != -1)
- tableModel.removeRow(selectedRow);
- }
-
- void addLocal() {
- // Run the GUI
- LocalRegistryPanel inputPanel = new LocalRegistryPanel();
- ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
- ADD_LOCAL_TITLE, inputPanel);
- vuid.addTextComponentValidation(inputPanel.getRegistryNameField(),
- VALIDATION_MESSAGE, tableModel.getRegistryMap().keySet(),
- DUPLICATE, "[\\p{L}\\p{Digit}_.]+", INVALID_NAME);
- vuid.setSize(new Dimension(400, 250));
- if (!vuid.show(ComponentPreferencePanel.this))
- return;
-
- // Add the local registry
- String location = inputPanel.getLocationField().getText();
- File newDir = new File(location);
- try {
- tableModel.insertRegistry(inputPanel.getRegistryNameField()
- .getText(), getLocalRegistry(newDir));
- } catch (MalformedURLException e) {
- logger.error("bad url provided by user", e);
- showMessageDialog(null, EXCEPTION_MESSAGE + location,
- EXCEPTION_TITLE, ERROR_MESSAGE);
- } catch (ComponentException e) {
- logger.error("problem creating local registry", e);
- showMessageDialog(null, EXCEPTION_MESSAGE + location,
- EXCEPTION_TITLE, ERROR_MESSAGE);
- }
- }
-
- void addRemote() {
- RemoteRegistryPanel inputPanel = new RemoteRegistryPanel();
- ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
- ADD_REMOTE_TITLE, inputPanel);
- vuid.addTextComponentValidation(inputPanel.getRegistryNameField(),
- VALIDATION_MESSAGE, tableModel.getRegistryMap().keySet(),
- DUPLICATE, "[\\p{L}\\p{Digit}_.]+", INVALID_NAME);
- vuid.addTextComponentValidation(inputPanel.getLocationField(),
- SET_URL_MESSAGE, null, "", URL_PATTERN, BAD_URL_MESSAGE);
- vuid.setSize(new Dimension(400, 250));
- if (!vuid.show(ComponentPreferencePanel.this))
- return;
-
- String location = inputPanel.getLocationField().getText();
- try {
- tableModel.insertRegistry(inputPanel.getRegistryNameField()
- .getText(), getRemoteRegistry(location));
- } catch (MalformedURLException e) {
- logger.error("bad url provided by user", e);
- showMessageDialog(null, EXCEPTION_MESSAGE + location,
- EXCEPTION_TITLE, ERROR_MESSAGE);
- } catch (ComponentException e) {
- showMessageDialog(null, EXCEPTION_MESSAGE + location,
- EXCEPTION_TITLE, ERROR_MESSAGE);
- logger.error("problem creating remote registry", e);
- }
- }
-
- Registry getLocalRegistry(File location) throws ComponentException,
- MalformedURLException {
- return factory.getRegistry(location.toURI().toURL());
- }
-
- Registry getRemoteRegistry(String location) throws MalformedURLException,
- ComponentException {
- URL url = new URL(location);
- if (url.getProtocol() == null || url.getProtocol().equals("file"))
- throw new MalformedURLException(
- "may not use relative or local URLs for locating registry");
- return factory.getRegistry(url);
- }
-
- private void applySettings() {
- prefs.setRegistryMap(tableModel.getRegistryMap());
- }
-
- private void setFields() {
- tableModel.setRegistryMap(prefs.getRegistryMap());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
deleted file mode 100644
index 03ae030..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import javax.swing.JPanel;
-import org.apache.taverna.configuration.Configurable;
-import org.apache.taverna.configuration.ConfigurationUIFactory;
-
-/**
- * @author alanrw
- */
-public class ComponentPreferenceUIFactory implements ConfigurationUIFactory {
- public static final String DISPLAY_NAME = "Components";
-
- private JPanel configPanel;//FIXME beaninject
- private ComponentPreference prefs;// FIXME beaninject
-
- public ComponentPreferenceUIFactory() {
- super();
- }
-
- public void setConfigPanel(JPanel configPanel) {
- this.configPanel = configPanel;
- }
-
- public void setPreferences(ComponentPreference pref) {
- this.prefs = pref;
- }
-
- @Override
- public boolean canHandle(String uuid) {
- return uuid.equals(prefs.getUUID());
- }
-
- @Override
- public Configurable getConfigurable() {
- return prefs;
- }
-
- @Override
- public JPanel getConfigurationPanel() {
- return configPanel;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
deleted file mode 100644
index b9ba05e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JFileChooser.DIRECTORIES_ONLY;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- *
- */
-public class LocalRegistryPanel extends JPanel {
- private static final String BROWSE_LABEL = "Browse";
- private static final String LOCATION_LABEL = "Location:";
- private static final String NAME_LABEL = "Name:";
- private static final long serialVersionUID = 732945735813617327L;
-
- private final Logger logger = getLogger(LocalRegistryPanel.class);
-
- private JTextField registryNameField = new JTextField(20);
- private JTextField locationField = new JTextField(20);
-
- public LocalRegistryPanel() {
- super(new GridBagLayout());
-
- setBorder(new EmptyBorder(10, 10, 10, 10));
-
- GridBagConstraints constraints = new GridBagConstraints();
-
- constraints.anchor = WEST;
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.ipadx = 20;
- add(new JLabel(NAME_LABEL), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = HORIZONTAL;
- add(registryNameField, constraints);
-
- constraints.gridy++;
- constraints.gridx = 0;
- constraints.ipadx = 20;
- constraints.fill = NONE;
- add(new JLabel(LOCATION_LABEL), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = HORIZONTAL;
- add(locationField, constraints);
-
- constraints.gridy++;
- constraints.gridx = 0;
- constraints.ipadx = 20;
- constraints.fill = NONE;
- add(new DeselectingButton(new AbstractAction(BROWSE_LABEL) {
- private static final long serialVersionUID = -8676803966947261009L;
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- pickDirectory();
- }
- }), constraints);
- }
-
- private void pickDirectory() {
- JFileChooser chooser = new JFileChooser();
- chooser.setFileSelectionMode(DIRECTORIES_ONLY);
- int returnVal = chooser.showOpenDialog(LocalRegistryPanel.this);
- try {
- if (returnVal == APPROVE_OPTION)
- locationField.setText(chooser.getSelectedFile()
- .getCanonicalPath());
- } catch (IOException e) {
- logger.error("unexpected filesystem problem", e);
- }
- }
-
- /**
- * @return the registryNameField
- */
- public JTextField getRegistryNameField() {
- return registryNameField;
- }
-
- /**
- * @return the locationField
- */
- public JTextField getLocationField() {
- return locationField;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
deleted file mode 100644
index c3b5f04..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import static java.lang.String.format;
-
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import javax.swing.table.DefaultTableModel;
-
-import io.github.taverna_extras.component.api.Registry;
-
-/**
- * @author alanrw
- *
- */
-public class RegistryTableModel extends DefaultTableModel {
- private static final long serialVersionUID = -7789666945764974370L;
- private SortedMap<String, Registry> registryMap = new TreeMap<String, Registry>();
-
- public RegistryTableModel() {
- super(new String[] { "Registry name", "Registry location" }, 0);
- }
-
- public void setRegistryMap(SortedMap<String, Registry> registries) {
- registryMap.clear();
- registryMap.putAll(registries);
- updateRows();
- }
-
- public void updateRows() {
- super.setRowCount(0);
- for (Entry<String, Registry> entry : registryMap.entrySet())
- super.addRow(new Object[] { entry.getKey(),
- entry.getValue().getRegistryBaseString() });
- }
-
- @Override
- public boolean isCellEditable(int row, int column) {
- return false;
- }
-
- public String getRowTooltipText(int row) {
- Registry registry = registryMap.get(getValueAt(row, 0));
- return format("This is a %s registry.", registry.getRegistryTypeName());
- }
-
- @Override
- public void removeRow(int row) {
- String key = (String) getValueAt(row, 0);
- registryMap.remove(key);
- super.removeRow(row);
- }
-
- public void insertRegistry(String name, Registry newRegistry) {
- registryMap.put(name, newRegistry);
- updateRows();
- }
-
- /**
- * @return the registryMap
- */
- public SortedMap<String, Registry> getRegistryMap() {
- return registryMap;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
deleted file mode 100644
index 1f98933..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.preference;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-/**
- * @author alanrw
- *
- */
-public class RemoteRegistryPanel extends JPanel {
- private static final String LOCATION_LABEL = "Location:";
- private static final String NAME_LABEL = "Name:";
- private static final long serialVersionUID = 8833815753329010062L;
-
- private JTextField registryNameField = new JTextField(20);
- private JTextField locationField = new JTextField(20);
-
- public RemoteRegistryPanel() {
- super(new GridBagLayout());
-
- setBorder(new EmptyBorder(10, 10, 10, 10));
-
- GridBagConstraints constraints = new GridBagConstraints();
-
- constraints.anchor = WEST;
- constraints.gridx = 0;
- constraints.gridy = 0;
- constraints.ipadx = 20;
- add(new JLabel(NAME_LABEL), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = HORIZONTAL;
- add(registryNameField, constraints);
-
- constraints.gridy++;
- constraints.gridx = 0;
- constraints.ipadx = 20;
- constraints.fill = NONE;
- add(new JLabel(LOCATION_LABEL), constraints);
-
- constraints.gridx = 1;
- constraints.gridwidth = 2;
- constraints.ipadx = 0;
- constraints.weightx = 1d;
- constraints.fill = HORIZONTAL;
- add(locationField, constraints);
- }
-
- /**
- * @return the registryNameField
- */
- public JTextField getRegistryNameField() {
- return registryNameField;
- }
-
- /**
- * @return the locationField
- */
- public JTextField getLocationField() {
- return locationField;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
deleted file mode 100644
index 03b2eda..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.serviceprovider;
-
-import static java.util.Arrays.asList;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.Version.ID;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.taverna.servicedescriptions.ServiceDescription;
-
-public class ComponentServiceDesc extends ServiceDescription {
- private static Logger logger = getLogger(ComponentServiceDesc.class);
-
- private Version.ID identification;
- private final ComponentPreference preference;
- private final ComponentFactory factory;
- private final ComponentServiceIcon iconProvider;
-
- public ComponentServiceDesc(ComponentPreference preference,
- ComponentFactory factory, ComponentServiceIcon iconProvider,
- Version.ID identification) {
- this.preference = preference;
- this.factory = factory;
- this.identification = identification;
- this.iconProvider = iconProvider;
- }
-
- /**
- * The configuration bean which is to be used for configuring the
- * instantiated activity. This is built from the component identifier.
- */
- @Override
- public Configuration getActivityConfiguration() {
- Configuration config = new Configuration();
- installActivityConfiguration(config);
- return config;
- }
-
- /**
- * Make the given activity be configured to be using the component that this
- * class identifies.
- */
- public void installActivityConfiguration(Activity activity) {
- installActivityConfiguration(activity.getConfiguration());
- }
-
- /**
- * Update the given configuration to have the fields for the component that
- * this class identifies.
- */
- public void installActivityConfiguration(Configuration config) {
- ObjectNode c = config.getJsonAsObjectNode();
- ID id = getIdentification();
- c.put(REGISTRY_BASE, id.getRegistryBase().toExternalForm());
- c.put(FAMILY_NAME, id.getFamilyName());
- c.put(COMPONENT_NAME, id.getComponentName());
- c.put(COMPONENT_VERSION, id.getComponentVersion());
- config.setJson(c);
- }
-
- /**
- * An icon to represent this service description in the service palette.
- */
- @Override
- public Icon getIcon() {
- return iconProvider.getIcon();
- }
-
- /**
- * The display name that will be shown in service palette and will be used
- * as a template for processor name when added to workflow.
- */
- @Override
- public String getName() {
- return getIdentification().getComponentName();
- }
-
- /**
- * The path to this service description in the service palette. Folders will
- * be created for each element of the returned path.
- */
- @Override
- public List<String> getPath() {
- return asList("Components",
- preference.getRegistryName(identification.getRegistryBase()),
- identification.getFamilyName());
- }
-
- /**
- * Returns a list of data values uniquely identifying this component
- * description (i.e., no duplicates).
- */
- @Override
- protected List<? extends Object> getIdentifyingData() {
- return Arrays.asList(identification.getRegistryBase(),
- identification.getFamilyName(),
- identification.getComponentName());
- }
-
- @Override
- public String toString() {
- return "Component " + getName();
- }
-
- /**
- * @return the identification
- */
- public Version.ID getIdentification() {
- return identification;
- }
-
- /**
- * @param identification
- * the identification to set
- */
- public void setIdentification(Version.ID identification) {
- this.identification = identification;
- }
-
- public URL getHelpURL() {
- try {
- return factory.getVersion(getIdentification()).getHelpURL();
- } catch (ComponentException e) {
- logger.error(
- "failed to get component in order to determine its help URL",
- e);
- return null;
- }
- }
-
- @Override
- public URI getActivityType() {
- return ACTIVITY_URI;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
deleted file mode 100644
index 16e0d5f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.serviceprovider;
-
-import static io.github.taverna_extras.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
-
-public class ComponentServiceIcon implements ActivityIconSPI {
- private static class Init {
- private static Icon icon = new ImageIcon(
- ComponentServiceIcon.class.getResource("/brick.png"));
- }
-
- @Override
- public int canProvideIconScore(URI activityType) {
- if (activityType.equals(COMPONENT_ACTIVITY_URI))
- return DEFAULT_ICON + 1;
- return NO_ICON;
- }
-
- @Override
- public Icon getIcon(URI activityType) {
- return Init.icon;
- }
-
- public Icon getIcon() {
- return Init.icon;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
deleted file mode 100644
index d5350d0..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.serviceprovider;
-
-import static java.util.Arrays.asList;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-
-import javax.swing.Icon;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.taverna.servicedescriptions.AbstractConfigurableServiceProvider;
-import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider;
-import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
-
-public class ComponentServiceProvider extends
- AbstractConfigurableServiceProvider implements
- CustomizedConfigurePanelProvider {
- static final URI providerId = URI
- .create("http://taverna.sf.net/2012/service-provider/component");
- private static Logger logger = getLogger(ComponentServiceProvider.class);
-
- private final ComponentFactory factory;
- private final ComponentPreference prefs;
- private final ComponentServiceIcon iconProvider;
- private final Utils utils;
-
- public ComponentServiceProvider(ComponentFactory factory,
- ComponentPreference prefs, ComponentServiceIcon iconProvider,
- Utils utils) {
- super(makeConfig(null, null));
- this.factory = factory;
- this.prefs = prefs;
- this.iconProvider = iconProvider;
- this.utils = utils;
- }
-
- private static class Conf {
- URL registryBase;
- String familyName;
-
- Conf(Configuration config) throws MalformedURLException {
- ObjectNode node = config.getJsonAsObjectNode();
- JsonNode item = node.get(REGISTRY_BASE);
- if (item != null && !item.isNull())
- registryBase = URI.create(item.textValue()).toURL();
- item = node.get(FAMILY_NAME);
- if (item != null && !item.isNull())
- familyName = item.textValue();
- }
- }
-
- /**
- * Do the actual search for services. Return using the callBack parameter.
- */
- @Override
- public void findServiceDescriptionsAsync(
- FindServiceDescriptionsCallBack callBack) {
- Conf config;
-
- Registry registry;
- try {
- config = new Conf(getConfiguration());
- registry = factory.getRegistry(config.registryBase);
- } catch (ComponentException | MalformedURLException e) {
- logger.error("failed to get registry API", e);
- callBack.fail("Unable to read components", e);
- return;
- }
-
- try {
- List<ComponentServiceDesc> results = new ArrayList<>();
- for (Family family : registry.getComponentFamilies()) {
- // TODO get check on family name in there
- if (family.getName().equals(config.familyName))
- for (Component component : family.getComponents())
- try {
- SortedMap<Integer, Version> versions = component
- .getComponentVersionMap();
- ComponentServiceDesc newDesc = new ComponentServiceDesc(
- prefs, factory, iconProvider, versions.get(
- versions.lastKey()).getID());
- results.add(newDesc);
- } catch (Exception e) {
- logger.error("problem getting service descriptor",
- e);
- }
- callBack.partialResults(results);
- callBack.finished();
- }
- } catch (ComponentException e) {
- logger.error("problem querying registry", e);
- callBack.fail("Unable to read components", e);
- }
- }
-
- /**
- * Icon for service provider
- */
- @Override
- public Icon getIcon() {
- return iconProvider.getIcon();
- }
-
- /**
- * Name of service provider, appears in right click for 'Remove service
- * provider'
- */
- @Override
- public String getName() {
- return "Component service";
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- @Override
- public String getId() {
- return providerId.toASCIIString();
- }
-
- @Override
- protected List<? extends Object> getIdentifyingData() {
- try {
- Conf config = new Conf(getConfiguration());
- return asList(config.registryBase.toString(), config.familyName);
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void createCustomizedConfigurePanel(
- CustomizedConfigureCallBack callBack) {
- RegistryAndFamilyChooserPanel panel = new RegistryAndFamilyChooserPanel(prefs);
-
- if (showConfirmDialog(null, panel, "Component family import",
- OK_CANCEL_OPTION) != OK_OPTION)
- return;
-
- Registry registry = panel.getChosenRegistry();
- Family family = panel.getChosenFamily();
- if (registry == null || family == null)
- return;
- callBack.newProviderConfiguration(makeConfig(
- registry.getRegistryBaseString(), family.getName()));
- }
-
- private static Configuration makeConfig(String registryUrl,
- String familyName) {
- ObjectNode cfg = JsonNodeFactory.instance.objectNode();
- cfg.put(REGISTRY_BASE, registryUrl);
- cfg.put(FAMILY_NAME, familyName);
- Configuration conf = new Configuration();
- conf.setJson(cfg);
- conf.setType(providerId);
- return conf;
- }
-
- @Override
- public ServiceDescriptionProvider newInstance() {
- return new ComponentServiceProvider(factory, prefs, iconProvider, utils);
- }
-
- @Override
- public URI getType() {
- return ACTIVITY_URI;
- }
-
- @Override
- public void setType(URI type) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean accept(Visitor visitor) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void refreshProvidedComponent(Version.ID ident) {
- try {
- utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
- ident).getConfiguration());
- } catch (Exception e) {
- logger.error("Unable to refresh service panel", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
deleted file mode 100644
index 72b7458..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.serviceprovider;
-
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider.providerId;
-
-import java.net.URL;
-
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public class ComponentServiceProviderConfig {
- private URL registryBase;
- private String familyName;
-
- public ComponentServiceProviderConfig() {
- }
-
- public ComponentServiceProviderConfig(Family family) {
- registryBase = family.getComponentRegistry().getRegistryBase();
- familyName = family.getName();
- }
-
- public ComponentServiceProviderConfig(Version.ID ident) {
- registryBase = ident.getRegistryBase();
- familyName = ident.getFamilyName();
- }
-
- /**
- * @return the registryBase
- */
- public URL getRegistryBase() {
- return registryBase;
- }
-
- /**
- * @param registryBase
- * the registryBase to set
- */
- public void setRegistryBase(URL registryBase) {
- this.registryBase = registryBase;
- }
-
- /**
- * @return the familyName
- */
- public String getFamilyName() {
- return familyName;
- }
-
- /**
- * @param familyName
- * the familyName to set
- */
- public void setFamilyName(String familyName) {
- this.familyName = familyName;
- }
-
- public Configuration getConfiguration() {
- Configuration c = new Configuration();
- c.getJsonAsObjectNode().put(REGISTRY_BASE,
- registryBase.toExternalForm());
- c.getJsonAsObjectNode().put(FAMILY_NAME, familyName);
- c.setType(providerId);
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
deleted file mode 100644
index 32c606e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.serviceprovider;
-
-import java.net.URI;
-
-public interface Service {
- URI COMPONENT_ACTIVITY_URI = URI
- .create("http://ns.taverna.org.uk/2010/activity/component");
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
deleted file mode 100644
index ba4801e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.util;
-
-import org.apache.taverna.workbench.file.FileType;
-
-/**
- * The type of components.
- *
- * @author alanrw
- */
-public class ComponentFileType extends FileType {
- // TODO Change mimetype for sculf2?
- static final String COMPONENT_MIMETYPE = "application/vnd.taverna.component";
-
- private ComponentFileType() {
- }
-
- @Override
- public String getDescription() {
- return "Taverna component";
- }
-
- // Not really used
- @Override
- public String getExtension() {
- return "component";
- }
-
- @Override
- public String getMimeType() {
- return COMPONENT_MIMETYPE;
- }
-}
[21/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/Utils.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/Utils.java
new file mode 100644
index 0000000..e81cbf6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/util/Utils.java
@@ -0,0 +1,144 @@
+/*
+* 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 io.github.taverna_extras.component.ui.util;
+
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Named;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.file.FileManager;
+//import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
+//import net.sf.taverna.t2.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class Utils {
+ // From http://stackoverflow.com/questions/163360/regular-expresion-to-match-urls-in-java
+ public static String URL_PATTERN = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
+ public static final String LONG_STRING = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
+ public static final String SHORT_STRING = "XXX";
+
+ private FileManager fileManager;
+ private ServiceDescriptionRegistry registry;
+ private ComponentFactory factory;
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPrefs(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setRegistry(ServiceDescriptionRegistry registry) {
+ this.registry = registry;
+ }
+
+ public void refreshComponentServiceProvider(Configuration config) {
+ ComponentServiceProvider provider = new ComponentServiceProvider(
+ factory, prefs, icon, this);
+ provider.configure(config);
+ registry.removeServiceDescriptionProvider(provider);
+ registry.addServiceDescriptionProvider(provider);
+ }
+
+ public void removeComponentServiceProvider(Configuration config) {
+ ComponentServiceProvider provider = new ComponentServiceProvider(
+ factory, prefs, icon, this);
+ provider.configure(config);
+ registry.removeServiceDescriptionProvider(provider);
+ }
+
+ public boolean dataflowIsComponent(WorkflowBundle d) {
+ if (d == null)
+ return false;
+ Object dataflowSource = fileManager.getDataflowSource(d);
+ return dataflowSource instanceof Version.ID;// FIXME Really?
+ }
+
+ public boolean currentDataflowIsComponent() {
+ return dataflowIsComponent(fileManager.getCurrentDataflow());
+ }
+
+ public static boolean isComponentActivity(Object obj) {
+ if (obj == null || !(obj instanceof Activity))
+ return false;
+ Configuration cfg = ((Activity) obj).getConfiguration();
+ return cfg != null && ACTIVITY_URI.equals(cfg.getType());
+ }
+
+ private static final Pattern SANITIZER_RE = Pattern
+ .compile("[^a-zA-Z0-9]+");
+ private static final Pattern SUFFIXED_RE = Pattern
+ .compile("^(.+)_([0-9]+)$");
+
+ /**
+ * Pick a name that is unique within the context set. This is done by
+ * appending "<tt>_<i>n</i></tt>" as necessary, where <tt><i>n</i></tt> is a
+ * number.
+ *
+ * @param name
+ * The suggested name; this is always checked first.
+ * @param context
+ * The set of things that the name will have to be unique within.
+ * @return A name that is definitely not the name of anything in the given
+ * set.
+ */
+ public static String uniqueName(String name, NamedSet<? extends Named> context) {
+ String candidate = SANITIZER_RE.matcher(name).replaceAll("_");
+ if (context.getByName(candidate) == null)
+ return candidate;
+ int counter = 0;
+ String prefix = candidate;
+ Matcher m = SUFFIXED_RE.matcher(candidate);
+ if (m.matches()) {
+ prefix = m.group(1);
+ counter = Integer.parseInt(m.group(2));
+ }
+ do {
+ candidate = prefix + "_" + (++counter);
+ } while (context.getByName(candidate) != null);
+ return candidate;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivityContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivityContextViewFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivityContextViewFactory.java
new file mode 100644
index 0000000..c27278f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivityContextViewFactory.java
@@ -0,0 +1,140 @@
+/*
+* 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 io.github.taverna_extras.component.ui.view;
+
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
+
+import java.awt.Frame;
+import java.net.MalformedURLException;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+public class ComponentActivityContextViewFactory implements
+ ContextualViewFactory<Activity> {
+ private ColourManager colourManager;
+ private ViewUtil util;
+ private ComponentFactory factory;
+ private ActivityIconManager aim;
+ private ServiceDescriptionRegistry sdr;
+ private EditManager em;
+ private FileManager fm;
+ private ServiceRegistry sr;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setColourManager(ColourManager colourManager) {
+ this.colourManager = colourManager;
+ }
+
+ public void setViewUtils(ViewUtil util) {
+ this.util = util;
+ }
+
+ public void setIconManager(ActivityIconManager aim) {
+ this.aim = aim;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry sdr) {
+ this.sdr = sdr;
+ }
+
+ public void setEditManager(EditManager em) {
+ this.em = em;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setServiceTypeRegistry(ServiceRegistry sr) {
+ this.sr = sr;
+ }
+
+ @Override
+ public boolean canHandle(Object selection) {
+ return selection instanceof Activity
+ && ((Activity) selection).getType().equals(URI);
+ }
+
+ @Override
+ public List<ContextualView> getViews(Activity selection) {
+ return Arrays.<ContextualView>asList(new ComponentActivityContextualView(selection));
+ }
+
+ @SuppressWarnings("serial")
+ private class ComponentActivityContextualView extends
+ HTMLBasedActivityContextualView {
+ public ComponentActivityContextualView(Activity activity) {
+ super(activity, colourManager);
+ init();
+ }
+
+ private void init() {
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Component service";
+ }
+
+ /**
+ * View position hint
+ */
+ @Override
+ public int getPreferredPosition() {
+ // We want to be on top
+ return 100;
+ }
+
+ @Override
+ public Action getConfigureAction(Frame owner) {
+ return new ComponentConfigureAction(getActivity(), owner, factory,
+ aim, sdr, em, fm, sr);
+ }
+
+ @Override
+ protected String getRawTableRowsHtml() {
+ try {
+ return util.getRawTablesHtml(getConfigBean());
+ } catch (MalformedURLException e) {
+ return "<tr><td>malformed URL: <pre>" + e.getMessage()
+ + "</pre></td></tr>";
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
new file mode 100644
index 0000000..fcb6e4a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
@@ -0,0 +1,154 @@
+/*
+* 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 io.github.taverna_extras.component.ui.view;
+
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
+
+import java.net.MalformedURLException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.annotation.AbstractSemanticAnnotationContextualView;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.Port;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+public class ComponentActivitySemanticAnnotationContextViewFactory implements
+ ContextualViewFactory<Object> {
+ public static final String VIEW_TITLE = "Inherited Semantic Annotations";
+ private static final Logger logger = getLogger(ComponentActivitySemanticAnnotationContextViewFactory.class);
+
+ private FileManager fm;
+ private ComponentFactory factory;
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ @Override
+ public boolean canHandle(Object selection) {
+ return getContainingComponentActivity(selection) != null;
+ }
+
+ public Activity getContainingComponentActivity(Object selection) {
+ if (selection instanceof Activity) {
+ Activity a = (Activity) selection;
+ if (a.getType().equals(URI))
+ return a;
+ }
+ if (selection instanceof InputActivityPort
+ || selection instanceof OutputActivityPort)
+ return getContainingComponentActivity(((OutputActivityPort) selection)
+ .getParent());
+ return null;
+ }
+
+ @Override
+ public List<ContextualView> getViews(Object selection) {
+ return Arrays
+ .<ContextualView> asList(new SemanticAnnotationCV(
+ selection));
+ }
+
+ @SuppressWarnings("serial")
+ private class SemanticAnnotationCV extends
+ AbstractSemanticAnnotationContextualView {
+ private Profile componentProfile;
+
+ public SemanticAnnotationCV(Object selection) {
+ super(fm, false);
+ Activity componentActivity = getContainingComponentActivity(selection);
+ try {
+ ComponentActivityConfigurationBean configuration = new ComponentActivityConfigurationBean(
+ componentActivity.getConfiguration(), factory);
+ setAnnotatedThing(selection, configuration.getVersion()
+ .getImplementation().getMainWorkflow());
+ componentProfile = configuration.getComponent().getFamily()
+ .getComponentProfile();
+ setProfile(selection);
+ super.initialise();
+ } catch (ComponentException e) {
+ logger.error("problem querying registry", e);
+ } catch (MalformedURLException e) {
+ logger.error("malformed URL in component description", e);
+ }
+ }
+
+ private void setAnnotatedThing(Object selection,
+ Workflow underlyingDataflow) {
+ if (selection instanceof Activity) {
+ setAnnotated(underlyingDataflow);
+ } else if (selection instanceof InputActivityPort) {
+ String name = ((Port) selection).getName();
+ for (InputWorkflowPort dip : underlyingDataflow.getInputPorts())
+ if (dip.getName().equals(name)) {
+ setAnnotated(dip);
+ break;
+ }
+ } else if (selection instanceof OutputActivityPort) {
+ String name = ((Port) selection).getName();
+ for (OutputWorkflowPort dop : underlyingDataflow
+ .getOutputPorts())
+ if (dop.getName().equals(name)) {
+ setAnnotated(dop);
+ break;
+ }
+ }
+ }
+
+ private void setProfile(Object selection) throws ComponentException {
+ if (componentProfile == null)
+ return;
+ if (selection instanceof Activity) {
+ setSemanticAnnotationProfiles(componentProfile
+ .getSemanticAnnotations());
+ } else if (selection instanceof InputActivityPort) {
+ setSemanticAnnotationProfiles(componentProfile
+ .getInputSemanticAnnotationProfiles());
+ } else if (selection instanceof OutputActivityPort) {
+ setSemanticAnnotationProfiles(componentProfile
+ .getOutputSemanticAnnotationProfiles());
+ }
+ }
+
+ @Override
+ public String getViewTitle() {
+ return VIEW_TITLE;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
new file mode 100644
index 0000000..d3580a8
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
@@ -0,0 +1,112 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.view;
+
+import static java.awt.Color.GRAY;
+import static java.awt.Color.WHITE;
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.EAST;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.SOUTHEAST;
+import static java.lang.String.format;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.Set;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.border.AbstractBorder;
+import javax.swing.border.EmptyBorder;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.Statement;
+
+public class ComponentActivitySemanticAnnotationPanel extends JPanel {
+ private static final long serialVersionUID = 3599768150252711758L;
+ private static final String ANNTYPE_MSG = "Annotation type : %s";
+ private static final String NONE_MSG = "No semantic annotations";
+ private SemanticAnnotationProfile profile;
+ private final Set<Statement> statements;
+
+ public ComponentActivitySemanticAnnotationPanel(
+ SemanticAnnotationProfile profile, Set<Statement> statements) {
+ this.profile = profile;
+ this.statements = statements;
+ initialize();
+ }
+
+ private void initialize() {
+ setLayout(new GridBagLayout());
+ setBorder(new AbstractBorder() {
+ private static final long serialVersionUID = -5921448975807056953L;
+
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y,
+ int width, int height) {
+ g.setColor(GRAY);
+ g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
+ }
+ });
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = SOUTHEAST;
+ c.fill = BOTH;
+ c.weightx = 1;
+ c.gridx = 0;
+
+ OntProperty predicate = profile.getPredicate();
+ c.gridwidth = 2;
+ JLabel label = new JLabel(format(ANNTYPE_MSG, getDisplayName(predicate)));
+ label.setBorder(new EmptyBorder(5, 5, 5, 5));
+ label.setBackground(WHITE);
+ label.setOpaque(true);
+ add(label, c);
+
+ c.insets = new Insets(5, 7, 0, 0);
+ c.anchor = EAST;
+ c.fill = HORIZONTAL;
+ if (statements.isEmpty()) {
+ c.gridwidth = 2;
+ // c.weightx = 1;
+ // c.gridy++;
+ add(new JLabel(NONE_MSG), c);
+ } else {
+ c.gridwidth = 1;
+ for (Statement statement : statements) {
+ c.gridx = 0;
+ c.weightx = 1;
+ JTextArea value = new JTextArea(getObjectName(statement));
+ value.setBackground(WHITE);
+ value.setOpaque(true);
+ value.setBorder(new EmptyBorder(2, 4, 2, 4));
+ add(value, c);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextViewFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextViewFactory.java
new file mode 100644
index 0000000..938a32e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextViewFactory.java
@@ -0,0 +1,61 @@
+/*
+* 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 io.github.taverna_extras.component.ui.view;
+
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.github.taverna_extras.component.api.Version;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+public class ComponentContextViewFactory implements
+ ContextualViewFactory<WorkflowBundle> {
+ private FileManager fileManager;
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ @Override
+ public boolean canHandle(Object selection) {
+ if (selection instanceof WorkflowBundle) {
+ Object dataflowSource = fileManager
+ .getDataflowSource((WorkflowBundle) selection);
+ //FIXME Is this right?
+ return dataflowSource instanceof Version.ID;
+ }
+ return selection instanceof Activity
+ && ((Activity) selection).getType().equals(URI);
+ }
+
+ @Override
+ public List<ContextualView> getViews(WorkflowBundle selection) {
+ Object dataflowSource = fileManager.getDataflowSource(selection);
+ return Arrays.<ContextualView> asList(new ComponentContextualView(
+ (Version.ID) dataflowSource));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextualView.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextualView.java
new file mode 100644
index 0000000..c763d06
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ComponentContextualView.java
@@ -0,0 +1,89 @@
+/*
+* 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 io.github.taverna_extras.component.ui.view;
+
+import static java.lang.String.format;
+
+import java.awt.Color;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+
+import io.github.taverna_extras.component.api.Version;
+import org.apache.taverna.lang.ui.HtmlUtils;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+@SuppressWarnings("serial")
+public class ComponentContextualView extends ContextualView {
+ private JEditorPane editorPane;
+ private final Version.ID component;
+ ColourManager colourManager;//FIXME beaninject
+ ViewUtil viewUtils;//FIXME beaninject;
+
+ public ComponentContextualView(Version.ID component) {
+ this.component = component;
+ initView();
+ }
+
+ @Override
+ public JComponent getMainFrame() {
+ editorPane = HtmlUtils.createEditorPane(buildHtml());
+ return HtmlUtils.panelForHtml(editorPane);
+ }
+
+ private String buildHtml() {
+ StringBuilder html = new StringBuilder(HtmlUtils.getHtmlHead(getBackgroundColour()));
+ html.append(HtmlUtils.buildTableOpeningTag());
+ viewUtils.getRawTablesHtml(component, html);
+ return html.append("</table></body></html>").toString();
+ }
+
+ public String getBackgroundColour() {
+ Color colour = colourManager.getPreferredColour(
+ "io.github.taverna_extras.component.registry.Component");
+ return format("#%1$2x%2$2x%3$2x", colour.getRed(), colour.getGreen(),
+ colour.getBlue());
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 50;
+ }
+
+ private static int MAX_LENGTH = 50;
+
+ private String limitName(String fullName) {
+ if (fullName.length() > MAX_LENGTH)
+ return fullName.substring(0, MAX_LENGTH - 3) + "...";
+ return fullName;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Component " + limitName(component.getComponentName());
+ }
+
+ @Override
+ public void refreshView() {
+ editorPane.setText(buildHtml());
+ repaint();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ViewUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ViewUtil.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ViewUtil.java
new file mode 100644
index 0000000..5764f6c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/view/ViewUtil.java
@@ -0,0 +1,178 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.view;
+
+import static java.lang.String.format;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * @author alanrw
+ */
+public class ViewUtil {
+ private static Logger logger = getLogger(ViewUtil.class);
+
+ private static final String VERSION_DESCRIPTION_LABEL = "Component version description";
+ private static final String COMPONENT_DESCRIPTION_LABEL = "Component description";
+ private static final String FAMILY_DESCRIPTION_LABEL = "Family description";
+
+ private static final String plainFormat = "<tr><td><b>%1$s</b></td><td nowrap=\"wrap\" style=\"width:100px;\">%2$s</td></tr>";
+ private static final String headerFormat = "<tr><th>%1$s</th><th>%2$s</th></tr>";
+ private static final String rowFormat = "<tr><td><b>%1$s</b></td><td>%2$s</td></tr>";
+ private static final String rowLinkFormat = "<tr><td><b>%1$s</b></td><td><a href=\"%3$s\">%2$s</a></td></tr>";
+ private static final String descriptionFormat = "<tr><td colspan=\"2\"><b>%1$s</b></td></tr><tr><td colspan=\"2\" nowrap=\"wrap\" style=\"width:100px;\">%2$s</td></tr>";
+
+ private ComponentFactory factory;//FIXME beaninject
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public String getRawTablesHtml(Version.ID id) {
+ StringBuilder html = new StringBuilder();
+ getRawTablesHtml(id, html);
+ return html.toString();
+ }
+
+ public String getRawTablesHtml(Configuration config) throws MalformedURLException {
+ StringBuilder html = new StringBuilder();
+ getRawTablesHtml(
+ new ComponentActivityConfigurationBean(
+ config.getJsonAsObjectNode(), factory), html);
+ return html.toString();
+ }
+
+ public void getRawTablesHtml(Version.ID id, StringBuilder html) {
+ URL registryBase = id.getRegistryBase();
+ String registryLink = null;
+ if (registryBase.getProtocol().startsWith("http"))
+ registryLink = registryBase.toExternalForm();
+ /*
+ * \u200b is a zero-width space, so the HTML renderer can know to break
+ * lines.
+ */
+ String registryName = registryBase.toString().replaceAll("/", "\u200b/");
+ appendRow(html, "Component registry base", registryName, registryLink);
+
+ String familyName = id.getFamilyName();
+ appendRow(html, "Component family", familyName, null);
+ try {
+ Family family = factory.getFamily(registryBase, familyName);
+ if (family != null)
+ appendDescriptionHtml(html, FAMILY_DESCRIPTION_LABEL,
+ family.getDescription());
+ } catch (Exception e) {
+ logger.error("failed to get component family description", e);
+ }
+
+ String componentName = id.getComponentName();
+ String helpLink = null;
+ try {
+ URL helpURL = factory.getVersion(id).getHelpURL();
+ if (helpURL != null)
+ helpLink = helpURL.toExternalForm();
+ } catch (Exception e) {
+ logger.error(e);
+ }
+
+ appendRow(html, "Component name", componentName, helpLink);
+ try {
+ Component component = factory.getComponent(registryBase,
+ familyName, componentName);
+ if (component != null)
+ appendDescriptionHtml(html, COMPONENT_DESCRIPTION_LABEL,
+ component.getDescription());
+ } catch (Exception e) {
+ logger.error("failed to get component description", e);
+ }
+
+ Integer componentVersion = id.getComponentVersion();
+
+ if (componentVersion == null)
+ appendRow(html, "Component version", "N/A", helpLink);
+ else {
+ appendRow(html, "Component version", componentVersion, helpLink);
+ try {
+ Version version = factory.getVersion(registryBase,
+ familyName, componentName, componentVersion);
+ if (version != null) {
+ appendDescriptionHtml(html, VERSION_DESCRIPTION_LABEL,
+ version.getDescription());
+ WorkflowBundle impl = version.getImplementation();
+ Set<InputWorkflowPort> inputs = impl.getMainWorkflow().getInputPorts();
+ if (!inputs.isEmpty()) {
+ appendHeaderRow(html, "Input Port Name", "Depth");
+ for (InputWorkflowPort input : inputs)
+ appendPlainRow(html, input.getName(), input.getDepth());
+ }
+ Set<OutputWorkflowPort> outputs = impl.getMainWorkflow().getOutputPorts();
+ if (!outputs.isEmpty()) {
+ appendHeaderRow(html, "Output Port Name", "Depth");
+ for (OutputWorkflowPort output : outputs) {
+ //FIXME get depth of output ports!
+ appendPlainRow(html, output.getName(), -1 /*output.getDepth()*/);
+ }
+ }
+ }
+ } catch (Exception e) {
+ logger.error("failed to get component version description", e);
+ }
+ }
+ }
+
+ private static void appendRow(StringBuilder html, Object label,
+ Object value, String link) {
+ if (link == null)
+ html.append(format(rowFormat, label, value));
+ else
+ html.append(format(rowLinkFormat, label, value, link));
+ }
+
+ private static void appendHeaderRow(StringBuilder html, Object label1,
+ Object label2) {
+ html.append(format(headerFormat, label1, label2));
+ }
+
+ private static void appendPlainRow(StringBuilder html, Object value1,
+ Object value2) {
+ html.append(format(plainFormat, value1, value2));
+ }
+
+ private static void appendDescriptionHtml(StringBuilder html,
+ String header, String description) {
+ if ((description != null) && !description.isEmpty())
+ html.append(format(descriptionFormat, header, description));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
deleted file mode 100644
index f359c9d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui;
-
-import static java.awt.Color.RED;
-import static javax.swing.SwingUtilities.invokeLater;
-import static org.apache.log4j.Logger.getLogger;
-
-import javax.swing.AbstractAction;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.models.graph.GraphController;
-import org.apache.taverna.workbench.models.graph.svg.SVGGraph;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-@SuppressWarnings("serial")
-public abstract class ComponentAction extends AbstractAction {
- private static Logger logger = getLogger(ComponentAction.class);
-
- protected GraphViewComponent graphView;
-
- protected ComponentAction(String title, GraphViewComponent graphView) {
- this.graphView = graphView;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- putValue(SMALL_ICON, icon.getIcon());
- }
-
- protected void markGraphAsBelongingToComponent(WorkflowBundle bundle) {
- final GraphController gc = graphView.getGraphController(bundle
- .getMainWorkflow());
- invokeLater(new Runnable() {
- @Override
- public void run() {
- try {
- SVGGraph g = (SVGGraph) gc.getGraph();
- g.setFillColor(RED);
- gc.redraw();
- } catch (NullPointerException e) {
- logger.error(e);
- }
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
deleted file mode 100644
index 26e673e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentActivityConfigurationBean.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui;
-
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.config.ComponentPropertyNames;
-import io.github.taverna_extras.component.api.profile.ExceptionHandling;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Component activity configuration bean.
- */
-public class ComponentActivityConfigurationBean extends Version.Identifier {
- public static final String ERROR_CHANNEL = "error_channel";
- public static final List<String> ignorableNames = Arrays
- .asList(ERROR_CHANNEL);
- private static final long serialVersionUID = 5774901665863468058L;
- private static final Logger logger = getLogger(ComponentActivityConfigurationBean.class);
-
- private ActivityPortsDefinitionBean ports = null;
- private ComponentFactory factory;
- private ExceptionHandling eh;
-
- public ComponentActivityConfigurationBean(Version.ID toBeCopied,
- ComponentFactory factory) {
- super(toBeCopied.getRegistryBase(), toBeCopied.getFamilyName(),
- toBeCopied.getComponentName(), toBeCopied.getComponentVersion());
- this.factory = factory;
- try {
- getPorts();
- } catch (ComponentException e) {
- logger.error("failed to get component realization", e);
- }
- }
-
- public ComponentActivityConfigurationBean(JsonNode json,
- ComponentFactory factory) throws MalformedURLException {
- super(getUrl(json), getFamily(json), getComponent(json),
- getVersion(json));
- this.factory = factory;
- }
-
- public ComponentActivityConfigurationBean(Configuration configuration,
- ComponentFactory factory) throws MalformedURLException {
- this(configuration.getJson(), factory);
- }
-
- private static URL getUrl(JsonNode json) throws MalformedURLException {
- return new URL(json.get(REGISTRY_BASE).textValue());
- }
-
- private static String getFamily(JsonNode json) {
- return json.get(FAMILY_NAME).textValue();
- }
-
- private static String getComponent(JsonNode json) {
- return json.get(COMPONENT_NAME).textValue();
- }
-
- private static Integer getVersion(JsonNode json) {
- JsonNode node = json.get(COMPONENT_VERSION);
- if (node == null || !node.isInt())
- return null;
- return node.intValue();
- }
-
- public Component getComponent() throws ComponentException {
- return factory.getComponent(getRegistryBase(), getFamilyName(),
- getComponentName());
- }
-
- public Version getVersion() throws ComponentException {
- return factory.getVersion(this);
- }
-
- private ActivityPortsDefinitionBean getPortsDefinition(WorkflowBundle w) {
- ActivityPortsDefinitionBean result = new ActivityPortsDefinitionBean();
-
- for (InputWorkflowPort iwp : w.getMainWorkflow().getInputPorts())
- result.inputs.add(makeInputDefinition(iwp));
- for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
- result.outputs.add(makeOutputDefinition(getDepth(owp), owp.getName()));
-
- try {
- eh = factory.getFamily(getRegistryBase(), getFamilyName())
- .getComponentProfile().getExceptionHandling();
- if (eh != null)
- result.outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (io.github.taverna_extras.component.api.ComponentException e) {
- logger.error("failed to get exception handling for family", e);
- }
- return result;
- }
-
- private int getDepth(OutputWorkflowPort owp) {
- return 0; //FIXME How to get the depth of an output?
- }
-
- private InputActivityPort makeInputDefinition(InputWorkflowPort dip) {
- InputActivityPort port = new InputActivityPort();
- port.setName(dip.getName());
- port.setDepth(dip.getDepth());
- return port;
- }
-
- private OutputActivityPort makeOutputDefinition(int depth, String name) {
- OutputActivityPort port = new OutputActivityPort();
- port.setName(name);
- port.setDepth(depth);
- port.setGranularDepth(depth);
- return port;
- }
-
- /**
- * @return the ports
- */
- public ActivityPortsDefinitionBean getPorts() throws ComponentException {
- if (ports == null)
- ports = getPortsDefinition(getVersion().getImplementation());
- return ports;
- }
-
- public ExceptionHandling getExceptionHandling() {
- return eh;
- }
-
- public void installConfiguration(Activity a) {
- Configuration conf = a.createConfiguration(ACTIVITY_URI);
- ObjectNode json = conf.getJsonAsObjectNode();
- json.put(REGISTRY_BASE, getRegistryBase().toExternalForm());
- json.put(FAMILY_NAME, getFamilyName());
- json.put(COMPONENT_NAME, getComponentName());
- json.put(COMPONENT_VERSION, getComponentVersion());
- }
-
- public static class ActivityPortsDefinitionBean {
- public List<InputActivityPort> inputs = new ArrayList<>();
- public List<OutputActivityPort> outputs = new ArrayList<>();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
deleted file mode 100644
index baec10f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/ComponentConstants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui;
-
-import static java.net.URI.create;
-
-import java.net.URI;
-
-public interface ComponentConstants {
- URI ACTIVITY_URI = create("http://ns.taverna.org.uk/2010/activity/component");
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
deleted file mode 100644
index 6cc48d0..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NORTHWEST;
-import static java.lang.String.CASE_INSENSITIVE_ORDER;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createSemanticAnnotation;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.common.Named;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.Statement;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * @author alanrw
- */
-public abstract class AbstractSemanticAnnotationContextualView extends
- ContextualView {
- private static final long serialVersionUID = 3567849347002793442L;
- private static final Logger logger = getLogger(SemanticAnnotationContextualView.class);
-
- private final FileManager fileManager;
-
- public AbstractSemanticAnnotationContextualView(FileManager fileManager,
- boolean allowChange) {
- super();
- this.fileManager = fileManager;
- this.allowChange = allowChange;
- }
-
- private final boolean allowChange;
- private JPanel panel;
- private AbstractNamed annotated;
- private List<SemanticAnnotationProfile> semanticAnnotationProfiles;
- private Model model;
- private Resource subject;
-
- private static Comparator<SemanticAnnotationProfile> comparator = new Comparator<SemanticAnnotationProfile>() {
- @Override
- public int compare(SemanticAnnotationProfile arg0,
- SemanticAnnotationProfile arg1) {
- String d0 = getDisplayName(arg0.getPredicate());
- String d1 = getDisplayName(arg1.getPredicate());
- return CASE_INSENSITIVE_ORDER.compare(d0, d1);
- }
- };
-
- @Override
- public JComponent getMainFrame() {
- return panel;
- }
-
- @Override
- public int getPreferredPosition() {
- return 510;
- }
-
- protected final void initialise() {
- populateModel();
- if (panel == null)
- panel = new JPanel(new GridBagLayout());
- else
- panel.removeAll();
- populatePanel(panel);
- }
-
- public void removeStatement(Statement statement) {
- model.remove(statement);
- // populatePanel(panel);
- updateSemanticAnnotation();
- }
-
- public void addStatement(Statement statement) {
- model.add(statement);
- // populatePanel(panel);
- updateSemanticAnnotation();
- }
-
- public void changeStatement(Statement origStatement, OntProperty predicate,
- RDFNode node) {
- if (predicate == null)
- return;
- model.remove(origStatement);
- model.add(subject, predicate, node);
- // populatePanel(panel);
- updateSemanticAnnotation();
- }
-
- public void addStatement(OntProperty predicate, RDFNode node) {
- if (predicate == null)
- return;
- model.add(subject, predicate, node);
- // populatePanel(panel);
- updateSemanticAnnotation();
- }
-
- @Override
- public void refreshView() {
- populatePanel(panel);
- }
-
- // public void addModel(Model model) {
- // this.model.add(model);
- // initialise();
- // updateSemanticAnnotation();
- // }
-
- public void updateSemanticAnnotation() {
- try {
- createSemanticAnnotation(fileManager.getCurrentDataflow(),
- annotated, model);
- } catch (IOException e) {
- logger.error("failed to add semantic annotation", e);
- }
- }
-
- public void setAnnotated(Named annotated) {
- this.annotated = (AbstractNamed) annotated;
- }
-
- public void setSemanticAnnotationProfiles(
- List<SemanticAnnotationProfile> profiles) {
- this.semanticAnnotationProfiles = profiles;
- }
-
- public Model getModel() {
- return model;
- }
-
- private void populateModel() {
- this.model = SemanticAnnotationUtils.populateModel(fileManager
- .getCurrentDataflow());
- this.subject = model.createResource(annotated.getURI().toASCIIString());
- }
-
- public Named getAnnotated() {
- return annotated;
- }
-
- private void populatePanel(JPanel panel) {
- panel.removeAll();
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.anchor = NORTHWEST;
- gbc.fill = HORIZONTAL;
- gbc.gridx = 0;
- gbc.weightx = 1;
- gbc.weighty = 0;
- gbc.insets = new Insets(5, 5, 5, 5);
- panel.add(new JLabel("Reading semantic annotations"), gbc);
- revalidate();
- initView();
- new StatementsReader().execute();
- }
-
- private Set<Statement> listStatements(OntProperty predicate) {
- if (predicate == null)
- return Collections.emptySet();
- return model.listStatements(subject, predicate, (RDFNode) null).toSet();
- }
-
- private void populateViewWithPredicates(GridBagConstraints gbc,
- Map<SemanticAnnotationProfile, Set<Statement>> profileStatements,
- Set<Statement> statements,
- Set<SemanticAnnotationProfile> unresolvablePredicates) {
- for (Entry<SemanticAnnotationProfile, Set<Statement>> entry : profileStatements
- .entrySet()) {
- panel.add(
- new SemanticAnnotationPanel(this, entry.getKey(), entry
- .getValue(), allowChange), gbc);
- panel.add(new JSeparator(), gbc);
- }
- for (SemanticAnnotationProfile semanticAnnotationProfile : unresolvablePredicates) {
- panel.add(
- new UnresolveablePredicatePanel(semanticAnnotationProfile),
- gbc);
- panel.add(new JSeparator(), gbc);
- }
-
- if (semanticAnnotationProfiles.isEmpty())
- panel.add(new JLabel("No annotations possible"), gbc);
- for (Statement s : statements)
- panel.add(new UnrecognizedStatementPanel(s), gbc);
-
- gbc.weighty = 1;
- panel.add(new JPanel(), gbc);
- }
-
- private class StatementsReader extends SwingWorker<Void, Object> {
- private Map<SemanticAnnotationProfile, Set<Statement>> profileStatements = new TreeMap<>(
- comparator);
- private Set<Statement> statements;
- private Set<SemanticAnnotationProfile> unresolvablePredicates = new HashSet<>();
-
- @Override
- protected Void doInBackground() throws Exception {
- try {
- parseStatements();
- } catch (Exception e) {
- logger.error("failed to parse annotation statements", e);
- throw e;
- }
- return null;
- }
-
- private void parseStatements() {
- statements = listStatements(null);
- for (SemanticAnnotationProfile semanticAnnotationProfile : semanticAnnotationProfiles) {
- OntProperty predicate = semanticAnnotationProfile
- .getPredicate();
- if (predicate == null) {
- unresolvablePredicates.add(semanticAnnotationProfile);
- continue;
- }
-
- Set<Statement> statementsWithPredicate = listStatements(predicate);
- profileStatements.put(semanticAnnotationProfile,
- statementsWithPredicate);
- statements.removeAll(statementsWithPredicate);
- }
- }
-
- @Override
- protected void done() {
- panel.removeAll();
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.anchor = NORTHWEST;
- gbc.fill = HORIZONTAL;
- gbc.gridx = 0;
- gbc.weightx = 1;
- gbc.weighty = 0;
- gbc.insets = new Insets(5, 5, 5, 5);
-
- try {
- get();
- populateViewWithPredicates(gbc, profileStatements, statements,
- unresolvablePredicates);
- } catch (ExecutionException | InterruptedException e) {
- logger.error(e);
- panel.add(new JLabel("Unable to read semantic annotations"),
- gbc);
- }
-
- revalidate();
- initView();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
deleted file mode 100644
index 1543533..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotateSemanticsMenuAction.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.FlowLayout.TRAILING;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JDialog;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class AnnotateSemanticsMenuAction extends AbstractContextualMenuAction {
- private static final String ANNOTATE_SEMANTICS = "Annotate semantics...";
- private static final URI configureSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/configure");
- private FileManager fileManager;
- private ComponentFactory factory;
-
- public AnnotateSemanticsMenuAction() {
- super(configureSection, 45);
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileManager(FileManager fm) {
- this.fileManager = fm;
- }
-
- @Override
- public boolean isEnabled() {
- Object selection = getContextualSelection().getSelection();
- Object dataflowSource = fileManager.getDataflowSource(fileManager
- .getCurrentDataflow());
- if (dataflowSource instanceof Version.ID)
- return (selection instanceof AbstractNamed)
- && !(selection instanceof Activity || selection instanceof ActivityPort);
- return false;
- }
-
- @SuppressWarnings("serial")
- @Override
- protected Action createAction() {
- return new AbstractAction(ANNOTATE_SEMANTICS) {
- @Override
- public void actionPerformed(ActionEvent e) {
- showAnnotateSemanticsPanel();
- }
- };
- }
-
- private void showAnnotateSemanticsPanel() {
- SemanticAnnotationContextualView view = new SemanticAnnotationContextualView(
- fileManager, factory, (AbstractNamed) getContextualSelection()
- .getSelection());
-
- final JDialog dialog = new JDialog((Frame) null, "Annotate semantics");
- dialog.setLayout(new BorderLayout());
- dialog.add(new JScrollPane(view), CENTER);
-
- JPanel buttonPanel = new JPanel(new FlowLayout(TRAILING));
- buttonPanel.add(new DeselectingButton("OK", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- dialog.setVisible(false);
- }
- }));
-
- dialog.add(buttonPanel, SOUTH);
- dialog.setSize(new Dimension(400, 300));
- dialog.setLocationRelativeTo(null);
- dialog.setModal(true);
- dialog.setVisible(true);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
deleted file mode 100644
index 0dfaf0a..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/AnnotationPropertyPanelFactory.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
-import static java.lang.Integer.MIN_VALUE;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- *
- *
- * @author Alan Williams
- */
-public class AnnotationPropertyPanelFactory extends PropertyPanelFactorySPI {
- @Override
- public JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return getDefaultInputComponent(semanticAnnotationProfile, statement);
- }
-
- @Override
- public RDFNode getNewTargetNode(Statement originalStatement,
- JComponent component) {
- String newText = ((JTextArea) component).getText();
- if ((originalStatement == null)
- || !getObjectName(originalStatement).equals(newText))
- return createTypedLiteral(newText);
- return null;
- }
-
- @Override
- public int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- OntProperty property = semanticAnnotationProfile.getPredicate();
- if ((property != null) && property.isAnnotationProperty())
- return 100;
- return MIN_VALUE;
- }
-
- @Override
- public JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
deleted file mode 100644
index bd7ebcc..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DatatypePropertyPanelFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
-import static java.lang.Integer.MIN_VALUE;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- * @author Alan Williams
- */
-public class DatatypePropertyPanelFactory extends PropertyPanelFactorySPI {
- public DatatypePropertyPanelFactory() {
- super();
- }
-
- @Override
- public JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return getDefaultInputComponent(semanticAnnotationProfile, statement);
- }
-
- @Override
- public RDFNode getNewTargetNode(Statement originalStatement,
- JComponent component) {
- JTextArea inputText = (JTextArea) component;
- String newText = inputText.getText();
- if ((originalStatement == null)
- || !getObjectName(originalStatement).equals(newText))
- return createTypedLiteral(newText);
- return null;
- }
-
- @Override
- public int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- OntProperty property = semanticAnnotationProfile.getPredicate();
- if ((property != null) && property.isDatatypeProperty())
- return 100;
- return MIN_VALUE;
- }
-
- @Override
- public JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
deleted file mode 100644
index e9dbda7..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/DateTimePropertyPanelFactory.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static org.apache.jena.datatypes.xsd.XSDDatatype.XSDdateTime;
-import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
-import static java.lang.Integer.MIN_VALUE;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.swing.JComponent;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerDateModel;
-import javax.swing.text.DefaultCaret;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.datatypes.xsd.XSDDateTime;
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- *
- *
- * @author Alan Williams
- */
-public class DateTimePropertyPanelFactory extends PropertyPanelFactorySPI {
-
- private static String DateTimeString = XSDdateTime.getURI();
-
- public DateTimePropertyPanelFactory() {
- super();
- }
-
- @Override
- public JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- Date now = new Date();
- SpinnerDateModel dateModel = new SpinnerDateModel(now, null, now,
- Calendar.DAY_OF_MONTH);
- JSpinner s = new JSpinner(dateModel);
- JSpinner.DateEditor de = new JSpinner.DateEditor(s,
- "yyyy-MM-dd-HH-mm-ss");
-
- /*
- * Suggested hack from
- * http://www.coderanch.com/t/345684/GUI/java/JSpinner-DateEditor-Set-default-focus
- */
-
- de.getTextField().setCaret(new DefaultCaret() {
- private static final long serialVersionUID = 6779256780590610172L;
- private boolean diverted = false;
-
- @Override
- public void setDot(int dot) {
- diverted = (dot == 0);
- if (diverted)
- dot = getComponent().getDocument().getLength();
- super.setDot(dot);
- }
-
- @Override
- public void moveDot(int dot) {
- if (diverted) {
- super.setDot(0);
- diverted = false;
- }
- super.moveDot(dot);
- }
- });
- s.setEditor(de);
- if (statement != null) {
- Object o = statement.getObject().asLiteral().getValue();
- if (o instanceof XSDDateTime)
- dateModel.setValue(((XSDDateTime) o).asCalendar().getTime());
- }
- return s;
- }
-
- @Override
- public RDFNode getNewTargetNode(Statement originalStatement,
- JComponent component) {
- JSpinner spinner = (JSpinner) component;
- Date d = (Date) spinner.getValue();
- if ((originalStatement == null)
- || !originalStatement.getObject().asLiteral().getValue()
- .equals(d)) {
- Calendar cal = GregorianCalendar.getInstance();
- cal.setTime(d);
- return createTypedLiteral(cal);
- }
- return null;
- }
-
- @Override
- public int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- OntProperty property = semanticAnnotationProfile.getPredicate();
- if ((property != null) && property.isDatatypeProperty()
- && DateTimeString.equals(semanticAnnotationProfile
- .getClassString()))
- return 200;
- return MIN_VALUE;
- }
-
- @Override
- public JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- JComponent result = getInputComponent(semanticAnnotationProfile,
- statement);
- result.setEnabled(false);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
deleted file mode 100644
index efc3b42..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/FallbackPropertyPanelFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- * @author alanrw
- */
-public class FallbackPropertyPanelFactory extends PropertyPanelFactorySPI {
- @Override
- public JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return new JLabel("Unable to handle "
- + semanticAnnotationProfile.getPredicateString());
- }
-
- @Override
- public RDFNode getNewTargetNode(Statement originalStatement,
- JComponent component) {
- return null;
- }
-
- @Override
- public int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- return 0;
- }
-
- @Override
- public JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
deleted file mode 100644
index d5e4fbe..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/GreyBorder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Graphics;
-
-import javax.swing.border.AbstractBorder;
-
-@SuppressWarnings("serial")
-class GreyBorder extends AbstractBorder {
- @Override
- public void paintBorder(Component c, Graphics g, int x, int y, int width,
- int height) {
- g.setColor(Color.GRAY);
- g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
deleted file mode 100644
index fefe5c0..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.FlowLayout.RIGHT;
-import static java.awt.GridBagConstraints.EAST;
-import static java.awt.GridBagConstraints.NORTHWEST;
-import static java.lang.Integer.MIN_VALUE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showInputDialog;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.ListCellRenderer;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import io.github.taverna_extras.component.ui.localworld.LocalWorld;
-
-import org.apache.jena.ontology.Individual;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-/**
- * @author David Withers
- * @author Alan Williams
- */
-public class ObjectPropertyWithIndividualsPanelFactory extends
- PropertyPanelFactorySPI {
- /*
- * TODO Consider what sort of sharing model is appropriate for the local
- * world
- */
- private static LocalWorld localWorld = LocalWorld.getInstance();
-
- @Override
- public int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- OntProperty property = semanticAnnotationProfile.getPredicate();
- if ((property != null) && property.isObjectProperty()
- /*
- * && !semanticAnnotationProfile.getIndividuals().isEmpty()
- */)
- return 100;
- return MIN_VALUE;
- }
-
- @Override
- public JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- return new ComboBoxWithAdd(semanticAnnotationProfile, statement);
- }
-
- @Override
- public RDFNode getNewTargetNode(Statement originalStatement,
- JComponent component) {
- ComboBoxWithAdd panel = (ComboBoxWithAdd) component;
- RDFNode newNode = panel.getSelectedItem();
- if ((originalStatement == null)
- || !originalStatement.getObject().equals(newNode))
- return newNode;
- return null;
- }
-
-
- private static class ComboBoxWithAdd extends JPanel {
- private static final long serialVersionUID = -9156213096428945270L;
- private static DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
- OntClass rangeClass = null;
- JComboBox<Individual> resources;
-
- public ComboBoxWithAdd(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- super(new GridBagLayout());
-
- rangeClass = semanticAnnotationProfile.getRangeClass();
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = NORTHWEST;
- List<Individual> individuals = semanticAnnotationProfile
- .getIndividuals();
- if (rangeClass != null)
- individuals
- .addAll(localWorld.getIndividualsOfClass(rangeClass));
-
- resources = new JComboBox<Individual>(new Vector<>(individuals));
- resources.setRenderer(new ListCellRenderer<Individual>() {
- @Override
- public Component getListCellRendererComponent(
- JList<? extends Individual> list, Individual value,
- int index, boolean isSelected, boolean cellHasFocus) {
- return defaultRenderer.getListCellRendererComponent(list,
- getDisplayName(value), index, isSelected,
- cellHasFocus);
- }
- });
- resources.setEditable(false);
- if (statement != null) {
- Object origResource = statement.getObject();
- if (origResource != null)
- resources.setSelectedItem(origResource);
- }
- this.add(resources, gbc);
-
- gbc.gridy++;
-
- JPanel buttonPanel = new JPanel(new FlowLayout(RIGHT));
- buttonPanel.add(new DeselectingButton("Add external",
- new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- addExternal();
- }
- }));
- buttonPanel.add(new DeselectingButton("Add local",
- new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- addLocal();
- }
- }));
- gbc.anchor = EAST;
- this.add(buttonPanel, gbc);
- }
-
- private void addExternal() {
- String answer = showInputDialog("Please enter the URL for the resource");
- resources.addItem(localWorld.createIndividual(answer, rangeClass));
- }
-
- private void addLocal() {
- TurtleInputPanel turtlePanel = new TurtleInputPanel(rangeClass);
- if (showConfirmDialog(null, turtlePanel, "Turtle input",
- OK_CANCEL_OPTION, QUESTION_MESSAGE) == OK_OPTION) {
- OntModel addedModel = turtlePanel.getContentAsModel();
- for (Individual i : addedModel.listIndividuals(rangeClass)
- .toList())
- resources.addItem(i);
- localWorld.addModelFromString(turtlePanel.getContentAsString());
- }
- }
-
- public RDFNode getSelectedItem() {
- return (RDFNode) resources.getSelectedItem();
- }
- }
-
- @Override
- public JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- JComponent result = getDefaultDisplayComponent(
- semanticAnnotationProfile, statement);
- return result;
- }
-}
[02/27] incubator-taverna-plugin-component git commit: package name
-> io.github.taverna_extras.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
index c7fee79..2929ed0 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/Version.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api;
+package io.github.taverna_extras.component.api;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
index 0603a5d..7de348c 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentConfig.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.config;
+package io.github.taverna_extras.component.api.config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
index bd8a730..457161d 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/config/ComponentPropertyNames.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.config;
+package io.github.taverna_extras.component.api.config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
index 4d82159..a0b3e2f 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/package-info.java
@@ -22,4 +22,4 @@
* @author Donal Fellows
* @author David Withers
*/
-package org.apache.taverna.component.api;
\ No newline at end of file
+package io.github.taverna_extras.component.api;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
index 5a22df8..8795c8a 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ActivityProfile.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
index cff37a4..0ad0da4 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/AnnotatedElement.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,7 +20,7 @@ package org.apache.taverna.component.api.profile;
import java.util.List;
-import org.apache.taverna.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentException;
public interface AnnotatedElement {
List<SemanticAnnotationProfile> getSemanticAnnotations()
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
index 2645a74..ee5810d 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionHandling.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -30,8 +30,8 @@ public class ExceptionHandling {
private final List<HandleException> remapped = new ArrayList<HandleException>();
public ExceptionHandling(
- org.apache.taverna.component.api.profile.doc.ExceptionHandling proxied) {
- for (org.apache.taverna.component.api.profile.doc.HandleException he : proxied
+ io.github.taverna_extras.component.api.profile.doc.ExceptionHandling proxied) {
+ for (io.github.taverna_extras.component.api.profile.doc.HandleException he : proxied
.getHandleException())
remapped.add(new HandleException(he));
this.failLists = proxied.getFailLists() != null;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
index ce46d91..69163cf 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/ExceptionReplacement.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@ package org.apache.taverna.component.api.profile;
*/
-import org.apache.taverna.component.api.profile.doc.Replacement;
+import io.github.taverna_extras.component.api.profile.doc.Replacement;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
index 94314e0..fb29cd6 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/HandleException.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -34,7 +34,7 @@ public class HandleException {
private final boolean pruneStack;
public HandleException(
- org.apache.taverna.component.api.profile.doc.HandleException proxied) {
+ io.github.taverna_extras.component.api.profile.doc.HandleException proxied) {
pruneStack = proxied.getPruneStack() != null;
pattern = compile(proxied.getPattern(), DOTALL);
if (proxied.getReplacement() != null)
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
index 005f47f..d89b571 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/PortProfile.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
index 15ebd9b..c08ddc9 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/Profile.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,9 +21,9 @@ package org.apache.taverna.component.api.profile;
import java.util.List;
import java.util.Map;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.NamedItem;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.NamedItem;
+import io.github.taverna_extras.component.api.Registry;
import org.apache.jena.ontology.OntModel;
@@ -33,7 +33,7 @@ public interface Profile extends NamedItem, AnnotatedElement {
String getXML() throws ComponentException;
- org.apache.taverna.component.api.profile.doc.Profile getProfileDocument()
+ io.github.taverna_extras.component.api.profile.doc.Profile getProfileDocument()
throws ComponentException;
String getId();
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
index 1f8f2b7..c7e040f 100644
--- a/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
+++ b/taverna-component-repository-api/src/main/java/org/apache/taverna/component/api/profile/SemanticAnnotationProfile.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.api.profile;
+package io.github.taverna_extras.component.api.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
----------------------------------------------------------------------
diff --git a/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd b/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
index 4ebd042..5deed76 100644
--- a/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
+++ b/taverna-component-repository-api/src/main/resources/ComponentProfile.xsd
@@ -26,7 +26,7 @@
<xs:annotation>
<xs:appinfo>
<jxb:schemaBindings>
- <jxb:package name="org.apache.taverna.component.api.profile.doc" />
+ <jxb:package name="io.github.taverna_extras.component.api.profile.doc" />
</jxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
[19/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
deleted file mode 100644
index 99cec65..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentMenu.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenu;
-import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-/**
- * @author alanrw
- */
-public class ComponentMenu extends AbstractMenu {
- public static final URI COMPONENT = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#component");
- public static final String TITLE = "Components";
-
- public ComponentMenu() {
- super(DEFAULT_MENU_BAR, 950, COMPONENT, makeAction());
- }
-
- public static DummyAction makeAction() {
- return new DummyAction(TITLE);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
deleted file mode 100644
index 337ee73..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentSection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author alanrw
- *
- */
-public class ComponentSection extends AbstractMenuSection {
- public static final String COMPONENT_SECTION = "Components";
- public static final URI componentSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/components");
- public static final URI editSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/edit");
-
- public ComponentSection() {
- super(editSection, 100, componentSection);
- }
-
- @Override
- public boolean isEnabled() {
- return super.isEnabled();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
deleted file mode 100644
index 3a467fd..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreationDialog.java
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.util.Collections.sort;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.AbstractAction;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.ListCellRenderer;
-
-//import net.sf.taverna.t2.lang.ui.DeselectingButton;
-//import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-//import net.sf.taverna.t2.workbench.edits.Edit;
-//import net.sf.taverna.t2.workbench.edits.EditException;
-//import net.sf.taverna.t2.workbench.edits.EditManager;
-//import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-//import net.sf.taverna.t2.workbench.models.graph.GraphController;
-//import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
-//import net.sf.taverna.t2.workflow.edits.AddActivityEdit;
-//import net.sf.taverna.t2.workflow.edits.AddActivityInputPortMappingEdit;
-//import net.sf.taverna.t2.workflow.edits.AddActivityOutputPortMappingEdit;
-//import net.sf.taverna.t2.workflow.edits.AddChildEdit;
-//import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
-//import net.sf.taverna.t2.workflow.edits.AddProcessorInputPortEdit;
-//import net.sf.taverna.t2.workflow.edits.AddProcessorOutputPortEdit;
-//import net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
-//import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
-//import net.sf.taverna.t2.workflow.edits.RemoveChildEdit;
-//import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-//import net.sf.taverna.t2.workflow.edits.SetIterationStrategyStackEdit;
-
-import org.apache.log4j.Logger;
-import org.apache.taverna.annotation.annotationbeans.DescriptiveTitle;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.annotation.Annotation;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-import org.apache.taverna.workbench.edits.CompoundEdit;
-import org.apache.taverna.workbench.edits.Edit;
-import org.apache.taverna.workbench.edits.EditException;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.helper.HelpEnabledDialog;
-import org.apache.taverna.workbench.models.graph.GraphController;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-import org.apache.taverna.workflow.edits.AddActivityEdit;
-import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
-import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
-import org.apache.taverna.workflow.edits.AddChildEdit;
-import org.apache.taverna.workflow.edits.AddDataLinkEdit;
-import org.apache.taverna.workflow.edits.AddProcessorInputPortEdit;
-import org.apache.taverna.workflow.edits.AddProcessorOutputPortEdit;
-import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
-import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
-import org.apache.taverna.workflow.edits.RemoveChildEdit;
-import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
-import org.apache.taverna.workflow.edits.SetIterationStrategyStackEdit;
-import org.apache.taverna.workflowmodel.utils.AnnotationTools;
-
-/**
- * @author alanrw
- */
-public class NestedWorkflowCreationDialog extends HelpEnabledDialog {
- private static final long serialVersionUID = 727059218457420449L;
- private static final Logger logger = getLogger(NestedWorkflowCreationDialog.class);
- private static final Comparator<Processor> processorComparator = new Comparator<Processor>() {
- @Override
- public int compare(Processor o1, Processor o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
- private static final ListCellRenderer<Object> defaultRenderer = new DefaultListCellRenderer();
- private static final ListCellRenderer<Processor> processorRenderer = new ListCellRenderer<Processor>() {
- @Override
- public Component getListCellRendererComponent(
- JList<? extends Processor> list,
- Processor value, int index, boolean isSelected,
- boolean cellHasFocus) {
- return defaultRenderer.getListCellRendererComponent(list,
- value.getName(), index, isSelected, cellHasFocus);
- }
- };
-
- private final EditManager em;
- private final GraphViewComponent graphView;
- private final List<Processor> includedProcessors = new ArrayList<>();
- private List<Processor> allProcessors;
- private final List<Processor> includableProcessors = new ArrayList<>();
-
- private JList<Processor> includableList = new JList<>();
- private JList<Processor> includedList = new JList<>();
- private final Workflow currentDataflow;
- private JButton excludeButton;
- private JButton includeButton;
- private JButton okButton;
- private JButton resetButton;
- private JTextField nameField = new JTextField(30);
-
- public NestedWorkflowCreationDialog(Frame owner, Object o,
- Workflow dataflow, EditManager em, GraphViewComponent graphView) {
- super(owner, "Nested workflow creation", true, null);
- this.em = em;
- this.graphView = graphView;
-
- if (o instanceof Processor)
- includedProcessors.add((Processor) o);
- this.currentDataflow = dataflow;
-
- allProcessors = new ArrayList<>(dataflow.getProcessors());
-
- this.setLayout(new BorderLayout());
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new FlowLayout());
-
- okButton = new DeselectingButton(new OKAction(this));
- buttonPanel.add(okButton);
-
- resetButton = new DeselectingButton(new ResetAction(this));
- buttonPanel.add(resetButton);
-
- JButton cancelButton = new DeselectingButton(new CancelAction(this));
- buttonPanel.add(cancelButton);
-
- JPanel innerPanel = new JPanel(new BorderLayout());
- JPanel processorChoice = createProcessorChoicePanel(dataflow);
- innerPanel.add(processorChoice, CENTER);
-
- JPanel namePanel = new JPanel(new FlowLayout());
- namePanel.add(new JLabel("Workflow name: "));
- nameField.setText("nested");
- namePanel.add(nameField);
- innerPanel.add(namePanel, SOUTH);
-
- this.add(innerPanel, CENTER);
-
- this.add(buttonPanel, SOUTH);
- this.pack();
- this.setSize(new Dimension(500, 800));
- }
-
- private JPanel createProcessorChoicePanel(Workflow dataflow) {
- JPanel result = new JPanel();
- result.setLayout(new GridLayout(0, 2));
-
- JPanel includedProcessorsPanel = createIncludedProcessorsPanel();
- JPanel includableProcessorsPanel = createIncludableProcessorsPanel();
- result.add(includableProcessorsPanel);
- result.add(includedProcessorsPanel);
- updateLists();
- return result;
- }
-
- private JPanel createIncludableProcessorsPanel() {
- JPanel result = new JPanel();
- result.setLayout(new BorderLayout());
- result.add(new JLabel("Possible services"), NORTH);
- includableList.setModel(new DefaultComboBoxModel<>(new Vector<>(
- includableProcessors)));
- includableList.setCellRenderer(processorRenderer);
- result.add(new JScrollPane(includableList), CENTER);
-
- includeButton = new DeselectingButton("Include", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- includedProcessors.addAll(includableList
- .getSelectedValuesList());
- calculateIncludableProcessors();
- updateLists();
- }
- });
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new FlowLayout());
- buttonPanel.add(includeButton);
- result.add(buttonPanel, SOUTH);
- return result;
- }
-
- private void resetLists() {
- includedProcessors.clear();
- updateLists();
- }
-
- private JPanel createIncludedProcessorsPanel() {
- JPanel result = new JPanel();
- result.setLayout(new BorderLayout());
- result.add(new JLabel("Included services"), NORTH);
- includedList.setModel(new DefaultComboBoxModel<>(new Vector<>(
- includedProcessors)));
- includedList.setCellRenderer(processorRenderer);
- result.add(new JScrollPane(includedList), CENTER);
-
- excludeButton = new DeselectingButton("Exclude", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- includedProcessors.removeAll(includedList
- .getSelectedValuesList());
- calculateIncludableProcessors();
- updateLists();
- }
- });
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new FlowLayout());
- buttonPanel.add(excludeButton);
-
- result.add(buttonPanel, SOUTH);
- return result;
- }
-
- private void updateLists() {
- calculateIncludableProcessors();
- sort(includedProcessors, processorComparator);
- sort(includableProcessors, processorComparator);
- includedList.setModel(new DefaultComboBoxModel<>(new Vector<>(
- includedProcessors)));
- includableList.setModel(new DefaultComboBoxModel<>(new Vector<>(
- includableProcessors)));
- boolean someIncludedProcessors = includedProcessors.size() > 0;
- excludeButton.setEnabled(someIncludedProcessors);
- okButton.setEnabled(someIncludedProcessors);
- resetButton.setEnabled(someIncludedProcessors);
- boolean someIncludableProcessors = includableProcessors.size() > 0;
- includeButton.setEnabled(someIncludableProcessors);
- }
-
- public void calculateIncludableProcessors() {
- includableProcessors.clear();
- if (includedProcessors.isEmpty())
- includableProcessors.addAll(allProcessors);
- else
- for (Processor p : includedProcessors) {
- considerNearestUpstream(p);
- considerNearestDownstream(p);
- }
- sort(includableProcessors, processorComparator);
- }
-
- private void considerNearestDownstream(Processor investigate) {
- for (BlockingControlLink condition : investigate.controlLinksWaitingFor())
- considerInclusion(condition.getBlock());
-
- for (OutputProcessorPort outputPort : investigate.getOutputPorts())
- for (DataLink datalink : outputPort.getDatalinksFrom()) {
- ReceiverPort sink = datalink.getSendsTo();
- if (sink instanceof InputProcessorPort)
- considerInclusion(((InputProcessorPort) sink).getParent());
- }
- }
-
- private void considerNearestUpstream(Processor investigate) {
- for (BlockingControlLink condition : investigate.controlLinksBlocking())
- considerInclusion(condition.getUntilFinished());
- for (InputProcessorPort inputPort : investigate.getInputPorts())
- for (DataLink incomingLink : inputPort.getDatalinksTo()) {
- if (incomingLink == null)
- continue;
- SenderPort source = incomingLink.getReceivesFrom();
- if (source instanceof OutputProcessorPort)
- considerInclusion(((OutputProcessorPort) source).getParent());
- }
- }
-
- private void considerInclusion(Processor p) {
- if (!includedProcessors.contains(p)
- && !includableProcessors.contains(p))
- includableProcessors.add(p);
- }
-
- private void createNestedWorkflow() {
- final List<Edit<?>> currentWorkflowEditList = new ArrayList<>();
- Map<Object, Object> oldNewMapping = new HashMap<>();
- Map<DataLink, String> linkProcessorPortMapping = new HashMap<>();
- Map<SenderPort, OutputWorkflowPort> outputPortMap = new HashMap<>();
- Map<ReceiverPort, InputWorkflowPort> inputPortMap = new HashMap<>();
-
- Profile profile;//FIXME
- Processor nestingProcessor = createNestingProcessor(currentWorkflowEditList);
- Workflow nestedDataflow = createNestedDataflow();
-
- transferProcessors(currentWorkflowEditList, oldNewMapping,
- nestedDataflow);
- transferDatalinks(oldNewMapping, linkProcessorPortMapping,
- outputPortMap, inputPortMap, nestedDataflow);
- transferConditions(currentWorkflowEditList, oldNewMapping,
- nestingProcessor);
- addDataflowToNestingProcessor(nestingProcessor, nestedDataflow, profile);
- currentWorkflowEditList.add(new AddChildEdit<>(currentDataflow,
- nestingProcessor));
- createDatalinkEdits(currentWorkflowEditList, oldNewMapping,
- linkProcessorPortMapping, nestingProcessor);
-
- try {
- GraphController gc = graphView.getGraphController(currentDataflow);
- gc.setExpandNestedDataflow(nestingProcessor.getActivity(profile), true);
- em.doDataflowEdit(currentDataflow.getParent(), new CompoundEdit(
- currentWorkflowEditList));
- gc.redraw();
- } catch (EditException e1) {
- logger.error("failed to manufacture nested workflow", e1);
- }
- }
-
- private void addDataflowToNestingProcessor(Processor nestingProcessor,
- Workflow nestedDataflow, Profile profile) {
- Activity da = new Activity();
- da.setParent(profile);
- da.createConfiguration(NESTED_WORKFLOW).getJsonAsObjectNode()
- .put("nestedWorkflow", nestedDataflow.getName());
- try {
- new AddActivityEdit(nestingProcessor, da).doEdit();
- new SetIterationStrategyStackEdit(nestingProcessor, null/*FIXME*/).doEdit();
- for (InputActivityPort aip : da.getInputPorts()) {
- InputProcessorPort pip = new InputProcessorPort();
- pip.setName(aip.getName());
- pip.setDepth(aip.getDepth());
- new AddProcessorInputPortEdit(nestingProcessor, pip).doEdit();
- new AddActivityInputPortMappingEdit(da, pip, aip).doEdit();
- }
- for (OutputActivityPort aop : da.getOutputPorts()) {
- OutputProcessorPort pop = new OutputProcessorPort();
- pop.setName(aop.getName());
- pop.setDepth(aop.getDepth());
- pop.setGranularDepth(aop.getGranularDepth());
- new AddProcessorOutputPortEdit(nestingProcessor, pop).doEdit();
- new AddActivityOutputPortMappingEdit(da, pop, aop).doEdit();
- }
- } catch (EditException e1) {
- logger.error("failed to add ports to processor", e1);
- }
- }
-
- private void createDatalinkEdits(List<Edit<?>> editList,
- Map<Object, Object> oldNewMapping,
- Map<DataLink, String> linkProcessorPortMapping,
- Processor nestingProcessor) {
- for (DataLink dl : currentDataflow.getDataLinks())
- if (oldNewMapping.containsKey(dl.getReceivesFrom())
- && oldNewMapping.containsKey(dl.getSendsTo()))
- // Internal to nested workflow
- editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
- else if (oldNewMapping.containsKey(dl.getReceivesFrom())) {
- // Coming out of nested workflow
- OutputProcessorPort nestedPort = nestingProcessor
- .getOutputPorts().getByName(
- linkProcessorPortMapping.get(dl));
- if (nestedPort != null) {
- DataLink replacementDatalink = new DataLink(nestedPort
- .getParent().getParent(), nestedPort,
- dl.getSendsTo());
- editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
- editList.add(new AddDataLinkEdit(nestedPort.getParent()
- .getParent(), replacementDatalink));
- }
- } else if (oldNewMapping.containsKey(dl.getSendsTo())) {
- // Coming into nested workflow
- InputProcessorPort nestedPort = nestingProcessor
- .getInputPorts().getByName(
- linkProcessorPortMapping.get(dl));
- if (nestedPort != null) {
- DataLink replacementDatalink = new DataLink(nestedPort
- .getParent().getParent(), dl.getReceivesFrom(),
- nestedPort);
- editList.add(new RemoveDataLinkEdit(dl.getParent(), dl));
- editList.add(new AddDataLinkEdit(nestedPort.getParent()
- .getParent(), replacementDatalink));
- }
- }
- }
-
- private void transferConditions(List<Edit<?>> editList,
- Map<Object, Object> oldNewMapping, Processor nestingProcessor) {
- for (Processor p : currentDataflow.getProcessors()) {
- boolean isTargetMoved = oldNewMapping.containsKey(p);
- for (BlockingControlLink c : p.controlLinksWaitingFor()) {
- Processor pre = c.getUntilFinished();
- boolean isControlMoved = oldNewMapping.containsKey(pre);
- if (isTargetMoved && isControlMoved) {
- // Add in new condition
- new BlockingControlLink(
- (Processor) oldNewMapping.get(pre),
- (Processor) oldNewMapping.get(p));
- } else if (isTargetMoved) {
- editList.add(new RemoveChildEdit<>(c.getParent(),c));
- editList.add(new AddChildEdit<>(c.getParent(),
- new BlockingControlLink(pre, nestingProcessor)));
- } else if (isControlMoved) {
- editList.add(new RemoveChildEdit<>(c.getParent(), c));
- editList.add(new AddChildEdit<>(c.getParent(),
- new BlockingControlLink(nestingProcessor, p)));
- }
- }
- }
- }
-
- private void transferDatalinks(Map<Object, Object> oldNewMapping,
- Map<DataLink, String> linkProcessorPortMapping,
- Map<SenderPort, OutputWorkflowPort> outputPortMap,
- Map<ReceiverPort, InputWorkflowPort> inputPortMap,
- Workflow nestedDataflow) {
- NamedSet<InputWorkflowPort> inputPorts = new NamedSet<>();
- NamedSet<OutputWorkflowPort> outputPorts = new NamedSet<>();
-
- for (DataLink dl : currentDataflow.getDataLinks()) {
- final SenderPort datalinkSource = dl.getReceivesFrom();
- final ReceiverPort datalinkSink = dl.getSendsTo();
- if (oldNewMapping.containsKey(datalinkSource)
- && oldNewMapping.containsKey(datalinkSink)) {
- // Internal to nested workflow
- DataLink newDatalink = new DataLink(null,
- (SenderPort) oldNewMapping.get(datalinkSource),
- (ReceiverPort) oldNewMapping.get(datalinkSink));
- try {
- new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
- } catch (EditException e1) {
- logger.error("failed to connect datalink", e1);
- }
- } else if (oldNewMapping.containsKey(datalinkSource)) {
- OutputWorkflowPort dop = null;
- if (!outputPortMap.containsKey(datalinkSource)) {
- dop = new OutputWorkflowPort(nestedDataflow, uniqueName(
- datalinkSource.getName(), outputPorts));
- outputPorts.add(dop);
- outputPortMap.put(datalinkSource, dop);
- } else
- dop = outputPortMap.get(datalinkSource);
- String portName = dop.getName();
- // Coming out of nested workflow
- linkProcessorPortMapping.put(dl, portName);
- try {
- new AddWorkflowOutputPortEdit(nestedDataflow, dop).doEdit();
- DataLink newDatalink = new DataLink(
- (SenderPort) oldNewMapping.get(datalinkSource),
- dop.getInternalInputPort());
- new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
- } catch (EditException e1) {
- logger.error("failed to add dataflow output", e1);
- }
- } else if (oldNewMapping.containsKey(datalinkSink)) {
- InputWorkflowPort dip = null;
- if (!inputPortMap.containsKey(datalinkSink)) {
- dip = new InputWorkflowPort(nestedDataflow, uniqueName(
- datalinkSink.getName(), inputPorts));
- inputPorts.add(dip);
- dip.setDepth(dl.getResolvedDepth());
- inputPortMap.put(datalinkSink, dip);
- } else
- dip = inputPortMap.get(datalinkSink);
- String portName = dip.getName();
- // Coming into nested workflow
- linkProcessorPortMapping.put(dl, portName);
- try {
- new AddWorkflowInputPortEdit(nestedDataflow, dip).doEdit();
- DataLink newDatalink = new DataLink(
- dip.getInternalOutputPort(),
- (ReceiverPort) oldNewMapping.get(datalinkSink));
- new AddDataLinkEdit(nestedDataflow, newDatalink).doEdit();
- } catch (EditException e1) {
- logger.error("failed to add dataflow input", e1);
- }
- }
- }
- }
-
- private void transferProcessors(List<Edit<?>> editList,
- Map<Object, Object> oldNewMapping, Workflow nestedDataflow) {
- for (Processor entity : includedProcessors)
- try {
- if (entity instanceof Processor)
- transferProcessor(editList, oldNewMapping, nestedDataflow,
- (Processor) entity);
- /*else if (entity instanceof Merge)
- //FIXME what to do here? Anything?
- transferMerge(editList, oldNewMapping, nestedDataflow,
- (Merge) entity);*/
- } catch (Exception e1) {
- logger.error("failed to transfer processor", e1);
- }
- }
-
- /*private void transferMerge(List<Edit<?>> editList,
- Map<Object, Object> oldNewMapping, Workflow nestedDataflow,
- Merge merge) throws EditException {
- editList.add(edits.getRemoveMergeEdit(currentDataflow, merge));
- Merge newMerge = edits.createMerge(nestedDataflow);
- edits.getAddMergeEdit(nestedDataflow, newMerge).doEdit();
- oldNewMapping.put(merge, newMerge);
- for (MergeInputPort mip : merge.getInputPorts()) {
- MergeInputPort newMip = edits.createMergeInputPort(newMerge,
- mip.getName(), mip.getDepth());
- edits.getAddMergeInputPortEdit(newMerge, newMip).doEdit();
- oldNewMapping.put(mip, newMip);
- }
- oldNewMapping.put(merge.getOutputPort(), newMerge.getOutputPort());
- }*/
-
- private void transferProcessor(List<Edit<?>> editList,
- Map<Object, Object> oldNewMapping, Workflow nestedDataflow,
- Processor p) throws Exception {
- editList.add(new RemoveChildEdit<>(currentDataflow, p));
- Processor newProcessor = (Processor) p.clone();
- newProcessor.setParent(nestedDataflow);
- oldNewMapping.put(p, newProcessor);
- for (InputProcessorPort pip : p.getInputPorts())
- for (InputProcessorPort newPip : newProcessor.getInputPorts())
- if (pip.getName().equals(newPip.getName())) {
- oldNewMapping.put(pip, newPip);
- break;
- }
- for (OutputProcessorPort pop : p.getOutputPorts())
- for (OutputProcessorPort newPop : newProcessor.getOutputPorts())
- if (pop.getName().equals(newPop.getName())) {
- oldNewMapping.put(pop, newPop);
- break;
- }
- }
-
- private Processor createNestingProcessor(List<Edit<?>> editList) {
- //TODO check what workflow the new processor is going into
- Processor nestingProcessor = new Processor(currentDataflow, uniqueName(
- nameField.getText(), currentDataflow.getProcessors()));
- if (includedProcessors.size() != 1)
- return nestingProcessor;
- Processor includedProcessor = includedProcessors.get(0);
- for (Annotation a: includedProcessor.getAnnotations()) {
- Annotation newAnn = (Annotation) a.clone();
- newAnn.setTarget(nestingProcessor);
- editList.add(new AddChildEdit<>(a.getParent(), newAnn));
- }
- return nestingProcessor;
- }
-
- private Workflow createNestedDataflow() {
- Workflow nestedDataflow = new Workflow(uniqueName(nameField.getText(),
- currentDataflow.getParent().getWorkflows()));
- // Set the title of the nested workflow to the name suggested by the user
- try {
- new AnnotationTools().setAnnotationString(nestedDataflow,
- DescriptiveTitle.class, nameField.getText()).doEdit();
- } catch (EditException ex) {
- logger.error("failed to put annotation on nested dataflow", ex);
- }
- return nestedDataflow;
- }
-
- private final class OKAction extends AbstractAction {
- private static final long serialVersionUID = 6516891432445682857L;
- private final JDialog dialog;
-
- private OKAction(JDialog dialog) {
- super("OK");
- this.dialog = dialog;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (includedProcessors.isEmpty()) {
- showMessageDialog(
- null,
- "At least one service must be included in the nested workflow",
- "Nested workflow creation", WARNING_MESSAGE);
- return;
- }
-
- createNestedWorkflow();
- dialog.setVisible(false);
- }
- }
-
- private final class ResetAction extends AbstractAction {
- private static final long serialVersionUID = 7296742769289881218L;
-
- private ResetAction(JDialog dialog) {
- super("Reset");
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- resetLists();
- }
- }
-
- private final class CancelAction extends AbstractAction {
- private static final long serialVersionUID = -7842176979437027091L;
- private final JDialog dialog;
-
- private CancelAction(JDialog dialog) {
- super("Cancel");
- this.dialog = dialog;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- dialog.setVisible(false);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
deleted file mode 100644
index 0cdb2ba..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/NestedWorkflowCreatorMenuAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.awt.Dialog;
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class NestedWorkflowCreatorMenuAction extends
- AbstractContextualMenuAction {
- private static final URI configureSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/configure");
-
- private SelectionManager sm;
- private EditManager em;
- private GraphViewComponent gv;
-
- public NestedWorkflowCreatorMenuAction() {
- super(configureSection, 70);
- }
-
- public void setEditManager(EditManager editManager) {
- em = editManager;
- }
- public void setGraphView(GraphViewComponent graphView) {
- gv = graphView;
- }
- public void setSelectionManager(SelectionManager selectionManager) {
- sm = selectionManager;
- }
-
- @Override
- public boolean isEnabled() {
- Object selection = getContextualSelection().getSelection();
- if (!super.isEnabled() || selection == null)
- return false;
- if (selection instanceof Processor)
- return true;
- if (!(selection instanceof Workflow))
- return false;
- return !((Workflow) selection).getProcessors().isEmpty();
- }
-
- @Override
- protected Action createAction() {
- return new AbstractAction("Create nested workflow...",
- DataflowActivityIcon.getDataflowIcon()) {
- private static final long serialVersionUID = -3121307982540205215L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- createNestedWorkflow();
- }
- };
- }
-
- private void createNestedWorkflow() {
- Dialog dialog = new NestedWorkflowCreationDialog(null,
- getContextualSelection().getSelection(),
- sm.getSelectedWorkflow(), em, gv);
- dialog.setVisible(true);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
deleted file mode 100644
index 2bce63a..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-import java.net.MalformedURLException;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentAction;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class OpenComponentFromComponentActivityAction extends ComponentAction {
- private static Logger logger = getLogger(OpenComponentFromComponentActivityAction.class);
-
- private final FileManager fileManager;
- private final ComponentFactory factory;
- private final FileType fileType;
-
- public OpenComponentFromComponentActivityAction(FileManager fileManager,
- ComponentFactory factory, FileType ft,
- GraphViewComponent graphView, ComponentServiceIcon icon) {
- super("Open component...", graphView);
- this.fileManager = fileManager;
- this.factory = factory;
- this.fileType = ft;
- setIcon(icon);
- }
-
- private Activity selection;
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- try {
- Version.ID ident = new ComponentActivityConfigurationBean(
- selection.getConfiguration(), factory);
- WorkflowBundle d = fileManager.openDataflow(fileType, ident);
- markGraphAsBelongingToComponent(d);
- } catch (OpenException e) {
- logger.error("failed to open component", e);
- } catch (MalformedURLException e) {
- logger.error("bad URL in component description", e);
- }
- }
-
- public void setSelection(Activity selection) {
- this.selection = selection;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
deleted file mode 100644
index 6f28816..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/OpenComponentFromComponentActivityMenuAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class OpenComponentFromComponentActivityMenuAction extends
- AbstractContextualMenuAction {
- private static final URI configureSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/configure");
-
- private SelectionManager sm;
- private FileManager fileManager;
- private ComponentFactory factory;
- private FileType fileType;
- private GraphViewComponent graphView;
- private ComponentServiceIcon icon;
-
- public OpenComponentFromComponentActivityMenuAction() {
- super(configureSection, 75);
- }
-
- public void setSelectionManager(SelectionManager sm) {
- this.sm = sm;
- }
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileType(FileType fileType) {
- this.fileType = fileType;
- }
-
- public void setGraphView(GraphViewComponent graphView) {
- this.graphView = graphView;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- public boolean isEnabled() {
- return getSelectedActivity() != null;
- }
-
- @Override
- protected Action createAction() {
- OpenComponentFromComponentActivityAction action = new OpenComponentFromComponentActivityAction(
- fileManager, factory, fileType, graphView, icon);
- action.setSelection(getSelectedActivity());
- return action;
- }
-
- private Activity getSelectedActivity() {
- Object selection = getContextualSelection().getSelection();
- if (!super.isEnabled() || !(selection instanceof Processor))
- return null;
-
- try {
- return ((Processor) selection).getActivity(sm.getSelectedProfile());
- } catch (RuntimeException e) {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
deleted file mode 100644
index ebb51a8..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentAction.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean.ignorableNames;
-import static io.github.taverna_extras.component.ui.util.Utils.uniqueName;
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-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.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.workbench.edits.CompoundEdit;
-import org.apache.taverna.workbench.edits.Edit;
-import org.apache.taverna.workbench.edits.EditException;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workflow.edits.AddActivityEdit;
-import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
-import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
-import org.apache.taverna.workflow.edits.RemoveActivityEdit;
-import org.apache.taverna.workflow.edits.RenameEdit;
-
-/**
- * @author alanrw
- */
-public class ReplaceByComponentAction extends AbstractAction {
- private static final long serialVersionUID = 7364648399658711574L;
-
- private final EditManager em;
- private final ComponentPreference prefs;
- private final SelectionManager sm;
- private final ComponentFactory factory;
- private final Scufl2Tools tools = new Scufl2Tools();
-
- private Processor selection;
-
- public ReplaceByComponentAction(ComponentPreference prefs,
- ComponentFactory factory, EditManager em, SelectionManager sm,
- ComponentServiceIcon icon) {
- super("Replace by component...", icon.getIcon());
- this.prefs = prefs;
- this.em = em;
- this.sm = sm;
- this.factory = factory;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- JPanel overallPanel = new JPanel(new BorderLayout());
- ComponentChooserPanel panel = new ComponentChooserPanel(prefs);
- overallPanel.add(panel, CENTER);
- JPanel checkBoxPanel = new JPanel(new FlowLayout());
- JCheckBox replaceAllCheckBox = new JCheckBox(
- "Replace all matching services");
- checkBoxPanel.add(replaceAllCheckBox);
- checkBoxPanel.add(new JSeparator());
- JCheckBox renameServicesCheckBox = new JCheckBox("Rename service(s)");
- checkBoxPanel.add(renameServicesCheckBox);
- renameServicesCheckBox.setSelected(true);
- overallPanel.add(checkBoxPanel, SOUTH);
- int answer = showConfirmDialog(null, overallPanel, "Component choice",
- OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doReplace(panel.getChosenRegistry(), panel.getChosenFamily(),
- replaceAllCheckBox.isSelected(),
- renameServicesCheckBox.isSelected(),
- panel.getChosenComponent());
- }
-
- private void doReplace(Registry chosenRegistry, Family chosenFamily,
- boolean replaceAll, boolean rename, Component chosenComponent) {
- Version chosenVersion = chosenComponent.getComponentVersionMap().get(
- chosenComponent.getComponentVersionMap().lastKey());
- Version.ID ident = new Version.Identifier(
- chosenRegistry.getRegistryBase(), chosenFamily.getName(),
- chosenComponent.getName(), chosenVersion.getVersionNumber());
-
- ComponentActivityConfigurationBean cacb = new ComponentActivityConfigurationBean(
- ident, factory);
-
- try {
- if (replaceAll) {
- Activity baseActivity = selection.getActivity(sm
- .getSelectedProfile());
- URI activityType = baseActivity.getType();
- String configString = getConfigString(baseActivity);
-
- replaceAllMatchingActivities(activityType, cacb, configString,
- rename, sm.getSelectedWorkflow());
- } else
- replaceActivity(cacb, selection, rename,
- sm.getSelectedWorkflow());
- } catch (Exception e) {
- showMessageDialog(
- null,
- "Failed to replace nested workflow with component: "
- + e.getMessage(), "Component Problem",
- ERROR_MESSAGE);
- }
- }
-
- private String getConfigString(Activity baseActivity) {
- return baseActivity.getConfiguration().getJsonAsString();
- }
-
- private void replaceAllMatchingActivities(URI activityType,
- ComponentActivityConfigurationBean cacb, String configString,
- boolean rename, Workflow d) throws IntermediateException {
- for (Processor p : d.getProcessors()) {
- Activity a = p.getActivity(sm.getSelectedProfile());
- if (a.getType().equals(activityType)
- && getConfigString(a).equals(configString))
- replaceActivity(cacb, p, rename, d);
- else if (a.getType().equals(NESTED_WORKFLOW))
- replaceAllMatchingActivities(activityType, cacb, configString,
- rename,
- tools.nestedWorkflowForProcessor(p, a.getParent()));
- }
- }
-
- private void replaceActivity(ComponentActivityConfigurationBean cacb,
- Processor p, boolean rename, Workflow d) throws IntermediateException {
- final Activity originalActivity = p.getActivity(sm.getSelectedProfile());
- final List<Edit<?>> currentWorkflowEditList = new ArrayList<>();
-
- Activity replacementActivity = new Activity();
- try {
- URI configType;
- replacementActivity.createConfiguration(configType);
-
- replacementActivity.configure(cacb);
- //FIXME
- } catch (Exception e) {
- throw new IntermediateException(
- "Unable to configure component", e);
- }
- if (originalActivity.getInputPorts().size() != replacementActivity
- .getInputPorts().size())
- throw new IntermediateException(
- "Component does not have matching ports", null);
-
- int replacementOutputSize = replacementActivity.getOutputPorts().size();
- int originalOutputSize = originalActivity.getOutputPorts().size();
- for (String name : ignorableNames) {
- if (originalActivity.getOutputPorts().getByName(name) != null)
- originalOutputSize--;
- if (replacementActivity.getOutputPorts().getByName(name) != null)
- replacementOutputSize--;
- }
-
- int sizeDifference = replacementOutputSize - originalOutputSize;
- if (sizeDifference != 0)
- throw new IntermediateException(
- "Component does not have matching ports", null);
-
- for (InputActivityPort aip : originalActivity.getInputPorts()) {
- String aipName = aip.getName();
- int aipDepth = aip.getDepth();
- InputActivityPort caip = replacementActivity.getInputPorts().getByName(aipName);
- if ((caip == null) || (caip.getDepth() != aipDepth))
- throw new RuntimeException("Original input port "
- + aipName + " is not matched");
- }
- for (OutputActivityPort aop : originalActivity.getOutputPorts()) {
- String aopName = aop.getName();
- int aopDepth = aop.getDepth();
- OutputActivityPort caop = replacementActivity.getOutputPorts().getByName(aopName);
- if ((caop == null || aopDepth != caop.getDepth())
- && !ignorableNames.contains(aopName))
- throw new IntermediateException(
- "Original output port " + aopName + " is not matched", null);
- }
-
- for (InputProcessorPort pip : p.getInputPorts()) {
- InputActivityPort iap = replacementActivity.getInputPorts()
- .getByName(pip.getName());
- if (iap == null)
- iap = new InputActivityPort(replacementActivity, pip.getName());
- currentWorkflowEditList.add(new AddActivityInputPortMappingEdit(
- replacementActivity, pip, iap));
- }
-
- for (OutputProcessorPort pop : p.getOutputPorts()) {
- OutputActivityPort oap = replacementActivity.getOutputPorts()
- .getByName(pop.getName());
- if (oap == null)
- oap = new OutputActivityPort(replacementActivity, pop.getName());
- currentWorkflowEditList.add(new AddActivityOutputPortMappingEdit(
- replacementActivity, pop, oap));
- }
-
- currentWorkflowEditList
- .add(new AddActivityEdit(p, replacementActivity));
- currentWorkflowEditList
- .add(new RemoveActivityEdit(p, originalActivity));
-
- if (rename) {
- String possibleName = replacementActivity.getConfiguration()
- .getJsonAsObjectNode().get(COMPONENT_NAME).textValue();
- currentWorkflowEditList.add(new RenameEdit<>(p, uniqueName(
- possibleName, d.getProcessors())));
- }
- try {
- em.doDataflowEdit(d.getParent(), new CompoundEdit(
- currentWorkflowEditList));
- } catch (EditException e) {
- throw new IntermediateException(
- "Unable to replace with component", e);
- }
- }
-
- public void setSelection(Processor selection) {
- this.selection = selection;
- }
-
- @SuppressWarnings("serial")
- private static class IntermediateException extends Exception {
- IntermediateException(String msg, Throwable cause) {
- super(msg, cause);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
deleted file mode 100644
index 470ad40..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ReplaceByComponentMenuAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-
-/**
- * @author alanrw
- */
-public class ReplaceByComponentMenuAction extends AbstractContextualMenuAction {
- private static final URI configureSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/configure");
-
- private ComponentPreference preferences;
- private EditManager editManager;
- private SelectionManager selectionManager;
- private ComponentFactory factory;
- private ComponentServiceIcon icon;
-
- public ReplaceByComponentMenuAction() {
- super(configureSection, 75);
- }
-
- public void setPreferences(ComponentPreference preferences) {
- this.preferences = preferences;
- }
-
- public void setEditManager(EditManager editManager) {
- this.editManager = editManager;
- }
-
- public void setSelectionManager(SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- public boolean isEnabled() {
- Object selection = getContextualSelection().getSelection();
- if (!super.isEnabled())
- return false;
- return (selection instanceof Processor);
- }
-
- @Override
- protected Action createAction() {
- ReplaceByComponentAction action = new ReplaceByComponentAction(
- preferences, factory, editManager, selectionManager, icon);
- action.setSelection((Processor) getContextualSelection().getSelection());
- return action;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
deleted file mode 100644
index 671e190..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/AbstractComponentMenuAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-abstract class AbstractComponentMenuAction extends AbstractMenuAction {
- public AbstractComponentMenuAction(int positionHint, URI id) {
- super(COMPONENT_SECTION, positionHint, id);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
deleted file mode 100644
index da22a60..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-
-/**
- * @author alanrw
- */
-public class ComponentCloseAction extends AbstractAction implements
- Observer<FileManagerEvent> {
- private static final long serialVersionUID = -153986599735293879L;
- private static final String CLOSE_COMPONENT = "Close component";
- @SuppressWarnings("unused")
- private static Logger logger = getLogger(ComponentCloseAction.class);
-
- private Action closeAction;
- private final Utils utils;
-
- public ComponentCloseAction(Action closeWorkflowAction, FileManager fm,
- ComponentServiceIcon icon, Utils utils) {
- super(CLOSE_COMPONENT, icon.getIcon());
- closeAction = closeWorkflowAction;
- this.utils = utils;
- fm.addObserver(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- closeAction.actionPerformed(arg0);
- }
-
- @Override
- public boolean isEnabled() {
- return utils.currentDataflowIsComponent();
- }
-
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- setEnabled(utils.currentDataflowIsComponent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
deleted file mode 100644
index 6c40a5f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCloseMenuAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentCloseMenuAction extends AbstractComponentMenuAction {
- private static final URI CLOSE_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentClose");
-
- private Action action;
- private FileManager fm;
- private ComponentServiceIcon icon;
- private Utils utils;
-
- public ComponentCloseMenuAction() {
- super(1000, CLOSE_COMPONENT_URI);
- }
-
- public void setCloseWorkflowAction(Action action) {
- this.action = action;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentCloseAction(action, fm, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
deleted file mode 100644
index 676a6c9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyAction.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
-import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
-import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
-import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class ComponentCopyAction extends AbstractAction {
- private static final long serialVersionUID = -4440978712410081685L;
- private static final Logger logger = getLogger(ComponentCopyAction.class);
- private static final String COPY_COMPONENT = "Copy component...";
-
- private final ComponentPreference prefs;
- private final Utils utils;
-
- public ComponentCopyAction(ComponentPreference pref, ComponentServiceIcon icon, Utils utils) {
- super(COPY_COMPONENT, icon.getIcon());
- this.prefs = pref;
- this.utils = utils;
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- JPanel overallPanel = new JPanel();
- overallPanel.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- ComponentChooserPanel source = new ComponentChooserPanel(prefs);
- source.setBorder(new TitledBorder("Source component"));
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(source, gbc);
-
- final RegistryAndFamilyChooserPanel target = new RegistryAndFamilyChooserPanel(prefs);
- target.setBorder(new TitledBorder("Target family"));
- gbc.gridy++;
- overallPanel.add(target, gbc);
-
- source.addObserver(new Observer<ComponentChoiceMessage>() {
- @Override
- public void notify(Observable<ComponentChoiceMessage> sender,
- ComponentChoiceMessage message) throws Exception {
- Profile componentProfile = null;
- Family componentFamily = message.getComponentFamily();
- if (componentFamily != null)
- componentProfile = componentFamily.getComponentProfile();
- ProfileChoiceMessage profileMessage = new ProfileChoiceMessage(
- componentProfile);
- target.notify(null, profileMessage);
- }
- });
-
- int answer = showConfirmDialog(null, overallPanel, "Copy Component",
- OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doCopy(source.getChosenComponent(), target.getChosenFamily());
- }
-
- private void doCopy(Component sourceComponent, Family targetFamily) {
- if (sourceComponent == null) {
- showMessageDialog(null, "Unable to determine source component",
- "Component Copy Problem", ERROR_MESSAGE);
- return;
- } else if (targetFamily == null) {
- showMessageDialog(null, "Unable to determine target family",
- "Component Copy Problem", ERROR_MESSAGE);
- return;
- }
-
- try {
- String componentName = sourceComponent.getName();
- boolean alreadyUsed = targetFamily.getComponent(componentName) != null;
- if (alreadyUsed)
- showMessageDialog(null, componentName + " is already used",
- "Duplicate component name", ERROR_MESSAGE);
- else {
- Version targetVersion = doCopy(sourceComponent, targetFamily,
- componentName);
- try {
- utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
- targetVersion.getID()).getConfiguration());
- } catch (Exception e) {
- logger.error(e);
- }
- }
- } catch (ComponentException e) {
- logger.error("failed to copy component", e);
- showMessageDialog(null,
- "Unable to create component: " + e.getMessage(),
- "Component Copy Problem", ERROR_MESSAGE);
- }
- }
-
- private Version doCopy(Component sourceComponent, Family targetFamily,
- String componentName) throws ComponentException {
- return targetFamily
- .createComponentBasedOn(
- componentName,
- sourceComponent.getDescription(),
- sourceComponent
- .getComponentVersionMap()
- .get(sourceComponent.getComponentVersionMap()
- .lastKey()).getImplementation());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
deleted file mode 100644
index 3c6db63..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCopyMenuAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-/**
- * @author alanrw
- */
-public class ComponentCopyMenuAction extends AbstractComponentMenuAction {
- private static final URI COPY_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentCopy");
-
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
- private Utils utils;
-
- public ComponentCopyMenuAction() {
- super(800, COPY_COMPONENT_URI);
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {//FIXME beaninject
- this.prefs = prefs;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentCopyAction(prefs, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
deleted file mode 100644
index ffe26d8..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentCreatorSupport.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
-import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserComponentEntryPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.workbench.edits.CompoundEdit;
-import org.apache.taverna.workbench.edits.Edit;
-import org.apache.taverna.workbench.edits.EditException;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workflow.edits.AddActivityEdit;
-import org.apache.taverna.workflow.edits.AddActivityInputPortMappingEdit;
-import org.apache.taverna.workflow.edits.AddActivityOutputPortMappingEdit;
-import org.apache.taverna.workflow.edits.AddDataLinkEdit;
-import org.apache.taverna.workflow.edits.AddProcessorEdit;
-import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
-import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
-import org.apache.taverna.workflow.edits.RemoveActivityEdit;
-import org.apache.taverna.workflow.edits.RenameEdit;
-import org.apache.taverna.workflowmodel.processor.activity.NestedDataflow;
-import org.apache.taverna.workflowmodel.utils.Tools;
-
-public class ComponentCreatorSupport {
- private static final Logger logger = getLogger(ComponentCreatorSupport.class);
-
- private ComponentFactory factory;
- private FileManager fm;
- private EditManager em;
- private ComponentPreference prefs;
- private FileType ft;
- private SelectionManager sm;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setPreferences(ComponentPreference pref) {
- this.prefs = pref;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setEditManager(EditManager em) {
- this.em = em;
- }
-
- public void setFileType(FileType ft) {
- this.ft = ft;
- }
-
- public void setSelectionManager(SelectionManager sm) {
- this.sm = sm;
- }
-
- public class CopiedProcessor {
- Processor processor;
- Map<String,Workflow> requiredSubworkflows;
- }
-
- void moveComponentActivityIntoPlace(Activity toReplace, Processor contextProcessor,
- Activity replacingActivity) throws EditException {
- List<Edit<?>> editsToDo = new ArrayList<>();
- for (InputProcessorPort pip : contextProcessor.getInputPorts())
- editsToDo.add(new AddActivityInputPortMappingEdit(toReplace, pip, null/*FIXME*/));
- for (OutputProcessorPort pop : contextProcessor.getOutputPorts())
- editsToDo.add(new AddActivityOutputPortMappingEdit(toReplace, pop, null/*FIXME*/));
- editsToDo.add(new RemoveActivityEdit(contextProcessor, toReplace));
- editsToDo.add(new AddActivityEdit(contextProcessor, replacingActivity));
- em.doDataflowEdit(contextProcessor.getParent().getParent(),
- new CompoundEdit(editsToDo));
- }
-
- void connectNewProcessor(Workflow d, Processor newProcessor)
- throws EditException {
- List<Edit<?>> editsToDo = new ArrayList<>();
-
- for (InputProcessorPort pip : newProcessor.getInputPorts()) {
- InputWorkflowPort dip = new InputWorkflowPort(d, pip.getName());
- // FIXME How to set depth?
- editsToDo.add(new AddWorkflowInputPortEdit(d, dip));
- editsToDo.add(new AddDataLinkEdit(d, new DataLink(d, dip, pip)));
- }
-
- for (OutputProcessorPort pop : newProcessor.getOutputPorts()) {
- OutputWorkflowPort dop = new OutputWorkflowPort(d, pop.getName());
- // TODO How to indicate depth?
- editsToDo.add(new AddWorkflowOutputPortEdit(d, dop));
- editsToDo.add(new AddDataLinkEdit(d, new DataLink(d, pop, dop)));
- }
- em.doDataflowEdit(d.getParent(), new CompoundEdit(editsToDo));
- }
-
- public ComponentActivityConfigurationBean saveWorkflowAsComponent(
- WorkflowBundle d, Version.ID ident) throws SaveException, IOException,
- ComponentException {
- if (ident == null)
- return null;
-
- createInitialComponent(d, ident);
-
- Utils.refreshComponentServiceProvider(new ComponentServiceProviderConfig(
- ident));
- return new ComponentActivityConfigurationBean(ident, factory);
- }
-
- public ComponentActivityConfigurationBean saveWorkflowAsComponent(
- Workflow d, Version.ID ident) throws SaveException, IOException,
- ComponentException {
- WorkflowBundle b = new WorkflowBundle();
- ((Workflow)d.clone()).setParent(b);
- //FIXME also must copy profile parts!
- return saveWorkflowAsComponent(b, ident);
- }
-
- Version.ID getNewComponentIdentification(String defaultName) {
- RegistryAndFamilyChooserComponentEntryPanel panel = new RegistryAndFamilyChooserComponentEntryPanel(prefs);
- panel.setComponentName(defaultName);
- int result = showConfirmDialog(null, panel, "Component location",
- OK_CANCEL_OPTION);
- if (result != OK_OPTION)
- return null;
-
- Version.ID ident = panel.getComponentVersionIdentification();
- if (ident == null) {
- showMessageDialog(null,
- "Not enough information to create component",
- "Component creation problem", ERROR_MESSAGE);
- return null;
- }
-
- try {
- Component existingComponent = factory.getComponent(ident);
- if (existingComponent != null) {
- showMessageDialog(null,
- "Component with this name already exists",
- "Component creation problem", ERROR_MESSAGE);
- return null;
- }
- } catch (ComponentException e) {
- logger.error("failed to search registry", e);
- showMessageDialog(null,
- "Problem searching registry: " + e.getMessage(),
- "Component creation problem", ERROR_MESSAGE);
- return null;
- }
- return ident;
- }
-
- CopiedProcessor copyProcessor(Processor p) throws IOException {
- CopiedProcessor copy = new CopiedProcessor();
- copy.processor = ProcessorXMLSerializer.getInstance().processorToXML(p);
- copy.requiredSubworkflows = new HashMap<>();
- rememberSubworkflows(p, copy);
- return copy;
- }
-
- void rememberSubworkflows(Processor p, CopiedProcessor copy) {
- for (Activity a : p.getActivity(sm.getSelectedProfile()))
- if (a instanceof NestedDataflow) {
- NestedDataflow da = (NestedDataflow) a;
- Workflow df = da.getNestedDataflow();
- if (!copy.requiredSubworkflows.containsKey(df.getIdentifier())) {
- copy.requiredSubworkflows.put(df.getIdentifier(),
- DataflowXMLSerializer.getInstance()
- .serializeDataflow(df));
- for (Processor sp : df.getProcessors())
- rememberSubworkflows(sp, copy);
- }
- }
- }
-
- public Processor pasteProcessor(CopiedProcessor copy, Workflow d)
- throws
- ClassNotFoundException, InstantiationException,
- IllegalAccessException, EditException {
- Processor result = ProcessorXMLDeserializer.getInstance()
- .deserializeProcessor(copy.processor, copy.requiredSubworkflows);
- if (result == null)
- return null;
-
- String newName = Tools.uniqueProcessorName(result.getName(), d);
-
- List<Edit<?>> editList = new ArrayList<>();
- if (!newName.equals(result.getName()))
- editList.add(new RenameEdit<>(result, newName));
- editList.add(new AddProcessorEdit(d, result));
- em.doDataflowEdit(d.getParent(), new CompoundEdit(editList));
-
- return result;
- }
-
- public Version.ID createInitialComponent(WorkflowBundle d, Version.ID ident)
- throws ComponentException {
- try {
- fm.saveDataflow(d, ft, ident, false);
-
- em.doDataflowEdit(d, new RenameEdit<>(d, d.getName()));
- } catch (SaveException | IllegalStateException | EditException e) {
- throw new ComponentException(e);
- }
- return ident;
- }
-}
[24/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteMenuAction.java
new file mode 100644
index 0000000..99c75f9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentDeleteMenuAction.java
@@ -0,0 +1,67 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentDeleteMenuAction extends AbstractComponentMenuAction {
+ private static final URI DELETE_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentDelete");
+
+ private FileManager fm;
+ private ComponentServiceIcon icon;
+ private ComponentPreference prefs;
+ private Utils utils;
+
+ public ComponentDeleteMenuAction() {
+ super(1200, DELETE_COMPONENT_URI);
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentDeleteAction(fm, prefs, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuAction.java
new file mode 100644
index 0000000..1176e6d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuAction.java
@@ -0,0 +1,56 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * Basis for all menu actions. Intended to be configured by Spring.
+ *
+ * @author Donal Fellows
+ */
+public class ComponentMenuAction extends AbstractMenuAction {
+ /**
+ * Construct a menu action to appear within the "Components" menu.
+ * @param positionHint
+ * Where on the menu this should come.
+ * @param id
+ * How this should be identified to Taverna.
+ */
+ public ComponentMenuAction(int positionHint, String id) {
+ super(COMPONENT_SECTION, positionHint, URI.create(id));
+ }
+
+ private Action action;
+
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ @Override
+ protected Action createAction() {
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuSection.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuSection.java
new file mode 100644
index 0000000..07e037d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMenuSection.java
@@ -0,0 +1,37 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author alanrw
+ */
+public class ComponentMenuSection extends AbstractMenuSection {
+ public static final URI COMPONENT_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentSection");
+
+ public ComponentMenuSection() {
+ super(COMPONENT, 400, COMPONENT_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeAction.java
new file mode 100644
index 0000000..a350b16
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeAction.java
@@ -0,0 +1,135 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.border.TitledBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+/**
+ * @author alanrw
+ */
+public class ComponentMergeAction extends AbstractAction {
+ private static final long serialVersionUID = 6791184757725253807L;
+ private static final Logger logger = getLogger(ComponentMergeAction.class);
+ private static final String MERGE_COMPONENT = "Merge component...";
+
+ private final ComponentPreference prefs;
+
+ public ComponentMergeAction(ComponentPreference prefs,
+ ComponentServiceIcon icon) {
+ super(MERGE_COMPONENT, icon.getIcon());
+ this.prefs = prefs;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ JPanel overallPanel = new JPanel();
+ overallPanel.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ ComponentChooserPanel source = new ComponentChooserPanel(prefs);
+ source.setBorder(new TitledBorder("Source component"));
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(source, gbc);
+
+ final ComponentChooserPanel target = new ComponentChooserPanel(prefs);
+ target.setBorder(new TitledBorder("Target component"));
+ gbc.gridy++;
+ overallPanel.add(target, gbc);
+
+ source.addObserver(new Observer<ComponentChoiceMessage>() {
+ @Override
+ public void notify(Observable<ComponentChoiceMessage> sender,
+ ComponentChoiceMessage message) throws Exception {
+ target.notify(null, new ProfileChoiceMessage(message
+ .getComponentFamily().getComponentProfile()));
+ }
+ });
+
+ int answer = showConfirmDialog(null, overallPanel, "Merge Component",
+ OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doMerge(source.getChosenComponent(), target.getChosenComponent());
+ }
+
+ private void doMerge(Component sourceComponent, Component targetComponent) {
+ if (sourceComponent == null) {
+ showMessageDialog(null, "Unable to determine source component",
+ "Component Merge Problem", ERROR_MESSAGE);
+ return;
+ } else if (targetComponent == null) {
+ showMessageDialog(null, "Unable to determine target component",
+ "Component Merge Problem", ERROR_MESSAGE);
+ return;
+ } else if (sourceComponent.equals(targetComponent)) {
+ showMessageDialog(null, "Cannot merge a component with itself",
+ "Component Merge Problem", ERROR_MESSAGE);
+ return;
+ }
+
+ try {
+ Version sourceVersion = sourceComponent.getComponentVersionMap()
+ .get(sourceComponent.getComponentVersionMap().lastKey());
+ targetComponent.addVersionBasedOn(
+ sourceVersion.getImplementation(), "Merge from "
+ + sourceComponent.getFamily().getName() + ":"
+ + sourceComponent.getName());
+ } catch (ComponentException e) {
+ logger.error("failed to merge component", e);
+ showMessageDialog(null, "Failed to merge component: " + e,
+ "Component Merge Problem", ERROR_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeMenuAction.java
new file mode 100644
index 0000000..1bcac6a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentMergeMenuAction.java
@@ -0,0 +1,55 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+/**
+ * @author alanrw
+ */
+public class ComponentMergeMenuAction extends AbstractComponentMenuAction {
+ private static final URI MERGE_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentMerge");
+
+ private ComponentServiceIcon icon;
+ private ComponentPreference prefs;
+
+ public ComponentMergeMenuAction() {
+ super(900, MERGE_COMPONENT_URI);
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentMergeAction(prefs, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveAction.java
new file mode 100644
index 0000000..0226432
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveAction.java
@@ -0,0 +1,69 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+
+/**
+ * @author alanrw
+ */
+public class ComponentSaveAction extends AbstractAction implements
+ Observer<FileManagerEvent> {
+ private static final long serialVersionUID = -2391891750558659714L;
+ @SuppressWarnings("unused")
+ private static Logger logger = getLogger(ComponentSaveAction.class);
+ private static final String SAVE_COMPONENT = "Save component";
+
+ private Utils utils;
+ private Action saveWorkflowAction;
+
+ public ComponentSaveAction(Action saveAction, FileManager fm,
+ ComponentServiceIcon icon, Utils utils) {
+ super(SAVE_COMPONENT, icon.getIcon());
+ saveWorkflowAction = saveAction;
+ this.utils = utils;
+ fm.addObserver(this);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ saveWorkflowAction.actionPerformed(e);
+ }
+
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ setEnabled(saveWorkflowAction.isEnabled()
+ && utils.currentDataflowIsComponent());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveMenuAction.java
new file mode 100644
index 0000000..cd0418d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSaveMenuAction.java
@@ -0,0 +1,67 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentSaveMenuAction extends AbstractComponentMenuAction {
+ private static final URI SAVE_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentSave");
+
+ private Action action;
+ private FileManager fm;
+ private ComponentServiceIcon icon;
+ private Utils utils;
+
+ public ComponentSaveMenuAction() {
+ super(1100, SAVE_COMPONENT_URI);
+ }
+
+ //FIXME beaninject net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction
+ public void setSaveWorkflowAction(Action action) {
+ this.action = action;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentSaveAction(action, fm, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchAction.java
new file mode 100644
index 0000000..56e7395
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchAction.java
@@ -0,0 +1,169 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JOptionPane.showOptionDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.PrefixPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SearchChoicePanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceDesc;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+
+/**
+ * @author alanrw
+ */
+public class ComponentSearchAction extends AbstractAction {
+ private static final String WFDESC_PREFIX = "wfdesc";
+ private static final long serialVersionUID = -7780471499146286881L;
+ @SuppressWarnings("unused")
+ private static final Logger logger = getLogger(ComponentSearchAction.class);
+ private static final String SEARCH_FOR_COMPONENTS = "Search for components...";
+
+ private final ComponentPreference prefs;
+ private final ComponentFactory factory;
+ private final EditManager em;
+ private final MenuManager mm;
+ private final SelectionManager sm;
+ private final ServiceRegistry sr;
+ private final ComponentServiceIcon icon;
+
+ public ComponentSearchAction(ComponentPreference prefs,
+ ComponentFactory factory, EditManager em, MenuManager mm,
+ SelectionManager sm, ServiceRegistry sr, ComponentServiceIcon icon) {
+ super(SEARCH_FOR_COMPONENTS, icon.getIcon());
+ this.prefs = prefs;
+ this.factory = factory;
+ this.em = em;
+ this.mm = mm;
+ this.sm = sm;
+ this.sr = sr;
+ this.icon = icon;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JPanel overallPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
+
+ gbc.insets.left = 5;
+ gbc.insets.right = 5;
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ gbc.gridy++;
+ overallPanel.add(registryPanel, gbc);
+
+ ProfileChooserPanel profilePanel = new ProfileChooserPanel(registryPanel);
+ gbc.gridx = 0;
+ gbc.gridy++;
+ overallPanel.add(profilePanel, gbc);
+
+ PrefixPanel prefixPanel = new PrefixPanel(profilePanel);
+ gbc.gridx = 0;
+ gbc.gridy++;
+ overallPanel.add(prefixPanel, gbc);
+
+ JTextArea queryPane = new JTextArea(20, 80);
+ gbc.gridx = 0;
+ gbc.weighty = 1;
+ gbc.gridy++;
+ overallPanel.add(new JScrollPane(queryPane), gbc);
+
+ int answer = showConfirmDialog(null, overallPanel,
+ "Search for components", OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doSearch(registryPanel.getChosenRegistry(),
+ profilePanel.getChosenProfile(),
+ prefixPanel.getPrefixMap(), queryPane.getText());
+ }
+
+ private void doSearch(Registry chosenRegistry, Profile chosenProfile,
+ SortedMap<String, String> prefixMap, String queryString) {
+ if (chosenRegistry == null) {
+ showMessageDialog(null, "Unable to determine registry",
+ "Component Registry Problem", ERROR_MESSAGE);
+ return;
+ }
+ if (chosenProfile == null) {
+ showMessageDialog(null, "Unable to determine profile",
+ "Component Profile Problem", ERROR_MESSAGE);
+ return;
+ }
+ StringBuilder prefixString = new StringBuilder();
+ for (Entry<String, String> entry : prefixMap.entrySet())
+ if (!entry.getKey().equals(WFDESC_PREFIX))
+ prefixString.append(constructPrefixString(entry));
+
+ SearchChoicePanel searchChoicePanel = new SearchChoicePanel(
+ chosenRegistry, prefixString.toString(), queryString);
+ int answer = showOptionDialog(null, searchChoicePanel,
+ "Matching components", OK_CANCEL_OPTION, QUESTION_MESSAGE,
+ null, new String[] { "Add to workflow", "Cancel" }, "Cancel");
+ if (answer == OK_OPTION) {
+ Version.ID ident = searchChoicePanel.getVersionIdentification();
+ if (ident != null)
+ WorkflowView.importServiceDescription(new ComponentServiceDesc(prefs,
+ factory, icon, ident), false, em, mm, sm, sr);
+ }
+ }
+
+ private static String constructPrefixString(Entry<String, String> entry) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ return String.format("PREFIX %s:<%s>\n", key, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchMenuAction.java
new file mode 100644
index 0000000..c621651
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentSearchMenuAction.java
@@ -0,0 +1,85 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentSearchMenuAction extends AbstractComponentMenuAction {
+ private static final URI SEARCH_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentSearch");
+ private ComponentPreference prefs;
+ private ComponentFactory factory;
+ private EditManager em;
+ private MenuManager mm;
+ private SelectionManager sm;
+ private ServiceRegistry serviceRegistry;
+ private ComponentServiceIcon icon;
+
+ public ComponentSearchMenuAction() {
+ super(1500, SEARCH_COMPONENT_URI);
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setEditManager(EditManager em) {
+ this.em = em;
+ }
+
+ public void setMenuManager(MenuManager mm) {
+ this.mm = mm;
+ }
+
+ public void setSelectionManager(SelectionManager sm) {
+ this.sm = sm;
+ }
+
+ public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentSearchAction(prefs, factory, em, mm, sm,
+ serviceRegistry, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorAction.java
new file mode 100644
index 0000000..0c7a668
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorAction.java
@@ -0,0 +1,112 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.component;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentServiceCreatorAction extends AbstractAction {
+ private static final long serialVersionUID = -2611514696254112190L;
+ private static Logger logger = getLogger(ComponentServiceCreatorAction.class);
+
+ private final Processor p;
+ private final Profile profile;
+ private final ComponentCreatorSupport support;
+
+ public ComponentServiceCreatorAction(Processor processor, SelectionManager sm,
+ ComponentCreatorSupport support, ComponentServiceIcon icon) {
+ super("Create component...", icon.getIcon());
+ this.support = support;
+ p = processor;
+ profile = sm.getSelectedProfile();
+ }
+
+ private Workflow getNestedWorkflow(Activity a) {
+ JsonNode nw = a.getConfiguration().getJson().get("nestedWorkflow");
+ return a.getParent().getParent().getWorkflows().getByName(nw.asText());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ Version.ID ident = support.getNewComponentIdentification(p.getName());
+ if (ident == null)
+ return;
+
+ Activity a = p.getActivity(profile);
+
+ try {
+ Workflow d;
+ if (NESTED_WORKFLOW.equals(a.getType()))
+ d = getNestedWorkflow(a);
+ else {
+ d = new Workflow();
+
+ /* TODO: Keep the description */
+ // fm.setCurrentDataflow(current);
+
+ CopiedProcessor processorElement = support.copyProcessor(p);
+
+ Processor newProcessor;
+ try {
+ newProcessor = support.pasteProcessor(processorElement, d);
+ } catch (IllegalArgumentException e) {
+ logger.error(
+ "failed to paste processor representing component",
+ e);
+ showMessageDialog(null, e.getMessage(),
+ "Component creation failure", ERROR_MESSAGE);
+ return;
+ }
+
+ support.connectNewProcessor(d, newProcessor);
+ }
+
+ Activity ca = new Activity();
+ support.saveWorkflowAsComponent(d, ident).installConfiguration(ca);
+ support.moveComponentActivityIntoPlace(a, p, ca);
+ } catch (Exception e) {
+ logger.error("failed to instantiate component", e);
+ showMessageDialog(null, e.getCause().getMessage(),
+ "Component creation failure", ERROR_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
new file mode 100644
index 0000000..ef55fa5
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
@@ -0,0 +1,77 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.menu.AbstractContextComponentMenuAction;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentServiceCreatorMenuAction extends
+ AbstractContextComponentMenuAction {
+ private static final URI configureSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/configure");
+
+ private ComponentCreatorSupport support;
+ private SelectionManager sm;
+ private ComponentServiceIcon icon;
+
+ public ComponentServiceCreatorMenuAction() {
+ super(configureSection, 60);
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setSelectionManager(SelectionManager sm) {
+ this.sm = sm;
+ }
+
+ public void setSupport(ComponentCreatorSupport support) {
+ this.support = support;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ if (!super.isEnabled())
+ return false;
+ Activity a = findActivity();
+ if (a == null)
+ return false;
+ return !isComponentActivity(a);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentServiceCreatorAction(
+ (Processor) getContextualSelection().getSelection(), sm,
+ support, icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorAction.java
new file mode 100644
index 0000000..c21de5b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorAction.java
@@ -0,0 +1,84 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class ComponentWorkflowCreatorAction extends ComponentAction implements
+ Observer<FileManagerEvent> {
+ private static final long serialVersionUID = -299685223430721587L;
+ private static Logger logger = getLogger(ComponentWorkflowCreatorAction.class);
+ private static final String CREATE_COMPONENT = "Create component from current workflow...";
+
+ private ComponentCreatorSupport support;
+ private FileManager fileManager;
+ private Utils utils;
+
+ public ComponentWorkflowCreatorAction(ComponentCreatorSupport support,
+ FileManager fm, GraphViewComponent graphView,
+ ComponentServiceIcon icon, Utils utils) {
+ super(CREATE_COMPONENT, graphView);
+ this.support = support;
+ this.utils = utils;
+ fm.addObserver(this);
+ this.setIcon(icon);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ WorkflowBundle bundle = fileManager.getCurrentDataflow();
+ try {
+ Version.ID ident = support.getNewComponentIdentification(bundle.getName());//TODO is this right
+ if (ident == null)
+ return;
+ support.saveWorkflowAsComponent(bundle, ident);
+ } catch (Exception e) {
+ showMessageDialog(graphView, e.getCause().getMessage(),
+ "Component creation failure", ERROR_MESSAGE);
+ logger.error("failed to save workflow as component", e);
+ }
+ }
+
+ @Override
+ public void notify(Observable<FileManagerEvent> sender,
+ FileManagerEvent message) throws Exception {
+ setEnabled(!utils.currentDataflowIsComponent());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
new file mode 100644
index 0000000..8ddaf5c
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
@@ -0,0 +1,72 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class ComponentWorkflowCreatorMenuAction extends AbstractComponentMenuAction {
+ private static final URI COMPONENT_WORKFLOW_CREATE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentCreate");
+
+ private ComponentCreatorSupport support;
+ private FileManager fm;
+ private GraphViewComponent graphView;
+ private ComponentServiceIcon icon;
+ private Utils utils;
+
+ public ComponentWorkflowCreatorMenuAction() {
+ super(600, COMPONENT_WORKFLOW_CREATE_URI);
+ }
+
+ public void setSupport(ComponentCreatorSupport support) {
+ this.support = support;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setGraphView(GraphViewComponent graphView) {
+ this.graphView = graphView;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentWorkflowCreatorAction(support, fm, graphView, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/FileOpenFromComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/FileOpenFromComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/FileOpenFromComponentMenuAction.java
new file mode 100644
index 0000000..016098f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/FileOpenFromComponentMenuAction.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 io.github.taverna_extras.component.ui.menu.component;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class FileOpenFromComponentMenuAction extends
+ AbstractComponentMenuAction {
+ private static final URI FILE_OPEN_FROM_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentOpen");
+ private FileManager fm;
+ private FileType ft;
+ private ComponentPreference prefs;
+ private GraphViewComponent graphView;
+ private ComponentServiceIcon icon;
+
+ public FileOpenFromComponentMenuAction() {
+ super(700, FILE_OPEN_FROM_COMPONENT_URI);
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setFileType(FileType ft) {
+ this.ft = ft;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setGraphView(GraphViewComponent graphView) {
+ this.graphView = graphView;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new OpenWorkflowFromComponentAction(fm, ft, prefs, graphView,
+ icon);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/OpenWorkflowFromComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/OpenWorkflowFromComponentAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/OpenWorkflowFromComponentAction.java
new file mode 100644
index 0000000..373195f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/component/OpenWorkflowFromComponentAction.java
@@ -0,0 +1,137 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.component;
+
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.showOptionDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentVersionChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+/**
+ * @author alanrw
+ */
+public class OpenWorkflowFromComponentAction extends ComponentAction {
+ private static final long serialVersionUID = 7382677337746318211L;
+ private static final Logger logger = getLogger(OpenWorkflowFromComponentAction.class);
+ private static final String ACTION_NAME = "Open component...";
+ private static final String ACTION_DESCRIPTION = "Open the workflow that implements a component";
+
+ private final FileManager fm;
+ private final FileType ft;
+ private final ComponentPreference prefs;
+
+ public OpenWorkflowFromComponentAction(FileManager fm, FileType ft,
+ ComponentPreference prefs, GraphViewComponent graphView,
+ ComponentServiceIcon icon) {
+ super(ACTION_NAME, graphView);
+ this.fm = fm;
+ this.ft = ft;
+ this.prefs = prefs;
+ setIcon(icon);
+ putValue(SHORT_DESCRIPTION, ACTION_DESCRIPTION);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg) {
+ final ComponentVersionChooserPanel panel = new ComponentVersionChooserPanel(prefs);
+
+ final JButton okay = new JButton("OK");
+ okay.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ getOptionPane((JComponent) e.getSource()).setValue(OK_OPTION);
+ doOpen(panel.getChosenRegistry(), panel.getChosenFamily(),
+ panel.getChosenComponent(),
+ panel.getChosenComponentVersion());
+ }
+ });
+ okay.setEnabled(false);
+ // Only enable the OK button of a component is not null
+ panel.getComponentChooserPanel().addObserver(
+ new Observer<ComponentChoiceMessage>() {
+ @Override
+ public void notify(
+ Observable<ComponentChoiceMessage> sender,
+ ComponentChoiceMessage message) throws Exception {
+ okay.setEnabled(message.getChosenComponent() != null);
+ }
+ });
+
+ final JButton cancel = new JButton("Cancel");
+ cancel.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ getOptionPane((JComponent)e.getSource()).setValue(CANCEL_OPTION);
+ }
+ });
+
+ showOptionDialog(graphView, panel, "Component version choice",
+ YES_NO_OPTION, QUESTION_MESSAGE, null, new Object[] { okay,
+ cancel }, okay);
+ }
+
+ protected JOptionPane getOptionPane(JComponent parent) {
+ if (parent instanceof JOptionPane)
+ return (JOptionPane) parent;
+ return getOptionPane((JComponent) parent.getParent());
+ }
+
+ private void doOpen(Registry registry, Family family, Component component,
+ Version version) {
+ Version.ID ident = new Version.Identifier(
+ registry.getRegistryBase(), family.getName(),
+ component.getName(), version.getVersionNumber());
+
+ try {
+ WorkflowBundle d = fm.openDataflow(ft, ident);
+ markGraphAsBelongingToComponent(d);
+ } catch (OpenException e) {
+ logger.error("Failed to open component definition", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateAction.java
new file mode 100644
index 0000000..0fe2ee4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateAction.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 io.github.taverna_extras.component.ui.menu.family;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.TitledBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+/**
+ * @author alanrw
+ */
+public class ComponentFamilyCreateAction extends AbstractAction {
+ private static final long serialVersionUID = -7780471499146286881L;
+ private static final Logger logger = getLogger(ComponentFamilyCreateAction.class);
+ private static final String CREATE_FAMILY = "Create family...";
+
+ private ComponentPreference prefs;
+ private JPanel overallPanel;
+ private GridBagConstraints gbc;
+
+ public ComponentFamilyCreateAction(ComponentPreference prefs,
+ ComponentServiceIcon iconProvider) {
+ super(CREATE_FAMILY, iconProvider.getIcon());
+ this.prefs = prefs;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ overallPanel = new JPanel(new GridBagLayout());
+ gbc = new GridBagConstraints();
+
+ RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
+
+ gbc.insets.left = 5;
+ gbc.insets.right = 5;
+ gbc.gridx = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ gbc.gridy++;
+ overallPanel.add(registryPanel, gbc);
+
+ ProfileChooserPanel profilePanel = new ProfileChooserPanel(
+ registryPanel);
+ gbc.gridx = 0;
+ gbc.weighty = 1;
+ gbc.gridy++;
+ overallPanel.add(profilePanel, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridwidth = 1;
+ gbc.weightx = 0;
+ gbc.weighty = 0;
+ gbc.gridy++;
+ overallPanel.add(new JLabel("Component family name:"), gbc);
+
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ JTextField familyNameField = new JTextField(60);
+ overallPanel.add(familyNameField, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridwidth = 2;
+ gbc.weightx = 0;
+ gbc.weighty = 0;
+ gbc.gridy++;
+ JTextArea familyDescription = new JTextArea(10, 60);
+ JScrollPane familyDescriptionPane = new JScrollPane(familyDescription);
+ familyDescriptionPane.setBorder(new TitledBorder("Family description"));
+ overallPanel.add(familyDescriptionPane, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ gbc.weighty = 1;
+ gbc.gridy++;
+ SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(
+ registryPanel);
+ overallPanel.add(permissionPanel, gbc);
+
+ gbc.gridy++;
+ LicenseChooserPanel licensePanel = new LicenseChooserPanel();
+ registryPanel.addObserver(licensePanel);
+ overallPanel.add(licensePanel, gbc);
+
+ int answer = showConfirmDialog(null, overallPanel,
+ "Create Component Family", OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ doCreate(registryPanel.getChosenRegistry(),
+ profilePanel.getChosenProfile(), familyNameField.getText(),
+ familyDescription.getText(),
+ permissionPanel.getChosenPermission(),
+ licensePanel.getChosenLicense());
+ }
+
+ private void doCreate(Registry chosenRegistry, Profile chosenProfile,
+ String newName, String familyDescription, SharingPolicy permission,
+ License license) {
+ if (chosenRegistry == null) {
+ showMessageDialog(null, "Unable to determine registry",
+ "Component Registry Problem", ERROR_MESSAGE);
+ return;
+ } else if (chosenProfile == null) {
+ showMessageDialog(null, "Unable to determine profile",
+ "Component Profile Problem", ERROR_MESSAGE);
+ return;
+ } else if ((newName == null) || newName.isEmpty()) {
+ showMessageDialog(null, "Name must be specified",
+ "Missing component family name", ERROR_MESSAGE);
+ return;
+ }
+
+ try {
+ if (chosenRegistry.getComponentFamily(newName) != null) {
+ showMessageDialog(null, newName + " is already used",
+ "Duplicate component family name", ERROR_MESSAGE);
+ return;
+ }
+ chosenRegistry.createComponentFamily(newName, chosenProfile,
+ familyDescription, license, permission);
+ } catch (ComponentException e) {
+ logger.error("failed to create family", e);
+ showMessageDialog(null,
+ "Unable to create family: " + e.getMessage(),
+ "Family creation problem", ERROR_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
new file mode 100644
index 0000000..94c0080
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
@@ -0,0 +1,58 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.family;
+
+import static io.github.taverna_extras.component.ui.menu.family.ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * @author alanrw
+ */
+public class ComponentFamilyCreateMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_FAMILY_CREATE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilyCreate");
+
+ private ComponentPreference prefs;
+ private ComponentServiceIcon iconProvider;
+
+ public ComponentFamilyCreateMenuAction() {
+ super(COMPONENT_FAMILY_SECTION, 400, COMPONENT_FAMILY_CREATE_URI);
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setIcon(ComponentServiceIcon iconProvider) {
+ this.iconProvider = iconProvider;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentFamilyCreateAction(prefs, iconProvider);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteAction.java
new file mode 100644
index 0000000..4ac20e4
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteAction.java
@@ -0,0 +1,201 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.family;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.WEST;
+import static java.lang.String.format;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.FamilyChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentFamilyDeleteAction extends AbstractAction {
+ private static final String CONFIRM_MSG = "Are you sure you want to delete %s";
+ private static final String CONFIRM_TITLE = "Delete Component Family Confirmation";
+ private static final String DELETE_FAMILY_LABEL = "Delete family...";
+ private static final String ERROR_TITLE = "Component Family Deletion Error";
+ private static final String FAILED_MSG = "Unable to delete %s: %s";
+ private static final String FAMILY_FAIL_TITLE = "Component Family Problem";
+ private static final String OPEN_MSG = "Components in the family are open";
+ private static final String PICK_FAMILY_TITLE = "Delete Component Family";
+ private static final String REGISTRY_FAIL_TITLE = "Component Registry Problem";
+ private static final String WHAT_FAMILY_MSG = "Unable to determine family";
+ private static final String WHAT_REGISTRY_MSG = "Unable to determine registry";
+ private static final Logger logger = getLogger(ComponentFamilyDeleteAction.class);
+ private static final long serialVersionUID = -4976161883778371344L;
+
+ private final FileManager fm;
+ private final ComponentPreference prefs;
+ private final Utils utils;
+
+ public ComponentFamilyDeleteAction(FileManager fm,
+ ComponentPreference prefs, ComponentServiceIcon icon, Utils utils) {
+ super(DELETE_FAMILY_LABEL, icon.getIcon());
+ this.fm = fm;
+ this.prefs = prefs;
+ this.utils = utils;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ JPanel overallPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = WEST;
+ gbc.fill = BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(registryPanel, gbc);
+
+ FamilyChooserPanel familyPanel = new FamilyChooserPanel(registryPanel);
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.weighty = 1;
+ overallPanel.add(familyPanel, gbc);
+
+ int answer = showConfirmDialog(null, overallPanel, PICK_FAMILY_TITLE,
+ OK_CANCEL_OPTION);
+ if (answer == OK_OPTION)
+ deletionActionFlow(registryPanel.getChosenRegistry(),
+ familyPanel.getChosenFamily());
+ }
+
+ /**
+ * Check if the preconditions for the deletion action are satisfied.
+ *
+ * @param chosenRegistry
+ * What registry contains the family.
+ * @param chosenFamily
+ */
+ private void deletionActionFlow(Registry chosenRegistry,
+ final Family chosenFamily) {
+ if (chosenRegistry == null) {
+ showMessageDialog(null, WHAT_REGISTRY_MSG, REGISTRY_FAIL_TITLE,
+ ERROR_MESSAGE);
+ return;
+ } else if (chosenFamily == null) {
+ showMessageDialog(null, WHAT_FAMILY_MSG, FAMILY_FAIL_TITLE,
+ ERROR_MESSAGE);
+ return;
+ } else if (familyIsInUse(chosenRegistry, chosenFamily)) {
+ showMessageDialog(null, OPEN_MSG, FAMILY_FAIL_TITLE, ERROR_MESSAGE);
+ return;
+ } else if (showConfirmDialog(null,
+ format(CONFIRM_MSG, chosenFamily.getName()), CONFIRM_TITLE,
+ YES_NO_OPTION) == YES_OPTION)
+ new SwingWorker<ComponentServiceProviderConfig, Object>() {
+ @Override
+ protected ComponentServiceProviderConfig doInBackground()
+ throws Exception {
+ return deleteFamily(chosenFamily);
+ }
+
+ @Override
+ protected void done() {
+ deletionDone(chosenFamily, this);
+ }
+ }.execute();
+ }
+
+ private ComponentServiceProviderConfig deleteFamily(Family family)
+ throws ComponentException {
+ ComponentServiceProviderConfig config = new ComponentServiceProviderConfig(
+ family);
+ family.delete();
+ return config;
+ }
+
+ private void deletionDone(Family family,
+ SwingWorker<ComponentServiceProviderConfig, Object> worker) {
+ Configuration config;
+ try {
+ config = worker.get().getConfiguration();
+ } catch (InterruptedException e) {
+ logger.warn("interrupted during removal of component family", e);
+ return;
+ } catch (ExecutionException e) {
+ logger.error("failed to delete family", e.getCause());
+ showMessageDialog(
+ null,
+ format(FAILED_MSG, family.getName(), e.getCause()
+ .getMessage()), ERROR_TITLE, ERROR_MESSAGE);
+ return;
+ }
+ try {
+ utils.removeComponentServiceProvider(config);
+ } catch (Exception e) {
+ logger.error("failed to update service provider panel "
+ + "after deleting family", e);
+ }
+ }
+
+ private boolean familyIsInUse(Registry chosenRegistry, Family chosenFamily) {
+ for (WorkflowBundle d : fm.getOpenDataflows()) {
+ Object dataflowSource = fm.getDataflowSource(d);
+ if (dataflowSource instanceof Version.ID) {
+ Version.ID ident = (Version.ID) dataflowSource;
+ if (ident.getRegistryBase().toString()
+ .equals(chosenRegistry.getRegistryBase().toString())
+ && ident.getFamilyName().equals(chosenFamily.getName()))
+ return true;
+ }
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
new file mode 100644
index 0000000..ffb3cbf
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
@@ -0,0 +1,69 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.family;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class ComponentFamilyDeleteMenuAction extends AbstractMenuAction {
+ private static final URI COMPONENT_FAMILY_DELETE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilyDelete");
+
+ private FileManager fm;
+ private ComponentPreference prefs;
+ private ComponentServiceIcon icon;
+ private Utils utils;
+
+ public ComponentFamilyDeleteMenuAction() {
+ super(ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION, 500,
+ COMPONENT_FAMILY_DELETE_URI);
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ this.icon = icon;
+ }
+
+ public void setPreferences(ComponentPreference prefs) {
+ this.prefs = prefs;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ComponentFamilyDeleteAction(fm, prefs, icon, utils);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyMenuSection.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyMenuSection.java
new file mode 100644
index 0000000..dbc331e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/family/ComponentFamilyMenuSection.java
@@ -0,0 +1,37 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.family;
+
+import java.net.URI;
+
+import io.github.taverna_extras.component.ui.menu.ComponentMenu;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author alanrw
+ */
+public class ComponentFamilyMenuSection extends AbstractMenuSection {
+ public static final URI COMPONENT_FAMILY_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilySection");
+
+ public ComponentFamilyMenuSection() {
+ super(ComponentMenu.COMPONENT, 300, COMPONENT_FAMILY_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyAction.java
new file mode 100644
index 0000000..2d8295a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/profile/ComponentProfileCopyAction.java
@@ -0,0 +1,177 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu.profile;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JPanel;
+import javax.swing.border.TitledBorder;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+/**
+ * @author alanrw
+ */
+public class ComponentProfileCopyAction extends AbstractAction {
+ private static final long serialVersionUID = 6332253931049645259L;
+ private static final Logger log = getLogger(ComponentProfileCopyAction.class);
+ private static final String COPY_PROFILE = "Copy profile...";
+
+ private final ComponentPreference prefs;
+
+ public ComponentProfileCopyAction(ComponentPreference prefs,
+ ComponentServiceIcon iconProvider) {
+ super(COPY_PROFILE, iconProvider.getIcon());
+ this.prefs = prefs;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ JPanel overallPanel = new JPanel();
+ overallPanel.setLayout(new GridBagLayout());
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ RegistryChooserPanel sourceRegistryPanel = new RegistryChooserPanel(prefs);
+ sourceRegistryPanel.setBorder(new TitledBorder("Source registry"));
+
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ overallPanel.add(sourceRegistryPanel, gbc);
+
+ ProfileChooserPanel profilePanel = new ProfileChooserPanel(sourceRegistryPanel);
+ profilePanel.setBorder(new TitledBorder("Source profile"));
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.weighty = 1;
+ overallPanel.add(profilePanel, gbc);
+
+ RegistryChooserPanel targetRegistryPanel = new RegistryChooserPanel(prefs);
+ targetRegistryPanel.setBorder(new TitledBorder("Target registry"));
+ gbc.gridy = 2;
+ overallPanel.add(targetRegistryPanel, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridwidth = 2;
+ gbc.weightx = 1;
+ gbc.weighty = 1;
+ gbc.gridy++;
+ SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(targetRegistryPanel);
+ overallPanel.add(permissionPanel, gbc);
+
+ gbc.gridy++;
+ LicenseChooserPanel licensePanel = new LicenseChooserPanel();
+ targetRegistryPanel.addObserver(licensePanel);
+ overallPanel.add(licensePanel, gbc);
+
+ int answer = showConfirmDialog(null, overallPanel,
+ "Copy Component Profile", OK_CANCEL_OPTION);
+ try {
+ if (answer == OK_OPTION)
+ doCopy(sourceRegistryPanel.getChosenRegistry(),
+ profilePanel.getChosenProfile(),
+ targetRegistryPanel.getChosenRegistry(),
+ permissionPanel.getChosenPermission(),
+ licensePanel.getChosenLicense());
+ } catch (ComponentException e) {
+ log.error("failed to copy profile", e);
+ showMessageDialog(null, "Unable to save profile: " + e.getMessage(),
+ "Registry Exception", ERROR_MESSAGE);
+ }
+ }
+
+ private void doCopy(Registry sourceRegistry, Profile sourceProfile,
+ Registry targetRegistry, SharingPolicy permission, License license)
+ throws ComponentException {
+ if (sourceRegistry == null) {
+ showMessageDialog(null, "Unable to determine source registry",
+ "Component Registry Problem", ERROR_MESSAGE);
+ return;
+ }
+ if (targetRegistry == null) {
+ showMessageDialog(null, "Unable to determine target registry",
+ "Component Registry Problem", ERROR_MESSAGE);
+ return;
+ }
+ if (sourceRegistry.equals(targetRegistry)) {
+ showMessageDialog(null, "Cannot copy to the same registry",
+ "Copy Problem", ERROR_MESSAGE);
+ return;
+ }
+ if (sourceProfile == null) {
+ showMessageDialog(null, "Unable to determine source profile",
+ "Component Profile Problem", ERROR_MESSAGE);
+ return;
+ }
+ for (Profile p : targetRegistry.getComponentProfiles()) {
+ if (p.getName().equals(sourceProfile.getName())) {
+ showMessageDialog(null,
+ "Target registry already contains a profile named "
+ + sourceProfile.getName(), "Copy Problem",
+ ERROR_MESSAGE);
+ return;
+ }
+ String sourceId = sourceProfile.getId();
+ if (sourceId == null) {
+ showMessageDialog(null,
+ "Source profile \"" + sourceProfile.getName()
+ + "\" has no id ", "Copy Problem",
+ ERROR_MESSAGE);
+ return;
+ }
+ String id = p.getId();
+ if (sourceId.equals(id)) {
+ showMessageDialog(null,
+ "Target registry already contains a profile with id "
+ + sourceId, "Copy Problem", ERROR_MESSAGE);
+ return;
+ }
+ }
+ targetRegistry.addComponentProfile(sourceProfile, license, permission);
+ }
+}
[05/27] incubator-taverna-plugin-component git commit: package name
-> io.github.taverna_extras.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
index 7c810b4..72141c9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static java.lang.String.format;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
@@ -36,14 +36,14 @@ import javax.swing.AbstractAction;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.panel.ComponentChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.scufl2.api.configurations.Configuration;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
index db9b4b2..99c75f9 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.workbench.file.FileManager;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
index 8c5b489..1176e6d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
-import static org.apache.taverna.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
+import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
import java.net.URI;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
index 784513e..07e037d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
-import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenuSection;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
index 1819b05..a350b16 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -38,14 +38,14 @@ import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.panel.ComponentChoiceMessage;
-import org.apache.taverna.component.ui.panel.ComponentChooserPanel;
-import org.apache.taverna.component.ui.panel.ProfileChoiceMessage;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
index 45419e7..1bcac6a 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
index 29eae9d..0226432 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static org.apache.log4j.Logger.getLogger;
@@ -27,8 +27,8 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
import org.apache.taverna.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
index 01a344b..cd0418d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.workbench.file.FileManager;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
index 83cd128..56e7395 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -42,17 +42,17 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.PrefixPanel;
-import org.apache.taverna.component.ui.panel.ProfileChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.panel.SearchChoicePanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceDesc;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.PrefixPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SearchChoicePanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceDesc;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.services.ServiceRegistry;
import org.apache.taverna.ui.menu.MenuManager;
import org.apache.taverna.workbench.edits.EditManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
index c7f7848..c621651 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.services.ServiceRegistry;
import org.apache.taverna.ui.menu.MenuManager;
import org.apache.taverna.workbench.edits.EditManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
index 8e8eb94..0c7a668 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
@@ -29,9 +29,9 @@ import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
index 12dac6e..ef55fa5 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.menu.AbstractContextComponentMenuAction;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.menu.AbstractContextComponentMenuAction;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.core.Processor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
index 4863513..c21de5b 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.showMessageDialog;
@@ -26,10 +26,10 @@ import static org.apache.log4j.Logger.getLogger;
import java.awt.event.ActionEvent;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentAction;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
index 2b64f87..8ddaf5c 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.views.graph.GraphViewComponent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
index efa1356..016098f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.workbench.file.FileManager;
import org.apache.taverna.workbench.file.FileType;
import org.apache.taverna.workbench.views.graph.GraphViewComponent;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
index 4d0d761..373195f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.component;
+package io.github.taverna_extras.component.ui.menu.component;
import static javax.swing.JOptionPane.CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
@@ -34,15 +34,15 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentAction;
-import org.apache.taverna.component.ui.panel.ComponentChoiceMessage;
-import org.apache.taverna.component.ui.panel.ComponentVersionChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentAction;
+import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
+import io.github.taverna_extras.component.ui.panel.ComponentVersionChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
index a72d1b9..0fe2ee4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.family;
+package io.github.taverna_extras.component.ui.menu.family;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -41,17 +41,17 @@ import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.LicenseChooserPanel;
-import org.apache.taverna.component.ui.panel.ProfileChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.panel.SharingPolicyChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
index 5ca568b..94c0080 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.family;
+package io.github.taverna_extras.component.ui.menu.family;
-import static org.apache.taverna.component.ui.menu.family.ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION;
+import static io.github.taverna_extras.component.ui.menu.family.ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.ui.menu.AbstractMenuAction;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
index af40c92..4ac20e4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.family;
+package io.github.taverna_extras.component.ui.menu.family;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -42,16 +42,16 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.panel.FamilyChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.FamilyChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.scufl2.api.configurations.Configuration;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
index 9db4066..ffb3cbf 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.family;
+package io.github.taverna_extras.component.ui.menu.family;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.ui.menu.AbstractMenuAction;
import org.apache.taverna.workbench.file.FileManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
index 03dcc0a..dbc331e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
@@ -17,11 +17,11 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.family;
+package io.github.taverna_extras.component.ui.menu.family;
import java.net.URI;
-import org.apache.taverna.component.ui.menu.ComponentMenu;
+import io.github.taverna_extras.component.ui.menu.ComponentMenu;
import org.apache.taverna.ui.menu.AbstractMenuSection;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
index 3d6b9fd..2d8295a 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@@ -36,17 +36,17 @@ import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.LicenseChooserPanel;
-import org.apache.taverna.component.ui.panel.ProfileChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.panel.SharingPolicyChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
index 1175a4e..1052960 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileCopyMenuAction.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
-import static org.apache.taverna.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.ui.menu.AbstractMenuAction;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
index 4fab373..00f809d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -38,12 +38,12 @@ import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.ProfileChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
index 702ff77..be6e6d6 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileDeleteMenuAction.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
-import static org.apache.taverna.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.ui.menu.AbstractMenuAction;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
index 90e4e03..d63133d 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportAction.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -45,17 +45,17 @@ import javax.swing.JTextField;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.SharingPolicy;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.panel.LicenseChooserPanel;
-import org.apache.taverna.component.ui.panel.RegistryChooserPanel;
-import org.apache.taverna.component.ui.panel.SharingPolicyChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
+import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
+import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.lang.ui.DeselectingButton;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
index 9ecd7d5..7c060b8 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileImportMenuAction.java
@@ -17,17 +17,17 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
-import static org.apache.taverna.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
+import static io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection.COMPONENT_PROFILE_SECTION;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.ui.menu.AbstractMenuAction;
/**
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
index 08c506f..b7e9ff6 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/profile/ComponentProfileMenuSection.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.profile;
+package io.github.taverna_extras.component.ui.menu.profile;
-import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenuSection;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
index 193cb22..a0cc5ab 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.registry;
+package io.github.taverna_extras.component.ui.menu.registry;
-import static org.apache.taverna.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
+import static io.github.taverna_extras.component.ui.preference.ComponentPreferenceUIFactory.DISPLAY_NAME;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
//import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
index 481008b..28a8926 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryManageMenuAction.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.registry;
+package io.github.taverna_extras.component.ui.menu.registry;
-import static org.apache.taverna.component.ui.menu.registry.ComponentRegistryMenuSection.COMPONENT_REGISTRY_SECTION;
+import static io.github.taverna_extras.component.ui.menu.registry.ComponentRegistryMenuSection.COMPONENT_REGISTRY_SECTION;
import java.net.URI;
import javax.swing.Action;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
import org.apache.taverna.ui.menu.AbstractMenuAction;
import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
index 166da5d..c651770 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/registry/ComponentRegistryMenuSection.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.menu.registry;
+package io.github.taverna_extras.component.ui.menu.registry;
-import static org.apache.taverna.component.ui.menu.ComponentMenu.COMPONENT;
+import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
import java.net.URI;
import org.apache.taverna.ui.menu.AbstractMenuSection;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
index 7515049..50a2027 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChoiceMessage.java
@@ -17,10 +17,10 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
index 2af5a8f..a8ceaf0 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentChooserPanel.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -41,10 +41,10 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
index a8d94a8..24d15d4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentListCellRenderer.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
index f189c8a..956af9c 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ComponentVersionChooserPanel.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.SHORT_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -40,11 +40,11 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
index ed64e7a..109b125 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChoiceMessage.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
-import org.apache.taverna.component.api.Family;
+import io.github.taverna_extras.component.api.Family;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
index 6634f9b..499d1a4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/FamilyChooserPanel.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -42,10 +42,10 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
index cc7e576..faacc35 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/LicenseChooserPanel.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -41,9 +41,9 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.License;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.License;
+import io.github.taverna_extras.component.api.Registry;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
index c0029b3..53d89c4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/PrefixPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static javax.swing.BorderFactory.createEtchedBorder;
import static javax.swing.BorderFactory.createTitledBorder;
@@ -33,8 +33,8 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
index fadd750..432cf44 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChoiceMessage.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.Profile;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
index 7f1294c..f8b0148 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/ProfileChooserPanel.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -42,9 +42,9 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
index e8fd8d1..1d393c5 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserComponentEntryPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -26,10 +26,10 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
index e236488..bc24dca 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryAndFamilyChooserPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
@@ -30,9 +30,9 @@ import java.util.List;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
index 750021a..85249ca 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChoiceMessage.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
index 6ef2762..1e2bf78 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/RegistryChooserPanel.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -39,8 +39,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
index 737bb87..f26cf6b 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SearchChoicePanel.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.WEST;
import static java.awt.event.ItemEvent.SELECTED;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -41,11 +41,11 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
index f46b432..3625a84 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/panel/SharingPolicyChooserPanel.java
@@ -17,13 +17,13 @@
* under the License.
*/
-package org.apache.taverna.component.ui.panel;
+package io.github.taverna_extras.component.ui.panel;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.NONE;
import static java.awt.GridBagConstraints.WEST;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.LONG_STRING;
+import static io.github.taverna_extras.component.ui.util.Utils.LONG_STRING;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -38,9 +38,9 @@ import javax.swing.JPanel;
import javax.swing.SwingWorker;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.SharingPolicy;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.SharingPolicy;
import org.apache.taverna.lang.observer.Observable;
import org.apache.taverna.lang.observer.Observer;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
index a034ff7..faad899 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentDefaults.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import java.io.File;
import java.util.LinkedHashMap;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
index f36d958..b7ff333 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreference.java
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import static org.apache.commons.lang.StringUtils.join;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.preference.ComponentDefaults.REGISTRY_LIST;
-import static org.apache.taverna.component.ui.preference.ComponentDefaults.getDefaultProperties;
+import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.REGISTRY_LIST;
+import static io.github.taverna_extras.component.ui.preference.ComponentDefaults.getDefaultProperties;
import java.net.MalformedURLException;
import java.net.URL;
@@ -35,9 +35,9 @@ import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
import org.apache.taverna.configuration.AbstractConfigurable;
import org.apache.taverna.configuration.ConfigurationManager;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
index 8025904..4677c0c 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferencePanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import static java.awt.GridBagConstraints.BOTH;
import static java.awt.GridBagConstraints.CENTER;
@@ -28,7 +28,7 @@ import static javax.swing.JOptionPane.showMessageDialog;
import static javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN;
import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.ui.util.Utils.URL_PATTERN;
+import static io.github.taverna_extras.component.ui.util.Utils.URL_PATTERN;
import java.awt.Component;
import java.awt.Dimension;
@@ -49,9 +49,9 @@ import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Registry;
import org.apache.taverna.lang.ui.DeselectingButton;
import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
import org.apache.taverna.workbench.helper.Helper;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
index ed8dac2..03ae030 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/ComponentPreferenceUIFactory.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import javax.swing.JPanel;
import org.apache.taverna.configuration.Configurable;
[18/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
deleted file mode 100644
index 72141c9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteAction.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static java.lang.String.format;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.AbstractAction;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentDeleteAction extends AbstractAction {
- private static final String COMPONENT_PROBLEM_TITLE = "Component Problem";
- private static final String CONFIRM_MSG = "Are you sure you want to delete %s?";
- private static final String CONFIRM_TITLE = "Delete Component Confirmation";
- private static final String DELETE_COMPONENT_LABEL = "Delete component...";
- private static final String DELETE_FAILED_TITLE = "Component Deletion Error";
- private static final String FAILED_MSG = "Unable to delete %s: %s";
- private static final String OPEN_COMPONENT_MSG = "The component is open";
- private static final String TITLE = "Component choice";
- private static final String WHAT_COMPONENT_MSG = "Unable to determine component";
- private static final long serialVersionUID = -2992743162132614936L;
- private static final Logger logger = getLogger(ComponentDeleteAction.class);
-
- private final FileManager fm;
- private final ComponentPreference prefs;
- private final Utils utils;
-
- public ComponentDeleteAction(FileManager fm, ComponentPreference prefs,
- ComponentServiceIcon icon, Utils utils) {
- super(DELETE_COMPONENT_LABEL, icon.getIcon());
- this.fm = fm;
- this.prefs = prefs;
- this.utils = utils;
- }
-
- @Override
- public void actionPerformed(ActionEvent evt) {
- ComponentChooserPanel panel = new ComponentChooserPanel(prefs);
- int answer = showConfirmDialog(null, panel, TITLE, OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doDelete(panel.getChosenComponent());
- }
-
- private void doDelete(final Component chosenComponent) {
- if (chosenComponent == null) {
- showMessageDialog(null, WHAT_COMPONENT_MSG,
- COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE);
- } else if (componentIsInUse(chosenComponent)) {
- showMessageDialog(null, OPEN_COMPONENT_MSG,
- COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE);
- } else if (showConfirmDialog(null,
- format(CONFIRM_MSG, chosenComponent.getName()), CONFIRM_TITLE,
- YES_NO_OPTION) == YES_OPTION)
- new SwingWorker<Configuration, Object>() {
- @Override
- protected Configuration doInBackground() throws Exception {
- return deleteComponent(chosenComponent);
- }
-
- @Override
- protected void done() {
- refresh(chosenComponent, this);
- }
- }.execute();
- }
-
- private Configuration deleteComponent(Component component)
- throws ComponentException {
- ComponentServiceProviderConfig config = new ComponentServiceProviderConfig(
- component.getFamily());
- component.delete();
- return config.getConfiguration();
- }
-
- protected void refresh(Component component,
- SwingWorker<Configuration, Object> worker) {
- try {
- utils.refreshComponentServiceProvider(worker.get());
- } catch (ExecutionException e) {
- logger.error("failed to delete component", e.getCause());
- showMessageDialog(
- null,
- format(FAILED_MSG, component.getName(), e.getCause()
- .getMessage()), DELETE_FAILED_TITLE, ERROR_MESSAGE);
- } catch (InterruptedException e) {
- logger.warn("interrupted during component deletion", e);
- }
- }
-
- private boolean componentIsInUse(Component component) {
- for (WorkflowBundle d : fm.getOpenDataflows()) {
- Object dataflowSource = fm.getDataflowSource(d);
- if (dataflowSource instanceof Version.ID
- && ((Version.ID) dataflowSource).mostlyEqualTo(component))
- return true;
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
deleted file mode 100644
index 99c75f9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentDeleteMenuAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentDeleteMenuAction extends AbstractComponentMenuAction {
- private static final URI DELETE_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentDelete");
-
- private FileManager fm;
- private ComponentServiceIcon icon;
- private ComponentPreference prefs;
- private Utils utils;
-
- public ComponentDeleteMenuAction() {
- super(1200, DELETE_COMPONENT_URI);
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentDeleteAction(fm, prefs, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
deleted file mode 100644
index 1176e6d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection.COMPONENT_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * Basis for all menu actions. Intended to be configured by Spring.
- *
- * @author Donal Fellows
- */
-public class ComponentMenuAction extends AbstractMenuAction {
- /**
- * Construct a menu action to appear within the "Components" menu.
- * @param positionHint
- * Where on the menu this should come.
- * @param id
- * How this should be identified to Taverna.
- */
- public ComponentMenuAction(int positionHint, String id) {
- super(COMPONENT_SECTION, positionHint, URI.create(id));
- }
-
- private Action action;
-
- public void setAction(Action action) {
- this.action = action;
- }
-
- @Override
- protected Action createAction() {
- return action;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
deleted file mode 100644
index 07e037d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMenuSection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static io.github.taverna_extras.component.ui.menu.ComponentMenu.COMPONENT;
-
-import java.net.URI;
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author alanrw
- */
-public class ComponentMenuSection extends AbstractMenuSection {
- public static final URI COMPONENT_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentSection");
-
- public ComponentMenuSection() {
- super(COMPONENT, 400, COMPONENT_SECTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
deleted file mode 100644
index a350b16..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeAction.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
-import io.github.taverna_extras.component.ui.panel.ComponentChooserPanel;
-import io.github.taverna_extras.component.ui.panel.ProfileChoiceMessage;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-/**
- * @author alanrw
- */
-public class ComponentMergeAction extends AbstractAction {
- private static final long serialVersionUID = 6791184757725253807L;
- private static final Logger logger = getLogger(ComponentMergeAction.class);
- private static final String MERGE_COMPONENT = "Merge component...";
-
- private final ComponentPreference prefs;
-
- public ComponentMergeAction(ComponentPreference prefs,
- ComponentServiceIcon icon) {
- super(MERGE_COMPONENT, icon.getIcon());
- this.prefs = prefs;
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- JPanel overallPanel = new JPanel();
- overallPanel.setLayout(new GridBagLayout());
-
- GridBagConstraints gbc = new GridBagConstraints();
-
- ComponentChooserPanel source = new ComponentChooserPanel(prefs);
- source.setBorder(new TitledBorder("Source component"));
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(source, gbc);
-
- final ComponentChooserPanel target = new ComponentChooserPanel(prefs);
- target.setBorder(new TitledBorder("Target component"));
- gbc.gridy++;
- overallPanel.add(target, gbc);
-
- source.addObserver(new Observer<ComponentChoiceMessage>() {
- @Override
- public void notify(Observable<ComponentChoiceMessage> sender,
- ComponentChoiceMessage message) throws Exception {
- target.notify(null, new ProfileChoiceMessage(message
- .getComponentFamily().getComponentProfile()));
- }
- });
-
- int answer = showConfirmDialog(null, overallPanel, "Merge Component",
- OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doMerge(source.getChosenComponent(), target.getChosenComponent());
- }
-
- private void doMerge(Component sourceComponent, Component targetComponent) {
- if (sourceComponent == null) {
- showMessageDialog(null, "Unable to determine source component",
- "Component Merge Problem", ERROR_MESSAGE);
- return;
- } else if (targetComponent == null) {
- showMessageDialog(null, "Unable to determine target component",
- "Component Merge Problem", ERROR_MESSAGE);
- return;
- } else if (sourceComponent.equals(targetComponent)) {
- showMessageDialog(null, "Cannot merge a component with itself",
- "Component Merge Problem", ERROR_MESSAGE);
- return;
- }
-
- try {
- Version sourceVersion = sourceComponent.getComponentVersionMap()
- .get(sourceComponent.getComponentVersionMap().lastKey());
- targetComponent.addVersionBasedOn(
- sourceVersion.getImplementation(), "Merge from "
- + sourceComponent.getFamily().getName() + ":"
- + sourceComponent.getName());
- } catch (ComponentException e) {
- logger.error("failed to merge component", e);
- showMessageDialog(null, "Failed to merge component: " + e,
- "Component Merge Problem", ERROR_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
deleted file mode 100644
index 1bcac6a..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentMergeMenuAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-/**
- * @author alanrw
- */
-public class ComponentMergeMenuAction extends AbstractComponentMenuAction {
- private static final URI MERGE_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentMerge");
-
- private ComponentServiceIcon icon;
- private ComponentPreference prefs;
-
- public ComponentMergeMenuAction() {
- super(900, MERGE_COMPONENT_URI);
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentMergeAction(prefs, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
deleted file mode 100644
index 0226432..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-
-/**
- * @author alanrw
- */
-public class ComponentSaveAction extends AbstractAction implements
- Observer<FileManagerEvent> {
- private static final long serialVersionUID = -2391891750558659714L;
- @SuppressWarnings("unused")
- private static Logger logger = getLogger(ComponentSaveAction.class);
- private static final String SAVE_COMPONENT = "Save component";
-
- private Utils utils;
- private Action saveWorkflowAction;
-
- public ComponentSaveAction(Action saveAction, FileManager fm,
- ComponentServiceIcon icon, Utils utils) {
- super(SAVE_COMPONENT, icon.getIcon());
- saveWorkflowAction = saveAction;
- this.utils = utils;
- fm.addObserver(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- saveWorkflowAction.actionPerformed(e);
- }
-
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- setEnabled(saveWorkflowAction.isEnabled()
- && utils.currentDataflowIsComponent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
deleted file mode 100644
index cd0418d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSaveMenuAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentSaveMenuAction extends AbstractComponentMenuAction {
- private static final URI SAVE_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentSave");
-
- private Action action;
- private FileManager fm;
- private ComponentServiceIcon icon;
- private Utils utils;
-
- public ComponentSaveMenuAction() {
- super(1100, SAVE_COMPONENT_URI);
- }
-
- //FIXME beaninject net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction
- public void setSaveWorkflowAction(Action action) {
- this.action = action;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentSaveAction(action, fm, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
deleted file mode 100644
index 56e7395..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchAction.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JOptionPane.showOptionDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.PrefixPanel;
-import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.panel.SearchChoicePanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceDesc;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.ui.menu.MenuManager;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
-
-/**
- * @author alanrw
- */
-public class ComponentSearchAction extends AbstractAction {
- private static final String WFDESC_PREFIX = "wfdesc";
- private static final long serialVersionUID = -7780471499146286881L;
- @SuppressWarnings("unused")
- private static final Logger logger = getLogger(ComponentSearchAction.class);
- private static final String SEARCH_FOR_COMPONENTS = "Search for components...";
-
- private final ComponentPreference prefs;
- private final ComponentFactory factory;
- private final EditManager em;
- private final MenuManager mm;
- private final SelectionManager sm;
- private final ServiceRegistry sr;
- private final ComponentServiceIcon icon;
-
- public ComponentSearchAction(ComponentPreference prefs,
- ComponentFactory factory, EditManager em, MenuManager mm,
- SelectionManager sm, ServiceRegistry sr, ComponentServiceIcon icon) {
- super(SEARCH_FOR_COMPONENTS, icon.getIcon());
- this.prefs = prefs;
- this.factory = factory;
- this.em = em;
- this.mm = mm;
- this.sm = sm;
- this.sr = sr;
- this.icon = icon;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- JPanel overallPanel = new JPanel(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
-
- gbc.insets.left = 5;
- gbc.insets.right = 5;
- gbc.gridx = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- gbc.gridy++;
- overallPanel.add(registryPanel, gbc);
-
- ProfileChooserPanel profilePanel = new ProfileChooserPanel(registryPanel);
- gbc.gridx = 0;
- gbc.gridy++;
- overallPanel.add(profilePanel, gbc);
-
- PrefixPanel prefixPanel = new PrefixPanel(profilePanel);
- gbc.gridx = 0;
- gbc.gridy++;
- overallPanel.add(prefixPanel, gbc);
-
- JTextArea queryPane = new JTextArea(20, 80);
- gbc.gridx = 0;
- gbc.weighty = 1;
- gbc.gridy++;
- overallPanel.add(new JScrollPane(queryPane), gbc);
-
- int answer = showConfirmDialog(null, overallPanel,
- "Search for components", OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doSearch(registryPanel.getChosenRegistry(),
- profilePanel.getChosenProfile(),
- prefixPanel.getPrefixMap(), queryPane.getText());
- }
-
- private void doSearch(Registry chosenRegistry, Profile chosenProfile,
- SortedMap<String, String> prefixMap, String queryString) {
- if (chosenRegistry == null) {
- showMessageDialog(null, "Unable to determine registry",
- "Component Registry Problem", ERROR_MESSAGE);
- return;
- }
- if (chosenProfile == null) {
- showMessageDialog(null, "Unable to determine profile",
- "Component Profile Problem", ERROR_MESSAGE);
- return;
- }
- StringBuilder prefixString = new StringBuilder();
- for (Entry<String, String> entry : prefixMap.entrySet())
- if (!entry.getKey().equals(WFDESC_PREFIX))
- prefixString.append(constructPrefixString(entry));
-
- SearchChoicePanel searchChoicePanel = new SearchChoicePanel(
- chosenRegistry, prefixString.toString(), queryString);
- int answer = showOptionDialog(null, searchChoicePanel,
- "Matching components", OK_CANCEL_OPTION, QUESTION_MESSAGE,
- null, new String[] { "Add to workflow", "Cancel" }, "Cancel");
- if (answer == OK_OPTION) {
- Version.ID ident = searchChoicePanel.getVersionIdentification();
- if (ident != null)
- WorkflowView.importServiceDescription(new ComponentServiceDesc(prefs,
- factory, icon, ident), false, em, mm, sm, sr);
- }
- }
-
- private static String constructPrefixString(Entry<String, String> entry) {
- String key = entry.getKey();
- String value = entry.getValue();
- return String.format("PREFIX %s:<%s>\n", key, value);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
deleted file mode 100644
index c621651..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentSearchMenuAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.ui.menu.MenuManager;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.selection.SelectionManager;
-
-/**
- * @author alanrw
- */
-public class ComponentSearchMenuAction extends AbstractComponentMenuAction {
- private static final URI SEARCH_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentSearch");
- private ComponentPreference prefs;
- private ComponentFactory factory;
- private EditManager em;
- private MenuManager mm;
- private SelectionManager sm;
- private ServiceRegistry serviceRegistry;
- private ComponentServiceIcon icon;
-
- public ComponentSearchMenuAction() {
- super(1500, SEARCH_COMPONENT_URI);
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setEditManager(EditManager em) {
- this.em = em;
- }
-
- public void setMenuManager(MenuManager mm) {
- this.mm = mm;
- }
-
- public void setSelectionManager(SelectionManager sm) {
- this.sm = sm;
- }
-
- public void setServiceRegistry(ServiceRegistry serviceRegistry) {
- this.serviceRegistry = serviceRegistry;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentSearchAction(prefs, factory, em, mm, sm,
- serviceRegistry, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
deleted file mode 100644
index 0c7a668..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.menu.component.ComponentCreatorSupport.CopiedProcessor;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-import org.apache.taverna.workbench.selection.SelectionManager;
-
-/**
- * @author alanrw
- */
-public class ComponentServiceCreatorAction extends AbstractAction {
- private static final long serialVersionUID = -2611514696254112190L;
- private static Logger logger = getLogger(ComponentServiceCreatorAction.class);
-
- private final Processor p;
- private final Profile profile;
- private final ComponentCreatorSupport support;
-
- public ComponentServiceCreatorAction(Processor processor, SelectionManager sm,
- ComponentCreatorSupport support, ComponentServiceIcon icon) {
- super("Create component...", icon.getIcon());
- this.support = support;
- p = processor;
- profile = sm.getSelectedProfile();
- }
-
- private Workflow getNestedWorkflow(Activity a) {
- JsonNode nw = a.getConfiguration().getJson().get("nestedWorkflow");
- return a.getParent().getParent().getWorkflows().getByName(nw.asText());
- }
-
- @Override
- public void actionPerformed(ActionEvent event) {
- Version.ID ident = support.getNewComponentIdentification(p.getName());
- if (ident == null)
- return;
-
- Activity a = p.getActivity(profile);
-
- try {
- Workflow d;
- if (NESTED_WORKFLOW.equals(a.getType()))
- d = getNestedWorkflow(a);
- else {
- d = new Workflow();
-
- /* TODO: Keep the description */
- // fm.setCurrentDataflow(current);
-
- CopiedProcessor processorElement = support.copyProcessor(p);
-
- Processor newProcessor;
- try {
- newProcessor = support.pasteProcessor(processorElement, d);
- } catch (IllegalArgumentException e) {
- logger.error(
- "failed to paste processor representing component",
- e);
- showMessageDialog(null, e.getMessage(),
- "Component creation failure", ERROR_MESSAGE);
- return;
- }
-
- support.connectNewProcessor(d, newProcessor);
- }
-
- Activity ca = new Activity();
- support.saveWorkflowAsComponent(d, ident).installConfiguration(ca);
- support.moveComponentActivityIntoPlace(a, p, ca);
- } catch (Exception e) {
- logger.error("failed to instantiate component", e);
- showMessageDialog(null, e.getCause().getMessage(),
- "Component creation failure", ERROR_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
deleted file mode 100644
index ef55fa5..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentServiceCreatorMenuAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.menu.AbstractContextComponentMenuAction;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.workbench.selection.SelectionManager;
-
-/**
- * @author alanrw
- */
-public class ComponentServiceCreatorMenuAction extends
- AbstractContextComponentMenuAction {
- private static final URI configureSection = URI
- .create("http://taverna.sf.net/2009/contextMenu/configure");
-
- private ComponentCreatorSupport support;
- private SelectionManager sm;
- private ComponentServiceIcon icon;
-
- public ComponentServiceCreatorMenuAction() {
- super(configureSection, 60);
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setSelectionManager(SelectionManager sm) {
- this.sm = sm;
- }
-
- public void setSupport(ComponentCreatorSupport support) {
- this.support = support;
- }
-
- @Override
- public boolean isEnabled() {
- if (!super.isEnabled())
- return false;
- Activity a = findActivity();
- if (a == null)
- return false;
- return !isComponentActivity(a);
- }
-
- @Override
- protected Action createAction() {
- return new ComponentServiceCreatorAction(
- (Processor) getContextualSelection().getSelection(), sm,
- support, icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
deleted file mode 100644
index c21de5b..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentAction;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class ComponentWorkflowCreatorAction extends ComponentAction implements
- Observer<FileManagerEvent> {
- private static final long serialVersionUID = -299685223430721587L;
- private static Logger logger = getLogger(ComponentWorkflowCreatorAction.class);
- private static final String CREATE_COMPONENT = "Create component from current workflow...";
-
- private ComponentCreatorSupport support;
- private FileManager fileManager;
- private Utils utils;
-
- public ComponentWorkflowCreatorAction(ComponentCreatorSupport support,
- FileManager fm, GraphViewComponent graphView,
- ComponentServiceIcon icon, Utils utils) {
- super(CREATE_COMPONENT, graphView);
- this.support = support;
- this.utils = utils;
- fm.addObserver(this);
- this.setIcon(icon);
- }
-
- @Override
- public void actionPerformed(ActionEvent event) {
- WorkflowBundle bundle = fileManager.getCurrentDataflow();
- try {
- Version.ID ident = support.getNewComponentIdentification(bundle.getName());//TODO is this right
- if (ident == null)
- return;
- support.saveWorkflowAsComponent(bundle, ident);
- } catch (Exception e) {
- showMessageDialog(graphView, e.getCause().getMessage(),
- "Component creation failure", ERROR_MESSAGE);
- logger.error("failed to save workflow as component", e);
- }
- }
-
- @Override
- public void notify(Observable<FileManagerEvent> sender,
- FileManagerEvent message) throws Exception {
- setEnabled(!utils.currentDataflowIsComponent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
deleted file mode 100644
index 8ddaf5c..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/ComponentWorkflowCreatorMenuAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class ComponentWorkflowCreatorMenuAction extends AbstractComponentMenuAction {
- private static final URI COMPONENT_WORKFLOW_CREATE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentCreate");
-
- private ComponentCreatorSupport support;
- private FileManager fm;
- private GraphViewComponent graphView;
- private ComponentServiceIcon icon;
- private Utils utils;
-
- public ComponentWorkflowCreatorMenuAction() {
- super(600, COMPONENT_WORKFLOW_CREATE_URI);
- }
-
- public void setSupport(ComponentCreatorSupport support) {
- this.support = support;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setGraphView(GraphViewComponent graphView) {
- this.graphView = graphView;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentWorkflowCreatorAction(support, fm, graphView, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
deleted file mode 100644
index 016098f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/FileOpenFromComponentMenuAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class FileOpenFromComponentMenuAction extends
- AbstractComponentMenuAction {
- private static final URI FILE_OPEN_FROM_COMPONENT_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentOpen");
- private FileManager fm;
- private FileType ft;
- private ComponentPreference prefs;
- private GraphViewComponent graphView;
- private ComponentServiceIcon icon;
-
- public FileOpenFromComponentMenuAction() {
- super(700, FILE_OPEN_FROM_COMPONENT_URI);
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setFileType(FileType ft) {
- this.ft = ft;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setGraphView(GraphViewComponent graphView) {
- this.graphView = graphView;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- @Override
- protected Action createAction() {
- return new OpenWorkflowFromComponentAction(fm, ft, prefs, graphView,
- icon);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
deleted file mode 100644
index 373195f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/component/OpenWorkflowFromComponentAction.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.component;
-
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.showOptionDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.ComponentAction;
-import io.github.taverna_extras.component.ui.panel.ComponentChoiceMessage;
-import io.github.taverna_extras.component.ui.panel.ComponentVersionChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-/**
- * @author alanrw
- */
-public class OpenWorkflowFromComponentAction extends ComponentAction {
- private static final long serialVersionUID = 7382677337746318211L;
- private static final Logger logger = getLogger(OpenWorkflowFromComponentAction.class);
- private static final String ACTION_NAME = "Open component...";
- private static final String ACTION_DESCRIPTION = "Open the workflow that implements a component";
-
- private final FileManager fm;
- private final FileType ft;
- private final ComponentPreference prefs;
-
- public OpenWorkflowFromComponentAction(FileManager fm, FileType ft,
- ComponentPreference prefs, GraphViewComponent graphView,
- ComponentServiceIcon icon) {
- super(ACTION_NAME, graphView);
- this.fm = fm;
- this.ft = ft;
- this.prefs = prefs;
- setIcon(icon);
- putValue(SHORT_DESCRIPTION, ACTION_DESCRIPTION);
- }
-
- @Override
- public void actionPerformed(ActionEvent arg) {
- final ComponentVersionChooserPanel panel = new ComponentVersionChooserPanel(prefs);
-
- final JButton okay = new JButton("OK");
- okay.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- getOptionPane((JComponent) e.getSource()).setValue(OK_OPTION);
- doOpen(panel.getChosenRegistry(), panel.getChosenFamily(),
- panel.getChosenComponent(),
- panel.getChosenComponentVersion());
- }
- });
- okay.setEnabled(false);
- // Only enable the OK button of a component is not null
- panel.getComponentChooserPanel().addObserver(
- new Observer<ComponentChoiceMessage>() {
- @Override
- public void notify(
- Observable<ComponentChoiceMessage> sender,
- ComponentChoiceMessage message) throws Exception {
- okay.setEnabled(message.getChosenComponent() != null);
- }
- });
-
- final JButton cancel = new JButton("Cancel");
- cancel.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- getOptionPane((JComponent)e.getSource()).setValue(CANCEL_OPTION);
- }
- });
-
- showOptionDialog(graphView, panel, "Component version choice",
- YES_NO_OPTION, QUESTION_MESSAGE, null, new Object[] { okay,
- cancel }, okay);
- }
-
- protected JOptionPane getOptionPane(JComponent parent) {
- if (parent instanceof JOptionPane)
- return (JOptionPane) parent;
- return getOptionPane((JComponent) parent.getParent());
- }
-
- private void doOpen(Registry registry, Family family, Component component,
- Version version) {
- Version.ID ident = new Version.Identifier(
- registry.getRegistryBase(), family.getName(),
- component.getName(), version.getVersionNumber());
-
- try {
- WorkflowBundle d = fm.openDataflow(ft, ident);
- markGraphAsBelongingToComponent(d);
- } catch (OpenException e) {
- logger.error("Failed to open component definition", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
deleted file mode 100644
index 0fe2ee4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateAction.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.family;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.TitledBorder;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.License;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.SharingPolicy;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.ui.panel.LicenseChooserPanel;
-import io.github.taverna_extras.component.ui.panel.ProfileChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.panel.SharingPolicyChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-
-/**
- * @author alanrw
- */
-public class ComponentFamilyCreateAction extends AbstractAction {
- private static final long serialVersionUID = -7780471499146286881L;
- private static final Logger logger = getLogger(ComponentFamilyCreateAction.class);
- private static final String CREATE_FAMILY = "Create family...";
-
- private ComponentPreference prefs;
- private JPanel overallPanel;
- private GridBagConstraints gbc;
-
- public ComponentFamilyCreateAction(ComponentPreference prefs,
- ComponentServiceIcon iconProvider) {
- super(CREATE_FAMILY, iconProvider.getIcon());
- this.prefs = prefs;
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- overallPanel = new JPanel(new GridBagLayout());
- gbc = new GridBagConstraints();
-
- RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
-
- gbc.insets.left = 5;
- gbc.insets.right = 5;
- gbc.gridx = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- gbc.gridy++;
- overallPanel.add(registryPanel, gbc);
-
- ProfileChooserPanel profilePanel = new ProfileChooserPanel(
- registryPanel);
- gbc.gridx = 0;
- gbc.weighty = 1;
- gbc.gridy++;
- overallPanel.add(profilePanel, gbc);
-
- gbc.gridx = 0;
- gbc.gridwidth = 1;
- gbc.weightx = 0;
- gbc.weighty = 0;
- gbc.gridy++;
- overallPanel.add(new JLabel("Component family name:"), gbc);
-
- gbc.gridx = 1;
- gbc.weightx = 1;
- JTextField familyNameField = new JTextField(60);
- overallPanel.add(familyNameField, gbc);
-
- gbc.gridx = 0;
- gbc.gridwidth = 2;
- gbc.weightx = 0;
- gbc.weighty = 0;
- gbc.gridy++;
- JTextArea familyDescription = new JTextArea(10, 60);
- JScrollPane familyDescriptionPane = new JScrollPane(familyDescription);
- familyDescriptionPane.setBorder(new TitledBorder("Family description"));
- overallPanel.add(familyDescriptionPane, gbc);
-
- gbc.gridx = 0;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- gbc.weighty = 1;
- gbc.gridy++;
- SharingPolicyChooserPanel permissionPanel = new SharingPolicyChooserPanel(
- registryPanel);
- overallPanel.add(permissionPanel, gbc);
-
- gbc.gridy++;
- LicenseChooserPanel licensePanel = new LicenseChooserPanel();
- registryPanel.addObserver(licensePanel);
- overallPanel.add(licensePanel, gbc);
-
- int answer = showConfirmDialog(null, overallPanel,
- "Create Component Family", OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- doCreate(registryPanel.getChosenRegistry(),
- profilePanel.getChosenProfile(), familyNameField.getText(),
- familyDescription.getText(),
- permissionPanel.getChosenPermission(),
- licensePanel.getChosenLicense());
- }
-
- private void doCreate(Registry chosenRegistry, Profile chosenProfile,
- String newName, String familyDescription, SharingPolicy permission,
- License license) {
- if (chosenRegistry == null) {
- showMessageDialog(null, "Unable to determine registry",
- "Component Registry Problem", ERROR_MESSAGE);
- return;
- } else if (chosenProfile == null) {
- showMessageDialog(null, "Unable to determine profile",
- "Component Profile Problem", ERROR_MESSAGE);
- return;
- } else if ((newName == null) || newName.isEmpty()) {
- showMessageDialog(null, "Name must be specified",
- "Missing component family name", ERROR_MESSAGE);
- return;
- }
-
- try {
- if (chosenRegistry.getComponentFamily(newName) != null) {
- showMessageDialog(null, newName + " is already used",
- "Duplicate component family name", ERROR_MESSAGE);
- return;
- }
- chosenRegistry.createComponentFamily(newName, chosenProfile,
- familyDescription, license, permission);
- } catch (ComponentException e) {
- logger.error("failed to create family", e);
- showMessageDialog(null,
- "Unable to create family: " + e.getMessage(),
- "Family creation problem", ERROR_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
deleted file mode 100644
index 94c0080..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyCreateMenuAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.family;
-
-import static io.github.taverna_extras.component.ui.menu.family.ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-
-/**
- * @author alanrw
- */
-public class ComponentFamilyCreateMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_FAMILY_CREATE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilyCreate");
-
- private ComponentPreference prefs;
- private ComponentServiceIcon iconProvider;
-
- public ComponentFamilyCreateMenuAction() {
- super(COMPONENT_FAMILY_SECTION, 400, COMPONENT_FAMILY_CREATE_URI);
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setIcon(ComponentServiceIcon iconProvider) {
- this.iconProvider = iconProvider;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentFamilyCreateAction(prefs, iconProvider);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
deleted file mode 100644
index 4ac20e4..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteAction.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.family;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.WEST;
-import static java.lang.String.format;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.concurrent.ExecutionException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JPanel;
-import javax.swing.SwingWorker;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.panel.FamilyChooserPanel;
-import io.github.taverna_extras.component.ui.panel.RegistryChooserPanel;
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProviderConfig;
-import io.github.taverna_extras.component.ui.util.Utils;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentFamilyDeleteAction extends AbstractAction {
- private static final String CONFIRM_MSG = "Are you sure you want to delete %s";
- private static final String CONFIRM_TITLE = "Delete Component Family Confirmation";
- private static final String DELETE_FAMILY_LABEL = "Delete family...";
- private static final String ERROR_TITLE = "Component Family Deletion Error";
- private static final String FAILED_MSG = "Unable to delete %s: %s";
- private static final String FAMILY_FAIL_TITLE = "Component Family Problem";
- private static final String OPEN_MSG = "Components in the family are open";
- private static final String PICK_FAMILY_TITLE = "Delete Component Family";
- private static final String REGISTRY_FAIL_TITLE = "Component Registry Problem";
- private static final String WHAT_FAMILY_MSG = "Unable to determine family";
- private static final String WHAT_REGISTRY_MSG = "Unable to determine registry";
- private static final Logger logger = getLogger(ComponentFamilyDeleteAction.class);
- private static final long serialVersionUID = -4976161883778371344L;
-
- private final FileManager fm;
- private final ComponentPreference prefs;
- private final Utils utils;
-
- public ComponentFamilyDeleteAction(FileManager fm,
- ComponentPreference prefs, ComponentServiceIcon icon, Utils utils) {
- super(DELETE_FAMILY_LABEL, icon.getIcon());
- this.fm = fm;
- this.prefs = prefs;
- this.utils = utils;
- }
-
- @Override
- public void actionPerformed(ActionEvent ev) {
- JPanel overallPanel = new JPanel(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
-
- RegistryChooserPanel registryPanel = new RegistryChooserPanel(prefs);
-
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = WEST;
- gbc.fill = BOTH;
- gbc.gridwidth = 2;
- gbc.weightx = 1;
- overallPanel.add(registryPanel, gbc);
-
- FamilyChooserPanel familyPanel = new FamilyChooserPanel(registryPanel);
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weighty = 1;
- overallPanel.add(familyPanel, gbc);
-
- int answer = showConfirmDialog(null, overallPanel, PICK_FAMILY_TITLE,
- OK_CANCEL_OPTION);
- if (answer == OK_OPTION)
- deletionActionFlow(registryPanel.getChosenRegistry(),
- familyPanel.getChosenFamily());
- }
-
- /**
- * Check if the preconditions for the deletion action are satisfied.
- *
- * @param chosenRegistry
- * What registry contains the family.
- * @param chosenFamily
- */
- private void deletionActionFlow(Registry chosenRegistry,
- final Family chosenFamily) {
- if (chosenRegistry == null) {
- showMessageDialog(null, WHAT_REGISTRY_MSG, REGISTRY_FAIL_TITLE,
- ERROR_MESSAGE);
- return;
- } else if (chosenFamily == null) {
- showMessageDialog(null, WHAT_FAMILY_MSG, FAMILY_FAIL_TITLE,
- ERROR_MESSAGE);
- return;
- } else if (familyIsInUse(chosenRegistry, chosenFamily)) {
- showMessageDialog(null, OPEN_MSG, FAMILY_FAIL_TITLE, ERROR_MESSAGE);
- return;
- } else if (showConfirmDialog(null,
- format(CONFIRM_MSG, chosenFamily.getName()), CONFIRM_TITLE,
- YES_NO_OPTION) == YES_OPTION)
- new SwingWorker<ComponentServiceProviderConfig, Object>() {
- @Override
- protected ComponentServiceProviderConfig doInBackground()
- throws Exception {
- return deleteFamily(chosenFamily);
- }
-
- @Override
- protected void done() {
- deletionDone(chosenFamily, this);
- }
- }.execute();
- }
-
- private ComponentServiceProviderConfig deleteFamily(Family family)
- throws ComponentException {
- ComponentServiceProviderConfig config = new ComponentServiceProviderConfig(
- family);
- family.delete();
- return config;
- }
-
- private void deletionDone(Family family,
- SwingWorker<ComponentServiceProviderConfig, Object> worker) {
- Configuration config;
- try {
- config = worker.get().getConfiguration();
- } catch (InterruptedException e) {
- logger.warn("interrupted during removal of component family", e);
- return;
- } catch (ExecutionException e) {
- logger.error("failed to delete family", e.getCause());
- showMessageDialog(
- null,
- format(FAILED_MSG, family.getName(), e.getCause()
- .getMessage()), ERROR_TITLE, ERROR_MESSAGE);
- return;
- }
- try {
- utils.removeComponentServiceProvider(config);
- } catch (Exception e) {
- logger.error("failed to update service provider panel "
- + "after deleting family", e);
- }
- }
-
- private boolean familyIsInUse(Registry chosenRegistry, Family chosenFamily) {
- for (WorkflowBundle d : fm.getOpenDataflows()) {
- Object dataflowSource = fm.getDataflowSource(d);
- if (dataflowSource instanceof Version.ID) {
- Version.ID ident = (Version.ID) dataflowSource;
- if (ident.getRegistryBase().toString()
- .equals(chosenRegistry.getRegistryBase().toString())
- && ident.getFamilyName().equals(chosenFamily.getName()))
- return true;
- }
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
deleted file mode 100644
index ffb3cbf..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyDeleteMenuAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.family;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.ui.preference.ComponentPreference;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.ui.menu.AbstractMenuAction;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author alanrw
- */
-public class ComponentFamilyDeleteMenuAction extends AbstractMenuAction {
- private static final URI COMPONENT_FAMILY_DELETE_URI = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilyDelete");
-
- private FileManager fm;
- private ComponentPreference prefs;
- private ComponentServiceIcon icon;
- private Utils utils;
-
- public ComponentFamilyDeleteMenuAction() {
- super(ComponentFamilyMenuSection.COMPONENT_FAMILY_SECTION, 500,
- COMPONENT_FAMILY_DELETE_URI);
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setIcon(ComponentServiceIcon icon) {
- this.icon = icon;
- }
-
- public void setPreferences(ComponentPreference prefs) {
- this.prefs = prefs;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- protected Action createAction() {
- return new ComponentFamilyDeleteAction(fm, prefs, icon, utils);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
deleted file mode 100644
index dbc331e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/family/ComponentFamilyMenuSection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu.family;
-
-import java.net.URI;
-
-import io.github.taverna_extras.component.ui.menu.ComponentMenu;
-import org.apache.taverna.ui.menu.AbstractMenuSection;
-
-/**
- * @author alanrw
- */
-public class ComponentFamilyMenuSection extends AbstractMenuSection {
- public static final URI COMPONENT_FAMILY_SECTION = URI
- .create("http://taverna.sf.net/2008/t2workbench/menu#componentFamilySection");
-
- public ComponentFamilyMenuSection() {
- super(ComponentMenu.COMPONENT, 300, COMPONENT_FAMILY_SECTION);
- }
-}
[20/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
deleted file mode 100644
index 2b8dd7d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/PropertyPanelFactorySPI.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.Color.WHITE;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- * @author David Withers
- */
-public abstract class PropertyPanelFactorySPI {
- public abstract JComponent getInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement);
-
- /**
- * Returns null if the target node is the same as the original statement
- *
- * @param origStatement
- * @param inputComponent
- * @return
- */
- public abstract RDFNode getNewTargetNode(Statement origStatement,
- JComponent inputComponent);
-
- public abstract int getRatingForSemanticAnnotation(
- SemanticAnnotationProfile semanticAnnotationProfile);
-
- public abstract JComponent getDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement);
-
- public static JComponent getDefaultInputComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- JTextArea inputText = new JTextArea(20, 80);
- if (statement != null)
- inputText.setText(getObjectName(statement));
- inputText.setLineWrap(true);
- inputText.setWrapStyleWord(true);
- return inputText;
- }
-
- public static JComponent getDefaultDisplayComponent(
- SemanticAnnotationProfile semanticAnnotationProfile,
- Statement statement) {
- JTextArea value = new JTextArea(getObjectName(statement));
- value.setLineWrap(true);
- value.setWrapStyleWord(true);
- value.setEditable(false);
- value.setBackground(WHITE);
- value.setOpaque(true);
- value.setBorder(new EmptyBorder(2, 4, 2, 4));
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
deleted file mode 100644
index 4aa2b4e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualView.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.lang.String.format;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.workbench.file.FileManager;
-
-/**
- * @author David Withers
- */
-public class SemanticAnnotationContextualView extends
- AbstractSemanticAnnotationContextualView {
- private static final long serialVersionUID = -322165507536778154L;
- public static final String VIEW_TITLE = "Semantic Annotations";
- private static Logger logger = getLogger(SemanticAnnotationContextualView.class);
-
- private final FileManager fileManager;
- private final ComponentFactory factory;
-
- public SemanticAnnotationContextualView(FileManager fileManager,
- ComponentFactory factory, AbstractNamed selection) {
- super(fileManager, true);
- this.fileManager = fileManager;
- this.factory = factory;
- super.setAnnotated(selection);
- List<SemanticAnnotationProfile> profiles = new ArrayList<>();
- try {
- Profile componentProfile = getComponentProfile();
- if (componentProfile != null) {
- if (selection instanceof Workflow
- || selection instanceof WorkflowBundle)
- profiles = componentProfile.getSemanticAnnotations();
- else if (selection instanceof InputWorkflowPort)
- profiles = componentProfile
- .getInputSemanticAnnotationProfiles();
- else if (selection instanceof OutputWorkflowPort)
- profiles = componentProfile
- .getOutputSemanticAnnotationProfiles();
- else if (selection instanceof Processor)
- profiles = componentProfile
- .getActivitySemanticAnnotationProfiles();
- }
- } catch (ComponentException e) {
- logger.error("failed to look up semantic annotations", e);
- }
- super.setSemanticAnnotationProfiles(profiles);
- super.initialise();
- }
-
- private Profile getComponentProfile() {
- Object dataflowSource = fileManager.getDataflowSource(fileManager
- .getCurrentDataflow());
- if (dataflowSource instanceof Version.ID) {
- Version.ID identification = (Version.ID) dataflowSource;
- try {
- Registry componentRegistry = factory.getRegistry(identification
- .getRegistryBase());
- Family componentFamily = componentRegistry
- .getComponentFamily(identification.getFamilyName());
- return componentFamily.getComponentProfile();
- } catch (ComponentException e) {
- logger.warn(
- format("No component profile found for component family %s at component registry %s",
- identification.getFamilyName(),
- identification.getRegistryBase()), e);
- }
- }
- return null;
- }
-
- @Override
- public String getViewTitle() {
- return VIEW_TITLE;
- }
-
-/*
- public static void main(String[] args) throws Exception {
- JFrame frame = new JFrame();
- frame.setSize(400, 200);
- ComponentVersionIdentification identification = new ComponentVersionIdentification(
- new URL("http://sandbox.myexperiment.org"),
- "SCAPE Migration Action Components", "Image To Tiff", 2);
- Dataflow dataflow = fileManager.openDataflow(new ComponentFileType(),
- identification);
-
- Processor processor = edits.createProcessor("processor");
- try {
- editManager.doDataflowEdit(dataflow,
- edits.getAddProcessorEdit(dataflow, processor));
- } catch (EditException e) {
- e.printStackTrace();
- }
- final SemanticAnnotationContextualView view = new SemanticAnnotationContextualView(
- processor);
- editManager.addObserver(new Observer<EditManager.EditManagerEvent>() {
- @Override
- public void notify(Observable<EditManagerEvent> arg0,
- EditManagerEvent arg1) throws Exception {
- view.refreshView();
- view.repaint();
- }
- });
- frame.add(view);
- frame.setVisible(true);
- }
-*/
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
deleted file mode 100644
index 8ec838f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import java.util.Arrays;
-import java.util.List;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-/**
- * @author David Withers
- */
-public class SemanticAnnotationContextualViewFactory implements
- ContextualViewFactory<AbstractNamed> {
- private FileManager fileManager;
- private ComponentFactory factory;
-
- private WorkflowBundle bundle;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileManager(FileManager fm) {
- this.fileManager = fm;
- }
-
- @Override
- public boolean canHandle(Object selection) {
- bundle = fileManager.getCurrentDataflow();
- return fileManager.getDataflowSource(bundle) instanceof Version.ID
- && selection instanceof AbstractNamed
- && !(selection instanceof Activity || selection instanceof ActivityPort);
- }
-
- @Override
- public List<ContextualView> getViews(AbstractNamed selection) {
- return Arrays.asList(new SemanticAnnotationContextualView(fileManager,
- factory, selection), new TurtleContextualView(selection, bundle));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
deleted file mode 100644
index 536a87d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationPanel.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.Color.WHITE;
-import static java.awt.Font.BOLD;
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.EAST;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.SOUTHEAST;
-import static java.lang.Integer.MIN_VALUE;
-import static java.lang.String.format;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Statement;
-import org.apache.taverna.lang.ui.DeselectingButton;
-
-public class SemanticAnnotationPanel extends JPanel {
- private static final long serialVersionUID = -5949183295606132775L;
-
- private List<PropertyPanelFactorySPI> propertyPanelFactories; //FIXME beaninject
- private final AbstractSemanticAnnotationContextualView semanticAnnotationContextualView;
- private final SemanticAnnotationProfile semanticAnnotationProfile;
- private final Set<Statement> statements;
- private final boolean allowChange;
- private final PropertyPanelFactorySPI bestFactory;
-
- public SemanticAnnotationPanel(
- AbstractSemanticAnnotationContextualView semanticAnnotationContextualView,
- SemanticAnnotationProfile semanticAnnotationProfile,
- Set<Statement> statements, boolean allowChange) {
- this.semanticAnnotationContextualView = semanticAnnotationContextualView;
- this.semanticAnnotationProfile = semanticAnnotationProfile;
- this.statements = statements;
- this.allowChange = allowChange;
- this.bestFactory = findBestPanelFactory();
- initialise();
- }
-
- private void initialise() {
- setLayout(new GridBagLayout());
- // setBorder(new AbstractBorder() {
- // @Override
- // public void paintBorder(Component c, Graphics g, int x, int y, int
- // width, int height) {
- // g.setColor(Color.GRAY);
- // g.drawLine(x, y+height-1, x+width-1, y+height-1);
- // }
- // });
-
- GridBagConstraints c = new GridBagConstraints();
- c.anchor = SOUTHEAST;
- c.fill = BOTH;
- c.weightx = 1;
- c.gridx = 0;
-
- OntProperty predicate = semanticAnnotationProfile.getPredicate();
- c.gridwidth = 3;
- JLabel label = new JLabel(format("Annotation type : %s",
- getDisplayName(predicate)));
- label.setBorder(new EmptyBorder(5, 5, 5, 5));
- label.setBackground(WHITE);
- label.setOpaque(true);
- add(label, c);
-
- c.insets = new Insets(7, 0, 0, 0);
- c.anchor = EAST;
- c.fill = HORIZONTAL;
- if (statements.isEmpty()) {
- c.gridwidth = 2;
- // c.weightx = 1;
- // c.gridy++;
- add(new JLabel("No semantic annotations"), c);
- } else {
- c.gridwidth = 1;
- for (Statement statement : statements) {
- c.gridx = 0;
- c.weightx = 1;
- if (bestFactory != null) {
- add(bestFactory.getDisplayComponent(
- semanticAnnotationProfile, statement), c);
- } else {
- JTextArea value = new JTextArea(getObjectName(statement));
- value.setLineWrap(true);
- value.setWrapStyleWord(true);
- value.setEditable(false);
- value.setBackground(WHITE);
- value.setOpaque(true);
- value.setBorder(new EmptyBorder(2, 4, 2, 4));
- add(value, c);
- }
- if (allowChange) {
- c.gridx = 1;
- c.weightx = 0;
- add(createChangeButton(statement), c);
-
- c.gridx = 2;
- add(createDeleteButton(statement), c);
- }
- }
- }
-
- if (allowChange
- && !enoughAlready(statements,
- semanticAnnotationProfile.getMaxOccurs())) {
- c.gridx = 0;
- c.gridwidth = 3;
- c.anchor = SOUTHEAST;
- c.fill = NONE;
- add(createAddButton(), c);
- }
- }
-
- private boolean enoughAlready(Set<Statement> statements, Integer maxOccurs) {
- return (maxOccurs != null) && (statements.size() >= maxOccurs);
- }
-
- private JButton createChangeButton(final Statement statement) {
- return new DeselectingButton("Change", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- addOrChangeAnnotation(statement);
- }
- });
- }
-
- private JButton createDeleteButton(final Statement statement) {
- return new DeselectingButton("Delete", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- semanticAnnotationContextualView.removeStatement(statement);
- }
- });
- }
-
- private JButton createAddButton() {
- return new DeselectingButton("Add Annotation", new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- addOrChangeAnnotation(null);
- }
- });
- }
-
- private void addOrChangeAnnotation(Statement statement) {
- JPanel annotationPanel = null;
- JComponent inputComponent = null;
-
- if (bestFactory != null) {
- inputComponent = bestFactory.getInputComponent(
- semanticAnnotationProfile, statement);
- annotationPanel = getPropertyPanel(
- getDisplayName(semanticAnnotationProfile.getPredicate()),
- inputComponent);
- }
-
- if (annotationPanel == null) {
- showMessageDialog(null, format("Unable to handle %s",
- semanticAnnotationProfile.getPredicateString()),
- "Annotation problem", ERROR_MESSAGE);
- return;
- }
-
- int answer = showConfirmDialog(null, annotationPanel,
- "Add/change annotation", OK_CANCEL_OPTION);
- if (answer == OK_OPTION) {
- RDFNode response = bestFactory.getNewTargetNode(statement,
- inputComponent);
- if (response == null)
- return;
- if (statement != null)
- semanticAnnotationContextualView.changeStatement(statement,
- semanticAnnotationProfile.getPredicate(), response);
- else
- semanticAnnotationContextualView.addStatement(
- semanticAnnotationProfile.getPredicate(), response);
- }
- }
-
- private PropertyPanelFactorySPI findBestPanelFactory() {
- PropertyPanelFactorySPI result = null;
- int currentRating = MIN_VALUE;
- for (PropertyPanelFactorySPI factory : propertyPanelFactories) {
- int ratingForSemanticAnnotation = factory
- .getRatingForSemanticAnnotation(semanticAnnotationProfile);
- if (ratingForSemanticAnnotation > currentRating) {
- currentRating = ratingForSemanticAnnotation;
- result = factory;
- }
- }
- return result;
- }
-
- public static JPanel getPropertyPanel(String displayName,
- Component inputComponent) {
- JPanel result = new JPanel();
- result.setLayout(new BorderLayout());
- JPanel messagePanel = new JPanel(new BorderLayout());
- messagePanel.setBorder(new EmptyBorder(5, 5, 0, 0));
- messagePanel.setBackground(WHITE);
- result.add(messagePanel, NORTH);
-
- JLabel inputLabel = new JLabel("Enter a value for the annotation");
- inputLabel.setBackground(WHITE);
- Font baseFont = inputLabel.getFont();
- inputLabel.setFont(baseFont.deriveFont(BOLD));
- messagePanel.add(inputLabel, NORTH);
-
- JTextArea messageText = new JTextArea(format(
- "Enter a value for the annotation '%s'", displayName));
- messageText.setMargin(new Insets(5, 10, 10, 10));
- messageText.setMinimumSize(new Dimension(0, 30));
- messageText.setFont(baseFont.deriveFont(11f));
- messageText.setEditable(false);
- messageText.setFocusable(false);
- messagePanel.add(messageText, CENTER);
-
- result.add(new JScrollPane(inputComponent), CENTER);
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
deleted file mode 100644
index 68050c0..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/SemanticAnnotationUtils.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.profile.Profile;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.taverna.scufl2.api.annotation.Annotation;
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-import org.apache.jena.ontology.OntProperty;
-import org.apache.jena.ontology.OntResource;
-import org.apache.jena.rdf.model.Model;
-import org.apache.jena.rdf.model.RDFNode;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.jena.rdf.model.Statement;
-
-/**
- * @author David Withers
- */
-public class SemanticAnnotationUtils {
- protected static final String ENCODING = "TURTLE";
- /* Pretend-base for making relative URIs */
- private static String BASE = "widget://4aa8c93c-3212-487c-a505-3e337adf54a3/";
- private static Logger logger = getLogger(SemanticAnnotationUtils.class);
-
- public static String getObjectName(Statement statement) {
- return getDisplayName(statement.getObject());
- }
-
- public static String getDisplayName(RDFNode node) {
- if (node == null)
- return "unknown";
- else if (node.isAnon())
- return "anon";
- else if (node.isLiteral())
- return node.asLiteral().getLexicalForm();
- else if (node.isResource()) {
- Resource resource = node.asResource();
- if (resource instanceof OntResource) {
- String label = ((OntResource) resource).getLabel(null);
- if (label != null)
- return label;
- }
- String localName = resource.getLocalName();
- if ((localName != null) && !localName.isEmpty())
- return localName;
- return resource.toString();
- } else
- return "unknown";
- }
-
- public static Annotation findSemanticAnnotation(AbstractNamed annotated) {
- for (Annotation annotation : annotated.getAnnotations())
- return annotation;
- return null;
- }
-
- public static String getStrippedAnnotationContent(Annotation annotation)
- throws IOException {
- AbstractNamed target = (AbstractNamed) annotation.getTarget();
- return annotation.getRDFContent().replace(
- target.getRelativeURI(annotation).toASCIIString(), BASE);
- }
-
- public static Annotation createSemanticAnnotation(WorkflowBundle bundle,
- AbstractNamed target, Model model) throws IOException {
- Calendar now = new GregorianCalendar();
- Annotation annotation = new Annotation();
- annotation.setParent(bundle);
- String path = annotation.getResourcePath();
- annotation.setTarget(target);
- // annotation.setAnnotatedBy(annotatedBy);
- annotation.setAnnotatedAt(now);
- // annotation.setSerializedBy(serializedBy);
- annotation.setSerializedAt(now);
- bundle.getResources().addResource(
- "@base<" + target.getRelativeURI(annotation).toASCIIString()
- + "> .\n" + createTurtle(model), path, "text/rdf+n3");
- return annotation;
- }
-
- /**
- * @param model
- * @return
- */
- public static String createTurtle(Model model) {
- StringWriter stringWriter = new StringWriter();
- model.write(stringWriter, ENCODING, BASE);
- // Workaround for https://issues.apache.org/jira/browse/JENA-132
- return stringWriter.toString().replace(BASE, "");
- }
-
- public static Model populateModel(WorkflowBundle annotated) {
- Model result = createDefaultModel();
- try {
- for (Annotation a : annotated.getAnnotations())
- populateModelFromString(result, a.getRDFContent());
- } catch (Exception e) {
- logger.error("failed to construct semantic annotation model", e);
- }
- return result;
- }
-
- public static void populateModel(Model result, Annotation annotation)
- throws IOException {
- AbstractNamed target = (AbstractNamed) annotation.getTarget();
- String content = annotation.getRDFContent().replace(
- target.getRelativeURI(annotation).toASCIIString(), BASE);
- populateModelFromString(result, content);
- }
-
- public static void populateModelFromString(Model result, String content) {
- result.read(new StringReader(content), BASE, ENCODING);
- }
-
- public static Resource createBaseResource(Model model) {
- return model.createResource(BASE);
- }
-
- /**
- * Check if a profile is satisfied by a component.
- *
- * @param bundle
- * The component definition.
- * @param componentProfile
- * The profile definition.
- * @return The set of failed constraints. If empty, the profile is satisfied
- * by the component.
- */
- public static Set<SemanticAnnotationProfile> checkComponent(
- WorkflowBundle bundle, Profile componentProfile) {
- // TODO Check port presence by name
- Set<SemanticAnnotationProfile> problemProfiles = new HashSet<>();
- Model model = populateModel(bundle);
- Set<Statement> statements = model.listStatements().toSet();
- try {
- for (SemanticAnnotationProfile saProfile : componentProfile
- .getSemanticAnnotations()) {
- OntProperty predicate = saProfile.getPredicate();
- if (predicate == null)
- continue;
- int count = 0;
- for (Statement statement : statements)
- if (statement.getPredicate().equals(predicate))
- count++;
- if (count < saProfile.getMinOccurs())
- problemProfiles.add(saProfile);
- if (saProfile.getMaxOccurs() != null
- && count > saProfile.getMaxOccurs())
- // The UI should prevent this, but check anyway
- problemProfiles.add(saProfile);
- }
- } catch (ComponentException e) {
- logger.error("failed to look up profiles for semantic annotations", e);
- }
- return problemProfiles;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
deleted file mode 100644
index 8489fe6..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleContextualView.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.awt.BorderLayout.CENTER;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.findSemanticAnnotation;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getStrippedAnnotationContent;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.awt.BorderLayout;
-import java.io.IOException;
-
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-
-import org.slf4j.Logger;
-
-import org.apache.taverna.scufl2.api.annotation.Annotation;
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * @author alanrw
- */
-public class TurtleContextualView extends ContextualView {
- private static final long serialVersionUID = -3401885589263647202L;
- private static final Logger log = getLogger(TurtleContextualView.class);
- private JPanel panel;
- private String annotationContent = "";
-
- public TurtleContextualView(AbstractNamed selection, WorkflowBundle bundle) {
- Annotation annotation = findSemanticAnnotation(selection);
- try {
- if (annotation != null)
- annotationContent = getStrippedAnnotationContent(annotation);
- } catch (IOException e) {
- log.info("failed to read semantic annotation; using empty string", e);
- }
- initialise();
- initView();
- }
-
- @Override
- public JComponent getMainFrame() {
- return panel;
- }
-
- @Override
- public int getPreferredPosition() {
- return 512;
- }
-
- @Override
- public String getViewTitle() {
- return "Turtle representation";
- }
-
- @Override
- public void refreshView() {
- initialise();
- }
-
- protected final void initialise() {
- if (panel == null)
- panel = new JPanel(new BorderLayout());
- else
- panel.removeAll();
- JTextArea textArea = new JTextArea(20, 80);
- textArea.setEditable(false);
- textArea.setText(annotationContent);
- panel.add(textArea, CENTER);
- revalidate();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
deleted file mode 100644
index 7356cc9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/TurtleInputPanel.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.EAST;
-import static java.awt.BorderLayout.SOUTH;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.apache.jena.ontology.Individual;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.taverna.lang.ui.DeselectingButton;
-import org.apache.taverna.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class TurtleInputPanel extends JPanel {
- JTextArea turtleTextArea = new JTextArea(30, 80);
- ReadOnlyTextArea errors = new ReadOnlyTextArea(1, 80);
- private OntClass clazz;
-
- public TurtleInputPanel(OntClass clazz) {
- super(new BorderLayout());
- this.clazz = clazz;
-
- add(new JScrollPane(turtleTextArea), CENTER);
-
- turtleTextArea.setText("<#changeme> a <" + clazz.getURI() + ">\n\n\n.");
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new BorderLayout());
- JButton validateButton = new DeselectingButton(new AbstractAction(
- "Validate") {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- getContentAsModel();
- }
- });
- buttonPanel.add(errors, CENTER);
- errors.setOpaque(false);
- buttonPanel.add(validateButton, EAST);
- add(buttonPanel, SOUTH);
- }
-
- public OntModel getContentAsModel() {
- OntModel result = createOntologyModel();
- try {
- populateModelFromString(result, getContentAsString());
-
- // Check it is not still called changeme
- List<Individual> individuals = result.listIndividuals(clazz)
- .toList();
- if (individuals.isEmpty()) {
- errors.setText("No valid individuals");
- return null;
- }
- for (Individual i : individuals)
- if (i.getURI().endsWith("changeme")) {
- errors.setText("Name has not been changed");
- return null;
- }
-
- errors.setText("No errors found");
- return result;
- } catch (Throwable ex) { // syntax error?
- errors.setText(ex.getMessage());
- return null;
- }
- }
-
- public String getContentAsString() {
- return turtleTextArea.getText();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
deleted file mode 100644
index 67d806d..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnrecognizedStatementPanel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.lang.String.format;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.apache.jena.rdf.model.Statement;
-
-/**
- * @author alanrw
- *
- */
-@SuppressWarnings("serial")
-public class UnrecognizedStatementPanel extends JPanel {
- public UnrecognizedStatementPanel(Statement statement) {
- setLayout(new BorderLayout());
- setBorder(new GreyBorder());
- add(new JLabel(format("Unable to find %s in the profile",
- statement.getPredicate())));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
deleted file mode 100644
index a7e2c89..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/annotation/UnresolveablePredicatePanel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.annotation;
-
-import static java.lang.String.format;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public class UnresolveablePredicatePanel extends JPanel {
- public UnresolveablePredicatePanel(
- SemanticAnnotationProfile semanticAnnotationProfile) {
- setLayout(new BorderLayout());
- setBorder(new GreyBorder());
- add(new JLabel(format("Unable to resolve %s in the ontology",
- semanticAnnotationProfile.getPredicateString())));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
deleted file mode 100644
index 712b861..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigurationPanel.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.config;
-
-import static java.awt.event.ItemEvent.SELECTED;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.util.SortedMap;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.panel.ComponentListCellRenderer;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-
-@SuppressWarnings("serial")
-public class ComponentConfigurationPanel extends ActivityConfigurationPanel {
- private static Logger logger = getLogger(ComponentConfigurationPanel.class);
-
- private ComponentFactory factory;//FIXME beaninject
- private ServiceRegistry sr;
-
- private final JComboBox<Object> componentVersionChoice = new JComboBox<>();
-
- public ComponentConfigurationPanel(Activity activity,
- ComponentFactory factory, ServiceRegistry serviceRegistry) {
- super(activity);
- sr = serviceRegistry;
- this.factory = factory;
- componentVersionChoice.setPrototypeDisplayValue(SHORT_STRING);
- initGui();
- }
-
- private Version getSelectedVersion() {
- return (Version) componentVersionChoice.getSelectedItem();
- }
- private URI getRegistryBase() {
- return URI.create(getProperty(REGISTRY_BASE));
- }
- private String getFamilyName() {
- return getProperty(FAMILY_NAME);
- }
- private String getComponentName() {
- return getProperty(COMPONENT_NAME);
- }
- private Integer getComponentVersion() {
- return Integer.parseInt(getProperty(COMPONENT_VERSION));
- }
-
- protected void initGui() {
- removeAll();
- setLayout(new GridLayout(0, 2));
-
- componentVersionChoice.setRenderer(new ComponentListCellRenderer<>());
- componentVersionChoice.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent event) {
- if (event.getStateChange() == SELECTED)
- updateToolTipText();
- }
- });
- updateComponentVersionChoice();
-
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.insets = new Insets(0, 5, 0, 5);
- gbc.gridx = 0;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.gridy = 2;
- this.add(new JLabel("Component version:"), gbc);
- gbc.gridx = 1;
- gbc.weightx = 1;
- this.add(componentVersionChoice, gbc);
-
- // Populate fields from activity configuration bean
- refreshConfiguration();
- }
-
- /**
- * Check that user values in UI are valid
- */
- @Override
- public boolean checkValues() {
- return true;
- }
-
- /**
- * Check if the user has changed the configuration from the original
- */
- @Override
- public boolean isConfigurationChanged() {
- return !getSelectedVersion().getVersionNumber().equals(
- getComponentVersion());
- }
-
- /**
- * Prepare a new configuration bean from the UI, to be returned with
- * getConfiguration()
- */
- @Override
- public void noteConfiguration() {
- setProperty(COMPONENT_VERSION, getSelectedVersion().getVersionNumber()
- .toString());
- //FIXME is this right at all???
- configureInputPorts(sr);
- configureOutputPorts(sr);
- }
-
- private void updateComponentVersionChoice() {
- Component component;
- componentVersionChoice.removeAllItems();
- componentVersionChoice.setToolTipText(null);
- try {
- component = factory.getComponent(getRegistryBase().toURL(),
- getFamilyName(), getComponentName());
- } catch (ComponentException | MalformedURLException e) {
- logger.error("failed to get component", e);
- return;
- }
- SortedMap<Integer, Version> componentVersionMap = component
- .getComponentVersionMap();
- for (Version v : componentVersionMap.values())
- componentVersionChoice.addItem(v);
- componentVersionChoice.setSelectedItem(componentVersionMap
- .get(getComponentVersion()));
- updateToolTipText();
- }
-
- private void updateToolTipText() {
- Version selectedVersion = (Version) componentVersionChoice
- .getSelectedItem();
- componentVersionChoice.setToolTipText(selectedVersion.getDescription());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
deleted file mode 100644
index 81c9d2f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/config/ComponentConfigureAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.config;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.workbench.activityicons.ActivityIconManager;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
-import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-
-@SuppressWarnings("serial")
-public class ComponentConfigureAction extends ActivityConfigurationAction {
- private EditManager editManager;
- private FileManager fileManager;
- private ServiceRegistry serviceRegistry;
- private ComponentFactory factory;
-
- public ComponentConfigureAction(Activity activity, Frame owner,
- ComponentFactory factory, ActivityIconManager activityIconManager,
- ServiceDescriptionRegistry serviceDescriptionRegistry,
- EditManager editManager, FileManager fileManager,
- ServiceRegistry serviceRegistry) {
- super(activity, activityIconManager, serviceDescriptionRegistry);
- this.editManager = editManager;
- this.fileManager = fileManager;
- this.serviceRegistry = serviceRegistry;
- this.factory = factory;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ActivityConfigurationDialog currentDialog = getDialog(getActivity());
- if (currentDialog != null) {
- currentDialog.toFront();
- return;
- }
-
- ComponentConfigurationPanel configView = new ComponentConfigurationPanel(
- activity, factory, serviceRegistry);
- ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(
- getActivity(), configView, editManager);
- setDialog(getActivity(), dialog, fileManager);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
deleted file mode 100644
index 7a2442f..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthCheckExplainer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.file;
-
-import static java.util.Collections.sort;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.JComponent;
-import javax.swing.JTextArea;
-
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
-import org.apache.taverna.visit.VisitKind;
-import org.apache.taverna.visit.VisitReport;
-
-//import net.sf.taverna.t2.workbench.report.explainer.VisitExplainer;
-
-/**
- * @author alanrw
- */
-public class ComponentDataflowHealthCheckExplainer implements VisitExplainer {
- private static final Comparator<SemanticAnnotationProfile> comparator = new Comparator<SemanticAnnotationProfile>() {
- @Override
- public int compare(SemanticAnnotationProfile a,
- SemanticAnnotationProfile b) {
- return getDisplayName(a.getPredicate()).compareTo(
- getDisplayName(b.getPredicate()));
- }
- };
-
- @Override
- public boolean canExplain(VisitKind vk, int resultId) {
- return vk instanceof ComponentHealthCheck
- && resultId == FAILS_PROFILE;
- }
-
- @Override
- public JComponent getExplanation(VisitReport vr) {
- @SuppressWarnings("unchecked")
- Set<SemanticAnnotationProfile> problemProfiles = (Set<SemanticAnnotationProfile>) vr
- .getProperty("problemProfiles");
- List<SemanticAnnotationProfile> sortedList = new ArrayList<>(
- problemProfiles);
- sort(sortedList, comparator);
- StringBuilder text = new StringBuilder();
- for (SemanticAnnotationProfile profile : sortedList)
- text.append(getSemanticProfileExplanation(profile)).append("\n");
- return new JTextArea(text.toString());
- }
-
- @Override
- public JComponent getSolution(VisitReport vr) {
- return new JTextArea("Correct the semantic annotation");
- }
-
- private static String getSemanticProfileExplanation(
- SemanticAnnotationProfile p) {
- Integer minOccurs = p.getMinOccurs();
- Integer maxOccurs = p.getMaxOccurs();
- String displayName = getDisplayName(p.getPredicate());
- if (maxOccurs == null)
- return displayName + " must have at least " + minOccurs + " value";
- if (minOccurs.equals(maxOccurs))
- return displayName + " must have " + minOccurs + " value(s)";
- return displayName + " must have between " + minOccurs + " and "
- + maxOccurs + " value(s)";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
deleted file mode 100644
index 7ce0c1b..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentDataflowHealthChecker.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.file;
-
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
-import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.visit.VisitReport;
-import static org.apache.taverna.visit.VisitReport.Status.SEVERE;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workflowmodel.Dataflow;
-import org.apache.taverna.workflowmodel.health.HealthChecker;
-
-/**
- * @author alanrw
- */
-public class ComponentDataflowHealthChecker implements HealthChecker<Dataflow> {
- private static final String PROFILE_UNSATISFIED_MSG = "Workflow does not satisfy component profile";
- private static Logger logger = getLogger(ComponentDataflowHealthChecker.class);
-
- private FileManager fm;
- private ComponentHealthCheck visitType = ComponentHealthCheck.getInstance(); //FIXME beaninject?
- private ComponentFactory factory;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- private Version.ID getSource(Object o) {
- return (Version.ID) fm.getDataflowSource((WorkflowBundle) o);
- }
-
- public void checkProfileSatisfied(WorkflowBundle bundle) {
- //FIXME
- }
- @Override
- public boolean canVisit(Object o) {
- try {
- return getSource(o) != null;
- } catch (IllegalArgumentException e) {
- // Not open?
- } catch (ClassCastException e) {
- // Not dataflow? Not component?
- }
- return false;
- }
-
- @Override
- public VisitReport visit(WorkflowBundle dataflow, List<Object> ancestry) {
- try {
- Version.ID ident = getSource(dataflow);
- Family family = factory.getFamily(ident.getRegistryBase(),
- ident.getFamilyName());
-
- Set<SemanticAnnotationProfile> problemProfiles = checkComponent(
- dataflow, family.getComponentProfile());
- if (problemProfiles.isEmpty())
- return null;
-
- VisitReport visitReport = new VisitReport(visitType, dataflow,
- PROFILE_UNSATISFIED_MSG, FAILS_PROFILE, SEVERE);
- visitReport.setProperty("problemProfiles", problemProfiles);
- return visitReport;
- } catch (ComponentException e) {
- logger.error(
- "failed to comprehend profile while checking for match", e);
- return null;
- }
- }
-//
-// @Override
-// public VisitReport visit(Dataflow o, List<Object> ancestry) {
-// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-// }
-//
-// @Override
-// public boolean isTimeConsuming() {
-// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-// }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
deleted file mode 100644
index f2e16e6..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentOpener.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.file;
-
-import static org.apache.log4j.Logger.getLogger;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.Version.ID;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.OpenException;
-
-/**
- * @author alanrw
- */
-public class ComponentOpener extends AbstractDataflowPersistenceHandler
- implements DataflowPersistenceHandler {
- private static Logger logger = getLogger(ComponentOpener.class);
-
- private ComponentFactory factory;
- private FileType fileType;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileType(FileType fileType) {
- this.fileType = fileType;
- }
-
- @Override
- public DataflowInfo openDataflow(FileType fileType, Object source)
- throws OpenException {
- if (!getOpenFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
- if (!(source instanceof Version.ID))
- throw new IllegalArgumentException("Unsupported source type "
- + source.getClass().getName());
-
- WorkflowBundle d;
- try {
- d = factory.getVersion((ID) source).getImplementation();
- } catch (ComponentException e) {
- logger.error("Unable to read dataflow", e);
- throw new OpenException("Unable to read dataflow", e);
- }
- return new DataflowInfo(fileType, source, d, new Date());
- }
-
- @Override
- public List<FileType> getOpenFileTypes() {
- return Arrays.<FileType> asList(fileType);
- }
-
- @Override
- public List<Class<?>> getOpenSourceTypes() {
- return Arrays.<Class<?>> asList(Version.ID.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
deleted file mode 100644
index 19b52d9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/ComponentSaver.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.file;
-
-import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
-import static javax.swing.JOptionPane.OK_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.apache.log4j.Logger;
-import io.github.taverna_extras.component.api.Component;
-import io.github.taverna_extras.component.api.ComponentException;
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.api.Family;
-import io.github.taverna_extras.component.api.Registry;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.validation.ValidationReport;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.DataflowInfo;
-import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
-import org.apache.taverna.workbench.file.FileType;
-import org.apache.taverna.workbench.file.exceptions.SaveException;
-
-/**
- * @author alanrw
- */
-public class ComponentSaver extends AbstractDataflowPersistenceHandler
- implements DataflowPersistenceHandler {
- private static final String UNSATISFIED_PROFILE_WARNING = "The component does not satisfy the profile.\n"
- + "See validation report.\nDo you still want to save?";
- private static final Logger logger = getLogger(ComponentSaver.class);
-
- private ComponentFactory factory;
- private ComponentServiceProvider provider;
- private FileType cft;
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- public void setFileType(FileType fileType) {
- this.cft = fileType;
- }
-
- public void setServiceProvider(ComponentServiceProvider provider) {
- this.provider = provider;
- }
-
- @Override
- public DataflowInfo saveDataflow(WorkflowBundle bundle, FileType fileType,
- Object destination) throws SaveException {
- if (!getSaveFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
- if (!(destination instanceof Version.ID))
- throw new IllegalArgumentException("Unsupported destination type "
- + destination.getClass().getName());
-
- ValidationReport structuralValidity = new StructuralValidator()
- .validate(bundle);
- if (structuralValidity.detectedProblems())
- throw new SaveException(
- "Cannot save a structurally invalid workflow as a component",
- structuralValidity.getException());
-
- /*
- * Saving an invalid dataflow is OK. Validity check is done to get
- * predicted depth for output (if possible)
- */
-
- Version.ID ident = (Version.ID) destination;
-
- if (ident.getComponentVersion() == -1) {
- Version.ID newIdent = new Version.Identifier(
- ident.getRegistryBase(), ident.getFamilyName(),
- ident.getComponentName(), 0);
- return new DataflowInfo(cft, newIdent, bundle);
- }
-
- Family family;
- try {
- Registry registry = factory.getRegistry(ident.getRegistryBase());
- family = registry.getComponentFamily(ident.getFamilyName());
- } catch (ComponentException e) {
- throw new SaveException("Unable to read component", e);
- }
-
- Version newVersion = null;
- try {
- List<SemanticAnnotationProfile> problemProfiles = new ArrayList<>(
- checkComponent(bundle, family.getComponentProfile()));
-
- if (!problemProfiles.isEmpty()) {
- int answer = showConfirmDialog(null,
- UNSATISFIED_PROFILE_WARNING, "Profile problem",
- OK_CANCEL_OPTION);
- if (answer != OK_OPTION)
- throw new SaveException("Saving cancelled");
- }
-
- JTextArea descriptionArea = new JTextArea(10, 60);
- descriptionArea.setLineWrap(true);
- descriptionArea.setWrapStyleWord(true);
- final JScrollPane descriptionScrollPane = new JScrollPane(
- descriptionArea);
- if (ident.getComponentVersion() == 0) {
- int answer = showConfirmDialog(null, descriptionScrollPane,
- "Component description", OK_CANCEL_OPTION);
- if (answer != OK_OPTION)
- throw new SaveException("Saving cancelled");
- newVersion = family.createComponentBasedOn(
- ident.getComponentName(), descriptionArea.getText(),
- bundle);
- } else {
- Component component = family.getComponent(ident
- .getComponentName());
- int answer = showConfirmDialog(null, descriptionScrollPane,
- "Version description", OK_CANCEL_OPTION);
- if (answer != OK_OPTION)
- throw new SaveException("Saving cancelled");
- newVersion = component.addVersionBasedOn(bundle,
- descriptionArea.getText());
- }
- } catch (ComponentException e) {
- logger.error("Unable to save new version of component", e);
- throw new SaveException("Unable to save new version of component",
- e);
- }
-
- Version.ID newIdent = new Version.Identifier(ident.getRegistryBase(),
- ident.getFamilyName(), ident.getComponentName(),
- newVersion.getVersionNumber());
- provider.refreshProvidedComponent(ident);
- return new DataflowInfo(cft, newIdent, bundle);
- }
-
- @Override
- public List<FileType> getSaveFileTypes() {
- return Arrays.<FileType> asList(cft);
- }
-
- @Override
- public List<Class<?>> getSaveDestinationTypes() {
- return Arrays.<Class<?>> asList(Version.ID.class);
- }
-
- @Override
- public boolean wouldOverwriteDataflow(WorkflowBundle dataflow,
- FileType fileType, Object destination, DataflowInfo lastDataflowInfo) {
- if (!getSaveFileTypes().contains(fileType))
- throw new IllegalArgumentException("Unsupported file type "
- + fileType);
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
deleted file mode 100644
index 8ee99b9..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/file/FileManagerObserver.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.file;
-
-import static java.awt.Color.WHITE;
-import static java.awt.Font.BOLD;
-import static javax.swing.SwingUtilities.invokeLater;
-import static javax.swing.SwingUtilities.isEventDispatchThread;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Insets;
-
-import javax.swing.border.Border;
-
-import org.apache.batik.swing.JSVGCanvas;
-import io.github.taverna_extras.component.api.Version;
-import io.github.taverna_extras.component.ui.util.Utils;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.workbench.StartupSPI;
-import org.apache.taverna.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.workbench.file.FileManager;
-import org.apache.taverna.workbench.file.events.FileManagerEvent;
-import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
-import org.apache.taverna.workbench.views.graph.GraphViewComponent;
-
-public class FileManagerObserver implements StartupSPI {
- private static final Color COLOR = new Color(230, 147, 210);
-
- private FileManager fileManager;
- private ColourManager colours;
- private GraphViewComponent graphView;
- private Utils utils;
-
- public void setFileManager(FileManager fileManager) {
- this.fileManager = fileManager;
- }
-
- public void setColourManager(ColourManager colours) {
- this.colours = colours;
- }
-
- public void setGraphView(GraphViewComponent graphView) {
- this.graphView = graphView;
- }
-
- public void setUtils(Utils utils) {
- this.utils = utils;
- }
-
- @Override
- public boolean startup() {
- colours.setPreferredColour(
- "io.github.taverna_extras.component.registry.Component", COLOR);
- colours.setPreferredColour(
- "io.github.taverna_extras.component.ComponentActivity", COLOR);
- fileManager.addObserver(new Observer<FileManagerEvent>() {
- @Override
- public void notify(Observable<FileManagerEvent> observable,
- FileManagerEvent event) throws Exception {
- FileManagerObserverRunnable runnable = new FileManagerObserverRunnable();
- if (isEventDispatchThread())
- runnable.run();
- else
- invokeLater(runnable);
- }
- });
- return true;
- }
-
- @Override
- public int positionHint() {
- return 200;
- }
-
- public class FileManagerObserverRunnable implements Runnable {
- @Override
- public void run() {
- WorkflowBundle currentDataflow = fileManager.getCurrentDataflow();
- if (currentDataflow == null)
- return;
- SVGGraphController graphController = (SVGGraphController) graphView
- .getGraphController(currentDataflow.getMainWorkflow());
- if (graphController == null)
- return;
- JSVGCanvas svgCanvas = graphController.getSVGCanvas();
- Object dataflowSource = fileManager
- .getDataflowSource(currentDataflow);
- if (utils.currentDataflowIsComponent())
- svgCanvas.setBorder(new ComponentBorder(
- (Version.ID) dataflowSource));
- else
- svgCanvas.setBorder(null);
- svgCanvas.repaint();
- }
- }
-
- static class ComponentBorder implements Border {
- private final Insets insets = new Insets(25, 0, 0, 0);
- private final String text;
-
- public ComponentBorder(Version.ID identification) {
- text = "Component : " + identification.getComponentName();
- }
-
- @Override
- public Insets getBorderInsets(java.awt.Component c) {
- return insets;
- }
-
- @Override
- public boolean isBorderOpaque() {
- return true;
- }
-
- @Override
- public void paintBorder(java.awt.Component c, Graphics g, int x, int y,
- int width, int height) {
- g.setColor(COLOR);
- g.fillRect(x, y, width, 20);
- g.setFont(g.getFont().deriveFont(BOLD));
- g.setColor(WHITE);
- g.drawString(text, x + 5, y + 15);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
deleted file mode 100644
index a35ab61..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/localworld/LocalWorld.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.localworld;
-
-import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
-import static org.apache.log4j.Logger.getLogger;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createTurtle;
-import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.jena.ontology.Individual;
-import org.apache.jena.ontology.OntClass;
-import org.apache.jena.ontology.OntModel;
-import org.apache.jena.rdf.model.Resource;
-import org.apache.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * @author alanrw
- */
-public class LocalWorld {
- private static final String FILENAME = "localWorld.ttl";
- private static final Logger logger = getLogger(LocalWorld.class);
- protected static final String ENCODING = "TURTLE";
- private static LocalWorld instance = null;
-
- private OntModel model;
-
- public synchronized static LocalWorld getInstance() {
- if (instance == null)
- instance = new LocalWorld();
- return instance;
- }
-
- private LocalWorld() {
- File modelFile = new File(calculateComponentsDirectory(), FILENAME);
- model = createOntologyModel();
- if (modelFile.exists())
- try (Reader in = new InputStreamReader(new FileInputStream(
- modelFile), "UTF-8")) {
- model.read(in, null, ENCODING);
- } catch (IOException e) {
- logger.error("failed to construct local annotation world", e);
- }
- }
-
- ApplicationConfiguration config;//FIXME beaninject
-
- public File calculateComponentsDirectory() {
- return new File(config.getApplicationHomeDir(), "components");
- }
-
- public Individual createIndividual(String urlString, OntClass rangeClass) {
- try {
- return model.createIndividual(urlString, rangeClass);
- } finally {
- saveModel();
- }
- }
-
- private void saveModel() {
- File modelFile = new File(calculateComponentsDirectory(), FILENAME);
- try (OutputStream out = new FileOutputStream(modelFile)) {
- out.write(createTurtle(model).getBytes("UTF-8"));
- } catch (IOException e) {
- logger.error("failed to save local annotation world", e);
- }
- }
-
- public List<Individual> getIndividualsOfClass(Resource clazz) {
- return model.listIndividuals(clazz).toList();
- }
-
- public void addModelFromString(String addedModel) {
- try {
- populateModelFromString(model, addedModel);
- } finally {
- saveModel();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
deleted file mode 100644
index 0911a66..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/AbstractContextComponentMenuAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import java.net.URI;
-
-import io.github.taverna_extras.component.api.config.ComponentConfig;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
-
-public abstract class AbstractContextComponentMenuAction extends AbstractContextualMenuAction {
- public AbstractContextComponentMenuAction(URI parentId, int positionHint) {
- super(parentId, positionHint);
- }
-
- public AbstractContextComponentMenuAction(URI parentId, int positionHint, URI id) {
- super(parentId, positionHint, id);
- }
-
- protected boolean isComponentActivity(Activity act) {
- if (act == null)
- return false;
- return act.getType().equals(ComponentConfig.URI);
- }
-
- protected Activity findActivity() {
- if (getContextualSelection() == null)
- return null;
- Object selection = getContextualSelection().getSelection();
- if (selection instanceof Processor) {
- Processor processor = (Processor) selection;
- return processor.getParent().getParent().getMainProfile()
- .getProcessorBindings().getByName(processor.getName())
- .getBoundActivity();
- } else if (selection instanceof Activity)
- return (Activity) selection;
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
deleted file mode 100644
index 0feb63e..0000000
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/menu/ComponentConfigureMenuAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-* 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 io.github.taverna_extras.component.ui.menu;
-
-import static javax.swing.Action.NAME;
-import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
-
-import javax.swing.Action;
-
-import io.github.taverna_extras.component.api.ComponentFactory;
-import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
-import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
-import org.apache.taverna.services.ServiceRegistry;
-import org.apache.taverna.workbench.activityicons.ActivityIconManager;
-import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import org.apache.taverna.workbench.edits.EditManager;
-import org.apache.taverna.workbench.file.FileManager;
-
-public class ComponentConfigureMenuAction extends
- AbstractConfigureActivityMenuAction {
- public ComponentConfigureMenuAction() {
- super(ACTIVITY_URI);
- }
-
- private ActivityIconManager aim;
- private ServiceDescriptionRegistry sdr;
- private EditManager em;
- private FileManager fm;
- private ServiceRegistry str;
- private ComponentFactory factory;
-
- public void setActivityIconManager(ActivityIconManager aim) {
- this.aim = aim;
- }
-
- public void setServiceDescriptionRegistry(ServiceDescriptionRegistry sdr) {
- this.sdr = sdr;
- }
-
- public void setEditManager(EditManager em) {
- this.em = em;
- }
-
- public void setFileManager(FileManager fm) {
- this.fm = fm;
- }
-
- public void setServiceTypeRegistry(ServiceRegistry str) {
- this.str = str;
- }
-
- public void setComponentFactory(ComponentFactory factory) {
- this.factory = factory;
- }
-
- @Override
- protected Action createAction() {
- Action result = new ComponentConfigureAction(findActivity(),
- getParentFrame(), factory, aim, sdr, em, fm, str);
- result.putValue(NAME, "Configure component");
- addMenuDots(result);
- return result;
- }
-}
[27/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
package rename folders
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/commit/b7b61e71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/tree/b7b61e71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/diff/b7b61e71
Branch: refs/heads/master
Commit: b7b61e7133ed485a12d22bdf6b7d3a3cccff3f4a
Parents: 6664979
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Jun 29 11:53:30 2018 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Jun 29 11:53:30 2018 +0100
----------------------------------------------------------------------
.../component/ui/ComponentAction.java | 66 ++
.../ui/ComponentActivityConfigurationBean.java | 184 +++++
.../component/ui/ComponentConstants.java | 28 +
...bstractSemanticAnnotationContextualView.java | 296 ++++++++
.../annotation/AnnotateSemanticsMenuAction.java | 117 ++++
.../AnnotationPropertyPanelFactory.java | 73 ++
.../DatatypePropertyPanelFactory.java | 76 +++
.../DateTimePropertyPanelFactory.java | 136 ++++
.../FallbackPropertyPanelFactory.java | 60 ++
.../component/ui/annotation/GreyBorder.java | 36 +
...jectPropertyWithIndividualsPanelFactory.java | 196 ++++++
.../ui/annotation/PropertyPanelFactorySPI.java | 82 +++
.../SemanticAnnotationContextualView.java | 144 ++++
...SemanticAnnotationContextualViewFactory.java | 67 ++
.../ui/annotation/SemanticAnnotationPanel.java | 271 ++++++++
.../ui/annotation/SemanticAnnotationUtils.java | 190 ++++++
.../ui/annotation/TurtleContextualView.java | 93 +++
.../ui/annotation/TurtleInputPanel.java | 105 +++
.../annotation/UnrecognizedStatementPanel.java | 43 ++
.../annotation/UnresolveablePredicatePanel.java | 43 ++
.../ui/config/ComponentConfigurationPanel.java | 171 +++++
.../ui/config/ComponentConfigureAction.java | 69 ++
.../ComponentDataflowHealthCheckExplainer.java | 91 +++
.../ui/file/ComponentDataflowHealthChecker.java | 114 ++++
.../component/ui/file/ComponentOpener.java | 88 +++
.../component/ui/file/ComponentSaver.java | 185 +++++
.../component/ui/file/FileManagerObserver.java | 146 ++++
.../component/ui/localworld/LocalWorld.java | 107 +++
.../AbstractContextComponentMenuAction.java | 58 ++
.../ui/menu/ComponentConfigureMenuAction.java | 81 +++
.../component/ui/menu/ComponentMenu.java | 41 ++
.../component/ui/menu/ComponentSection.java | 44 ++
.../ui/menu/NestedWorkflowCreationDialog.java | 666 ++++++++++++++++++
.../menu/NestedWorkflowCreatorMenuAction.java | 94 +++
...penComponentFromComponentActivityAction.java | 81 +++
...omponentFromComponentActivityMenuAction.java | 104 +++
.../ui/menu/ReplaceByComponentAction.java | 275 ++++++++
.../ui/menu/ReplaceByComponentMenuAction.java | 87 +++
.../component/AbstractComponentMenuAction.java | 31 +
.../ui/menu/component/ComponentCloseAction.java | 73 ++
.../component/ComponentCloseMenuAction.java | 66 ++
.../ui/menu/component/ComponentCopyAction.java | 164 +++++
.../menu/component/ComponentCopyMenuAction.java | 61 ++
.../menu/component/ComponentCreatorSupport.java | 257 +++++++
.../menu/component/ComponentDeleteAction.java | 143 ++++
.../component/ComponentDeleteMenuAction.java | 67 ++
.../ui/menu/component/ComponentMenuAction.java | 56 ++
.../ui/menu/component/ComponentMenuSection.java | 37 +
.../ui/menu/component/ComponentMergeAction.java | 135 ++++
.../component/ComponentMergeMenuAction.java | 55 ++
.../ui/menu/component/ComponentSaveAction.java | 69 ++
.../menu/component/ComponentSaveMenuAction.java | 67 ++
.../menu/component/ComponentSearchAction.java | 169 +++++
.../component/ComponentSearchMenuAction.java | 85 +++
.../ComponentServiceCreatorAction.java | 112 +++
.../ComponentServiceCreatorMenuAction.java | 77 +++
.../ComponentWorkflowCreatorAction.java | 84 +++
.../ComponentWorkflowCreatorMenuAction.java | 72 ++
.../FileOpenFromComponentMenuAction.java | 74 ++
.../OpenWorkflowFromComponentAction.java | 137 ++++
.../family/ComponentFamilyCreateAction.java | 176 +++++
.../family/ComponentFamilyCreateMenuAction.java | 58 ++
.../family/ComponentFamilyDeleteAction.java | 201 ++++++
.../family/ComponentFamilyDeleteMenuAction.java | 69 ++
.../menu/family/ComponentFamilyMenuSection.java | 37 +
.../profile/ComponentProfileCopyAction.java | 177 +++++
.../profile/ComponentProfileCopyMenuAction.java | 58 ++
.../profile/ComponentProfileDeleteAction.java | 113 +++
.../ComponentProfileDeleteMenuAction.java | 58 ++
.../profile/ComponentProfileImportAction.java | 181 +++++
.../ComponentProfileImportMenuAction.java | 64 ++
.../profile/ComponentProfileMenuSection.java | 40 ++
.../registry/ComponentRegistryManageAction.java | 52 ++
.../ComponentRegistryManageMenuAction.java | 63 ++
.../registry/ComponentRegistryMenuSection.java | 37 +
.../ui/panel/ComponentChoiceMessage.java | 50 ++
.../ui/panel/ComponentChooserPanel.java | 233 +++++++
.../ui/panel/ComponentListCellRenderer.java | 62 ++
.../ui/panel/ComponentVersionChooserPanel.java | 186 +++++
.../component/ui/panel/FamilyChoiceMessage.java | 40 ++
.../component/ui/panel/FamilyChooserPanel.java | 235 +++++++
.../component/ui/panel/LicenseChooserPanel.java | 187 +++++
.../component/ui/panel/PrefixPanel.java | 96 +++
.../ui/panel/ProfileChoiceMessage.java | 40 ++
.../component/ui/panel/ProfileChooserPanel.java | 219 ++++++
...stryAndFamilyChooserComponentEntryPanel.java | 98 +++
.../ui/panel/RegistryAndFamilyChooserPanel.java | 102 +++
.../ui/panel/RegistryChoiceMessage.java | 40 ++
.../ui/panel/RegistryChooserPanel.java | 138 ++++
.../component/ui/panel/SearchChoicePanel.java | 259 +++++++
.../ui/panel/SharingPolicyChooserPanel.java | 157 +++++
.../ui/preference/ComponentDefaults.java | 57 ++
.../ui/preference/ComponentPreference.java | 143 ++++
.../ui/preference/ComponentPreferencePanel.java | 300 ++++++++
.../ComponentPreferenceUIFactory.java | 61 ++
.../ui/preference/LocalRegistryPanel.java | 132 ++++
.../ui/preference/RegistryTableModel.java | 86 +++
.../ui/preference/RemoteRegistryPanel.java | 94 +++
.../serviceprovider/ComponentServiceDesc.java | 174 +++++
.../serviceprovider/ComponentServiceIcon.java | 51 ++
.../ComponentServiceProvider.java | 236 +++++++
.../ComponentServiceProviderConfig.java | 88 +++
.../component/ui/serviceprovider/Service.java | 27 +
.../component/ui/util/ComponentFileType.java | 51 ++
.../component/ui/util/ComponentHealthCheck.java | 86 +++
.../taverna_extras/component/ui/util/Utils.java | 144 ++++
.../ComponentActivityContextViewFactory.java | 140 ++++
...itySemanticAnnotationContextViewFactory.java | 154 +++++
...omponentActivitySemanticAnnotationPanel.java | 112 +++
.../ui/view/ComponentContextViewFactory.java | 61 ++
.../ui/view/ComponentContextualView.java | 89 +++
.../component/ui/view/ViewUtil.java | 178 +++++
.../taverna/component/ui/ComponentAction.java | 66 --
.../ui/ComponentActivityConfigurationBean.java | 184 -----
.../component/ui/ComponentConstants.java | 28 -
...bstractSemanticAnnotationContextualView.java | 296 --------
.../annotation/AnnotateSemanticsMenuAction.java | 117 ----
.../AnnotationPropertyPanelFactory.java | 73 --
.../DatatypePropertyPanelFactory.java | 76 ---
.../DateTimePropertyPanelFactory.java | 136 ----
.../FallbackPropertyPanelFactory.java | 60 --
.../component/ui/annotation/GreyBorder.java | 36 -
...jectPropertyWithIndividualsPanelFactory.java | 196 ------
.../ui/annotation/PropertyPanelFactorySPI.java | 82 ---
.../SemanticAnnotationContextualView.java | 144 ----
...SemanticAnnotationContextualViewFactory.java | 67 --
.../ui/annotation/SemanticAnnotationPanel.java | 271 --------
.../ui/annotation/SemanticAnnotationUtils.java | 190 ------
.../ui/annotation/TurtleContextualView.java | 93 ---
.../ui/annotation/TurtleInputPanel.java | 105 ---
.../annotation/UnrecognizedStatementPanel.java | 43 --
.../annotation/UnresolveablePredicatePanel.java | 43 --
.../ui/config/ComponentConfigurationPanel.java | 171 -----
.../ui/config/ComponentConfigureAction.java | 69 --
.../ComponentDataflowHealthCheckExplainer.java | 91 ---
.../ui/file/ComponentDataflowHealthChecker.java | 114 ----
.../component/ui/file/ComponentOpener.java | 88 ---
.../component/ui/file/ComponentSaver.java | 185 -----
.../component/ui/file/FileManagerObserver.java | 146 ----
.../component/ui/localworld/LocalWorld.java | 107 ---
.../AbstractContextComponentMenuAction.java | 58 --
.../ui/menu/ComponentConfigureMenuAction.java | 81 ---
.../component/ui/menu/ComponentMenu.java | 41 --
.../component/ui/menu/ComponentSection.java | 44 --
.../ui/menu/NestedWorkflowCreationDialog.java | 666 ------------------
.../menu/NestedWorkflowCreatorMenuAction.java | 94 ---
...penComponentFromComponentActivityAction.java | 81 ---
...omponentFromComponentActivityMenuAction.java | 104 ---
.../ui/menu/ReplaceByComponentAction.java | 275 --------
.../ui/menu/ReplaceByComponentMenuAction.java | 87 ---
.../component/AbstractComponentMenuAction.java | 31 -
.../ui/menu/component/ComponentCloseAction.java | 73 --
.../component/ComponentCloseMenuAction.java | 66 --
.../ui/menu/component/ComponentCopyAction.java | 164 -----
.../menu/component/ComponentCopyMenuAction.java | 61 --
.../menu/component/ComponentCreatorSupport.java | 257 -------
.../menu/component/ComponentDeleteAction.java | 143 ----
.../component/ComponentDeleteMenuAction.java | 67 --
.../ui/menu/component/ComponentMenuAction.java | 56 --
.../ui/menu/component/ComponentMenuSection.java | 37 -
.../ui/menu/component/ComponentMergeAction.java | 135 ----
.../component/ComponentMergeMenuAction.java | 55 --
.../ui/menu/component/ComponentSaveAction.java | 69 --
.../menu/component/ComponentSaveMenuAction.java | 67 --
.../menu/component/ComponentSearchAction.java | 169 -----
.../component/ComponentSearchMenuAction.java | 85 ---
.../ComponentServiceCreatorAction.java | 112 ---
.../ComponentServiceCreatorMenuAction.java | 77 ---
.../ComponentWorkflowCreatorAction.java | 84 ---
.../ComponentWorkflowCreatorMenuAction.java | 72 --
.../FileOpenFromComponentMenuAction.java | 74 --
.../OpenWorkflowFromComponentAction.java | 137 ----
.../family/ComponentFamilyCreateAction.java | 176 -----
.../family/ComponentFamilyCreateMenuAction.java | 58 --
.../family/ComponentFamilyDeleteAction.java | 201 ------
.../family/ComponentFamilyDeleteMenuAction.java | 69 --
.../menu/family/ComponentFamilyMenuSection.java | 37 -
.../profile/ComponentProfileCopyAction.java | 177 -----
.../profile/ComponentProfileCopyMenuAction.java | 58 --
.../profile/ComponentProfileDeleteAction.java | 113 ---
.../ComponentProfileDeleteMenuAction.java | 58 --
.../profile/ComponentProfileImportAction.java | 181 -----
.../ComponentProfileImportMenuAction.java | 64 --
.../profile/ComponentProfileMenuSection.java | 40 --
.../registry/ComponentRegistryManageAction.java | 52 --
.../ComponentRegistryManageMenuAction.java | 63 --
.../registry/ComponentRegistryMenuSection.java | 37 -
.../ui/panel/ComponentChoiceMessage.java | 50 --
.../ui/panel/ComponentChooserPanel.java | 233 -------
.../ui/panel/ComponentListCellRenderer.java | 62 --
.../ui/panel/ComponentVersionChooserPanel.java | 186 -----
.../component/ui/panel/FamilyChoiceMessage.java | 40 --
.../component/ui/panel/FamilyChooserPanel.java | 235 -------
.../component/ui/panel/LicenseChooserPanel.java | 187 -----
.../taverna/component/ui/panel/PrefixPanel.java | 96 ---
.../ui/panel/ProfileChoiceMessage.java | 40 --
.../component/ui/panel/ProfileChooserPanel.java | 219 ------
...stryAndFamilyChooserComponentEntryPanel.java | 98 ---
.../ui/panel/RegistryAndFamilyChooserPanel.java | 102 ---
.../ui/panel/RegistryChoiceMessage.java | 40 --
.../ui/panel/RegistryChooserPanel.java | 138 ----
.../component/ui/panel/SearchChoicePanel.java | 259 -------
.../ui/panel/SharingPolicyChooserPanel.java | 157 -----
.../ui/preference/ComponentDefaults.java | 57 --
.../ui/preference/ComponentPreference.java | 143 ----
.../ui/preference/ComponentPreferencePanel.java | 300 --------
.../ComponentPreferenceUIFactory.java | 61 --
.../ui/preference/LocalRegistryPanel.java | 132 ----
.../ui/preference/RegistryTableModel.java | 86 ---
.../ui/preference/RemoteRegistryPanel.java | 94 ---
.../serviceprovider/ComponentServiceDesc.java | 174 -----
.../serviceprovider/ComponentServiceIcon.java | 51 --
.../ComponentServiceProvider.java | 236 -------
.../ComponentServiceProviderConfig.java | 88 ---
.../component/ui/serviceprovider/Service.java | 27 -
.../component/ui/util/ComponentFileType.java | 51 --
.../component/ui/util/ComponentHealthCheck.java | 86 ---
.../apache/taverna/component/ui/util/Utils.java | 144 ----
.../ComponentActivityContextViewFactory.java | 140 ----
...itySemanticAnnotationContextViewFactory.java | 154 -----
...omponentActivitySemanticAnnotationPanel.java | 112 ---
.../ui/view/ComponentContextViewFactory.java | 61 --
.../ui/view/ComponentContextualView.java | 89 ---
.../taverna/component/ui/view/ViewUtil.java | 178 -----
.../component/activity/ComponentActivity.java | 167 +++++
.../ComponentActivityConfigurationBean.java | 168 +++++
.../activity/ComponentActivityFactory.java | 142 ++++
.../activity/ComponentActivityLocalChecker.java | 69 ++
.../ComponentActivityUpgradeChecker.java | 83 +++
.../activity/ComponentExceptionFactory.java | 38 ++
.../activity/ComponentHealthCheck.java | 42 ++
.../ComponentImplementationException.java | 37 +
.../component/activity/ProxyCallback.java | 264 +++++++
.../component/activity/package-info.java | 19 +
.../component/profile/ActivityProfileImpl.java | 53 ++
.../component/profile/BaseProfileLocator.java | 154 +++++
.../component/profile/ComponentProfileImpl.java | 683 +++++++++++++++++++
.../component/profile/PortProfileImpl.java | 58 ++
.../profile/SemanticAnnotationProfileImpl.java | 175 +++++
.../component/registry/ClientVersion.java | 51 ++
.../component/registry/Component.java | 161 +++++
.../component/registry/ComponentFamily.java | 161 +++++
.../registry/ComponentImplementationCache.java | 75 ++
.../component/registry/ComponentRegistry.java | 242 +++++++
.../component/registry/ComponentUtil.java | 130 ++++
.../component/registry/ComponentVersion.java | 77 +++
.../ComponentVersionIdentification.java | 212 ++++++
.../registry/local/LocalComponent.java | 149 ++++
.../registry/local/LocalComponentFamily.java | 155 +++++
.../registry/local/LocalComponentRegistry.java | 220 ++++++
.../local/LocalComponentRegistryFactory.java | 62 ++
.../registry/local/LocalComponentVersion.java | 108 +++
.../component/registry/standard/Client.java | 654 ++++++++++++++++++
.../registry/standard/NewComponent.java | 239 +++++++
.../registry/standard/NewComponentFamily.java | 151 ++++
.../registry/standard/NewComponentLicense.java | 76 +++
.../registry/standard/NewComponentProfile.java | 121 ++++
.../registry/standard/NewComponentRegistry.java | 485 +++++++++++++
.../standard/NewComponentRegistryFactory.java | 83 +++
.../component/registry/standard/Policy.java | 136 ++++
.../registry/standard/annotations/Unused.java | 43 ++
.../standard/annotations/package-info.java | 24 +
.../registry/standard/package-info.java | 23 +
.../component/utils/AnnotationUtils.java | 109 +++
.../component/utils/SystemUtils.java | 135 ++++
.../component/activity/ComponentActivity.java | 167 -----
.../ComponentActivityConfigurationBean.java | 168 -----
.../activity/ComponentActivityFactory.java | 142 ----
.../activity/ComponentActivityLocalChecker.java | 69 --
.../ComponentActivityUpgradeChecker.java | 83 ---
.../activity/ComponentExceptionFactory.java | 38 --
.../activity/ComponentHealthCheck.java | 42 --
.../ComponentImplementationException.java | 37 -
.../component/activity/ProxyCallback.java | 264 -------
.../component/activity/package-info.java | 19 -
.../component/profile/ActivityProfileImpl.java | 53 --
.../component/profile/BaseProfileLocator.java | 154 -----
.../component/profile/ComponentProfileImpl.java | 683 -------------------
.../component/profile/PortProfileImpl.java | 58 --
.../profile/SemanticAnnotationProfileImpl.java | 175 -----
.../component/registry/ClientVersion.java | 51 --
.../taverna/component/registry/Component.java | 161 -----
.../component/registry/ComponentFamily.java | 161 -----
.../registry/ComponentImplementationCache.java | 75 --
.../component/registry/ComponentRegistry.java | 242 -------
.../component/registry/ComponentUtil.java | 130 ----
.../component/registry/ComponentVersion.java | 77 ---
.../ComponentVersionIdentification.java | 212 ------
.../registry/local/LocalComponent.java | 149 ----
.../registry/local/LocalComponentFamily.java | 155 -----
.../registry/local/LocalComponentRegistry.java | 220 ------
.../local/LocalComponentRegistryFactory.java | 62 --
.../registry/local/LocalComponentVersion.java | 108 ---
.../component/registry/standard/Client.java | 654 ------------------
.../registry/standard/NewComponent.java | 239 -------
.../registry/standard/NewComponentFamily.java | 151 ----
.../registry/standard/NewComponentLicense.java | 76 ---
.../registry/standard/NewComponentProfile.java | 121 ----
.../registry/standard/NewComponentRegistry.java | 485 -------------
.../standard/NewComponentRegistryFactory.java | 83 ---
.../component/registry/standard/Policy.java | 136 ----
.../registry/standard/annotations/Unused.java | 43 --
.../standard/annotations/package-info.java | 24 -
.../registry/standard/package-info.java | 23 -
.../component/utils/AnnotationUtils.java | 109 ---
.../taverna/component/utils/SystemUtils.java | 135 ----
.../component/AnnotationTest.java | 48 ++
.../component/ComponentActivityTest.java | 125 ++++
.../component/registry/ComponentFamilyTest.java | 122 ++++
.../registry/ComponentRegistryTest.java | 181 +++++
.../component/registry/ComponentTest.java | 111 +++
.../registry/ComponentVersionTest.java | 94 +++
.../component/registry/Harness.java | 30 +
.../local/LocalComponentFamilyTest.java | 40 ++
.../local/LocalComponentRegistryTest.java | 59 ++
.../registry/local/LocalComponentTest.java | 40 ++
.../local/LocalComponentVersionTest.java | 40 ++
.../registry/local/RegistrySupport.java | 44 ++
.../standard/NewComponentFamilyTest.java | 42 ++
.../standard/NewComponentRegistryTest.java | 75 ++
.../registry/standard/NewComponentTest.java | 42 ++
.../standard/NewComponentVersionTest.java | 42 ++
.../registry/standard/RegistrySupport.java | 55 ++
.../taverna/component/AnnotationTest.java | 48 --
.../component/ComponentActivityTest.java | 125 ----
.../component/registry/ComponentFamilyTest.java | 122 ----
.../registry/ComponentRegistryTest.java | 181 -----
.../component/registry/ComponentTest.java | 111 ---
.../registry/ComponentVersionTest.java | 94 ---
.../taverna/component/registry/Harness.java | 30 -
.../local/LocalComponentFamilyTest.java | 40 --
.../local/LocalComponentRegistryTest.java | 59 --
.../registry/local/LocalComponentTest.java | 40 --
.../local/LocalComponentVersionTest.java | 40 --
.../registry/local/RegistrySupport.java | 44 --
.../standard/NewComponentFamilyTest.java | 42 --
.../standard/NewComponentRegistryTest.java | 75 --
.../registry/standard/NewComponentTest.java | 42 --
.../standard/NewComponentVersionTest.java | 42 --
.../registry/standard/RegistrySupport.java | 55 --
.../taverna_extras/component/api/Component.java | 89 +++
.../component/api/ComponentException.java | 48 ++
.../component/api/ComponentFactory.java | 45 ++
.../taverna_extras/component/api/Family.java | 117 ++++
.../taverna_extras/component/api/License.java | 23 +
.../taverna_extras/component/api/NamedItem.java | 26 +
.../taverna_extras/component/api/Registry.java | 158 +++++
.../component/api/SharingPolicy.java | 32 +
.../taverna_extras/component/api/Version.java | 224 ++++++
.../component/api/config/ComponentConfig.java | 23 +
.../api/config/ComponentPropertyNames.java | 32 +
.../component/api/package-info.java | 25 +
.../component/api/profile/ActivityProfile.java | 23 +
.../component/api/profile/AnnotatedElement.java | 28 +
.../api/profile/ExceptionHandling.java | 47 ++
.../api/profile/ExceptionReplacement.java | 43 ++
.../component/api/profile/HandleException.java | 55 ++
.../component/api/profile/PortProfile.java | 22 +
.../component/api/profile/Profile.java | 65 ++
.../api/profile/SemanticAnnotationProfile.java | 72 ++
.../apache/taverna/component/api/Component.java | 89 ---
.../component/api/ComponentException.java | 48 --
.../taverna/component/api/ComponentFactory.java | 45 --
.../apache/taverna/component/api/Family.java | 117 ----
.../apache/taverna/component/api/License.java | 23 -
.../apache/taverna/component/api/NamedItem.java | 26 -
.../apache/taverna/component/api/Registry.java | 158 -----
.../taverna/component/api/SharingPolicy.java | 32 -
.../apache/taverna/component/api/Version.java | 224 ------
.../component/api/config/ComponentConfig.java | 23 -
.../api/config/ComponentPropertyNames.java | 32 -
.../taverna/component/api/package-info.java | 25 -
.../component/api/profile/ActivityProfile.java | 23 -
.../component/api/profile/AnnotatedElement.java | 28 -
.../api/profile/ExceptionHandling.java | 47 --
.../api/profile/ExceptionReplacement.java | 43 --
.../component/api/profile/HandleException.java | 55 --
.../component/api/profile/PortProfile.java | 22 -
.../taverna/component/api/profile/Profile.java | 65 --
.../api/profile/SemanticAnnotationProfile.java | 72 --
380 files changed, 21510 insertions(+), 21510 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentAction.java
new file mode 100644
index 0000000..f359c9d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentAction.java
@@ -0,0 +1,66 @@
+/*
+* 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 io.github.taverna_extras.component.ui;
+
+import static java.awt.Color.RED;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.log4j.Logger.getLogger;
+
+import javax.swing.AbstractAction;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.svg.SVGGraph;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+@SuppressWarnings("serial")
+public abstract class ComponentAction extends AbstractAction {
+ private static Logger logger = getLogger(ComponentAction.class);
+
+ protected GraphViewComponent graphView;
+
+ protected ComponentAction(String title, GraphViewComponent graphView) {
+ this.graphView = graphView;
+ }
+
+ public void setIcon(ComponentServiceIcon icon) {
+ putValue(SMALL_ICON, icon.getIcon());
+ }
+
+ protected void markGraphAsBelongingToComponent(WorkflowBundle bundle) {
+ final GraphController gc = graphView.getGraphController(bundle
+ .getMainWorkflow());
+ invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ SVGGraph g = (SVGGraph) gc.getGraph();
+ g.setFillColor(RED);
+ gc.redraw();
+ } catch (NullPointerException e) {
+ logger.error(e);
+ }
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentActivityConfigurationBean.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentActivityConfigurationBean.java
new file mode 100644
index 0000000..26e673e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentActivityConfigurationBean.java
@@ -0,0 +1,184 @@
+/*
+* 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 io.github.taverna_extras.component.ui;
+
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.config.ComponentPropertyNames;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Component activity configuration bean.
+ */
+public class ComponentActivityConfigurationBean extends Version.Identifier {
+ public static final String ERROR_CHANNEL = "error_channel";
+ public static final List<String> ignorableNames = Arrays
+ .asList(ERROR_CHANNEL);
+ private static final long serialVersionUID = 5774901665863468058L;
+ private static final Logger logger = getLogger(ComponentActivityConfigurationBean.class);
+
+ private ActivityPortsDefinitionBean ports = null;
+ private ComponentFactory factory;
+ private ExceptionHandling eh;
+
+ public ComponentActivityConfigurationBean(Version.ID toBeCopied,
+ ComponentFactory factory) {
+ super(toBeCopied.getRegistryBase(), toBeCopied.getFamilyName(),
+ toBeCopied.getComponentName(), toBeCopied.getComponentVersion());
+ this.factory = factory;
+ try {
+ getPorts();
+ } catch (ComponentException e) {
+ logger.error("failed to get component realization", e);
+ }
+ }
+
+ public ComponentActivityConfigurationBean(JsonNode json,
+ ComponentFactory factory) throws MalformedURLException {
+ super(getUrl(json), getFamily(json), getComponent(json),
+ getVersion(json));
+ this.factory = factory;
+ }
+
+ public ComponentActivityConfigurationBean(Configuration configuration,
+ ComponentFactory factory) throws MalformedURLException {
+ this(configuration.getJson(), factory);
+ }
+
+ private static URL getUrl(JsonNode json) throws MalformedURLException {
+ return new URL(json.get(REGISTRY_BASE).textValue());
+ }
+
+ private static String getFamily(JsonNode json) {
+ return json.get(FAMILY_NAME).textValue();
+ }
+
+ private static String getComponent(JsonNode json) {
+ return json.get(COMPONENT_NAME).textValue();
+ }
+
+ private static Integer getVersion(JsonNode json) {
+ JsonNode node = json.get(COMPONENT_VERSION);
+ if (node == null || !node.isInt())
+ return null;
+ return node.intValue();
+ }
+
+ public Component getComponent() throws ComponentException {
+ return factory.getComponent(getRegistryBase(), getFamilyName(),
+ getComponentName());
+ }
+
+ public Version getVersion() throws ComponentException {
+ return factory.getVersion(this);
+ }
+
+ private ActivityPortsDefinitionBean getPortsDefinition(WorkflowBundle w) {
+ ActivityPortsDefinitionBean result = new ActivityPortsDefinitionBean();
+
+ for (InputWorkflowPort iwp : w.getMainWorkflow().getInputPorts())
+ result.inputs.add(makeInputDefinition(iwp));
+ for (OutputWorkflowPort owp : w.getMainWorkflow().getOutputPorts())
+ result.outputs.add(makeOutputDefinition(getDepth(owp), owp.getName()));
+
+ try {
+ eh = factory.getFamily(getRegistryBase(), getFamilyName())
+ .getComponentProfile().getExceptionHandling();
+ if (eh != null)
+ result.outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
+ logger.error("failed to get exception handling for family", e);
+ }
+ return result;
+ }
+
+ private int getDepth(OutputWorkflowPort owp) {
+ return 0; //FIXME How to get the depth of an output?
+ }
+
+ private InputActivityPort makeInputDefinition(InputWorkflowPort dip) {
+ InputActivityPort port = new InputActivityPort();
+ port.setName(dip.getName());
+ port.setDepth(dip.getDepth());
+ return port;
+ }
+
+ private OutputActivityPort makeOutputDefinition(int depth, String name) {
+ OutputActivityPort port = new OutputActivityPort();
+ port.setName(name);
+ port.setDepth(depth);
+ port.setGranularDepth(depth);
+ return port;
+ }
+
+ /**
+ * @return the ports
+ */
+ public ActivityPortsDefinitionBean getPorts() throws ComponentException {
+ if (ports == null)
+ ports = getPortsDefinition(getVersion().getImplementation());
+ return ports;
+ }
+
+ public ExceptionHandling getExceptionHandling() {
+ return eh;
+ }
+
+ public void installConfiguration(Activity a) {
+ Configuration conf = a.createConfiguration(ACTIVITY_URI);
+ ObjectNode json = conf.getJsonAsObjectNode();
+ json.put(REGISTRY_BASE, getRegistryBase().toExternalForm());
+ json.put(FAMILY_NAME, getFamilyName());
+ json.put(COMPONENT_NAME, getComponentName());
+ json.put(COMPONENT_VERSION, getComponentVersion());
+ }
+
+ public static class ActivityPortsDefinitionBean {
+ public List<InputActivityPort> inputs = new ArrayList<>();
+ public List<OutputActivityPort> outputs = new ArrayList<>();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentConstants.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentConstants.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentConstants.java
new file mode 100644
index 0000000..baec10f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/ComponentConstants.java
@@ -0,0 +1,28 @@
+/*
+* 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 io.github.taverna_extras.component.ui;
+
+import static java.net.URI.create;
+
+import java.net.URI;
+
+public interface ComponentConstants {
+ URI ACTIVITY_URI = create("http://ns.taverna.org.uk/2010/activity/component");
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AbstractSemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
new file mode 100644
index 0000000..6cc48d0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AbstractSemanticAnnotationContextualView.java
@@ -0,0 +1,296 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NORTHWEST;
+import static java.lang.String.CASE_INSENSITIVE_ORDER;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createSemanticAnnotation;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.SwingWorker;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.common.Named;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * @author alanrw
+ */
+public abstract class AbstractSemanticAnnotationContextualView extends
+ ContextualView {
+ private static final long serialVersionUID = 3567849347002793442L;
+ private static final Logger logger = getLogger(SemanticAnnotationContextualView.class);
+
+ private final FileManager fileManager;
+
+ public AbstractSemanticAnnotationContextualView(FileManager fileManager,
+ boolean allowChange) {
+ super();
+ this.fileManager = fileManager;
+ this.allowChange = allowChange;
+ }
+
+ private final boolean allowChange;
+ private JPanel panel;
+ private AbstractNamed annotated;
+ private List<SemanticAnnotationProfile> semanticAnnotationProfiles;
+ private Model model;
+ private Resource subject;
+
+ private static Comparator<SemanticAnnotationProfile> comparator = new Comparator<SemanticAnnotationProfile>() {
+ @Override
+ public int compare(SemanticAnnotationProfile arg0,
+ SemanticAnnotationProfile arg1) {
+ String d0 = getDisplayName(arg0.getPredicate());
+ String d1 = getDisplayName(arg1.getPredicate());
+ return CASE_INSENSITIVE_ORDER.compare(d0, d1);
+ }
+ };
+
+ @Override
+ public JComponent getMainFrame() {
+ return panel;
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 510;
+ }
+
+ protected final void initialise() {
+ populateModel();
+ if (panel == null)
+ panel = new JPanel(new GridBagLayout());
+ else
+ panel.removeAll();
+ populatePanel(panel);
+ }
+
+ public void removeStatement(Statement statement) {
+ model.remove(statement);
+ // populatePanel(panel);
+ updateSemanticAnnotation();
+ }
+
+ public void addStatement(Statement statement) {
+ model.add(statement);
+ // populatePanel(panel);
+ updateSemanticAnnotation();
+ }
+
+ public void changeStatement(Statement origStatement, OntProperty predicate,
+ RDFNode node) {
+ if (predicate == null)
+ return;
+ model.remove(origStatement);
+ model.add(subject, predicate, node);
+ // populatePanel(panel);
+ updateSemanticAnnotation();
+ }
+
+ public void addStatement(OntProperty predicate, RDFNode node) {
+ if (predicate == null)
+ return;
+ model.add(subject, predicate, node);
+ // populatePanel(panel);
+ updateSemanticAnnotation();
+ }
+
+ @Override
+ public void refreshView() {
+ populatePanel(panel);
+ }
+
+ // public void addModel(Model model) {
+ // this.model.add(model);
+ // initialise();
+ // updateSemanticAnnotation();
+ // }
+
+ public void updateSemanticAnnotation() {
+ try {
+ createSemanticAnnotation(fileManager.getCurrentDataflow(),
+ annotated, model);
+ } catch (IOException e) {
+ logger.error("failed to add semantic annotation", e);
+ }
+ }
+
+ public void setAnnotated(Named annotated) {
+ this.annotated = (AbstractNamed) annotated;
+ }
+
+ public void setSemanticAnnotationProfiles(
+ List<SemanticAnnotationProfile> profiles) {
+ this.semanticAnnotationProfiles = profiles;
+ }
+
+ public Model getModel() {
+ return model;
+ }
+
+ private void populateModel() {
+ this.model = SemanticAnnotationUtils.populateModel(fileManager
+ .getCurrentDataflow());
+ this.subject = model.createResource(annotated.getURI().toASCIIString());
+ }
+
+ public Named getAnnotated() {
+ return annotated;
+ }
+
+ private void populatePanel(JPanel panel) {
+ panel.removeAll();
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.anchor = NORTHWEST;
+ gbc.fill = HORIZONTAL;
+ gbc.gridx = 0;
+ gbc.weightx = 1;
+ gbc.weighty = 0;
+ gbc.insets = new Insets(5, 5, 5, 5);
+ panel.add(new JLabel("Reading semantic annotations"), gbc);
+ revalidate();
+ initView();
+ new StatementsReader().execute();
+ }
+
+ private Set<Statement> listStatements(OntProperty predicate) {
+ if (predicate == null)
+ return Collections.emptySet();
+ return model.listStatements(subject, predicate, (RDFNode) null).toSet();
+ }
+
+ private void populateViewWithPredicates(GridBagConstraints gbc,
+ Map<SemanticAnnotationProfile, Set<Statement>> profileStatements,
+ Set<Statement> statements,
+ Set<SemanticAnnotationProfile> unresolvablePredicates) {
+ for (Entry<SemanticAnnotationProfile, Set<Statement>> entry : profileStatements
+ .entrySet()) {
+ panel.add(
+ new SemanticAnnotationPanel(this, entry.getKey(), entry
+ .getValue(), allowChange), gbc);
+ panel.add(new JSeparator(), gbc);
+ }
+ for (SemanticAnnotationProfile semanticAnnotationProfile : unresolvablePredicates) {
+ panel.add(
+ new UnresolveablePredicatePanel(semanticAnnotationProfile),
+ gbc);
+ panel.add(new JSeparator(), gbc);
+ }
+
+ if (semanticAnnotationProfiles.isEmpty())
+ panel.add(new JLabel("No annotations possible"), gbc);
+ for (Statement s : statements)
+ panel.add(new UnrecognizedStatementPanel(s), gbc);
+
+ gbc.weighty = 1;
+ panel.add(new JPanel(), gbc);
+ }
+
+ private class StatementsReader extends SwingWorker<Void, Object> {
+ private Map<SemanticAnnotationProfile, Set<Statement>> profileStatements = new TreeMap<>(
+ comparator);
+ private Set<Statement> statements;
+ private Set<SemanticAnnotationProfile> unresolvablePredicates = new HashSet<>();
+
+ @Override
+ protected Void doInBackground() throws Exception {
+ try {
+ parseStatements();
+ } catch (Exception e) {
+ logger.error("failed to parse annotation statements", e);
+ throw e;
+ }
+ return null;
+ }
+
+ private void parseStatements() {
+ statements = listStatements(null);
+ for (SemanticAnnotationProfile semanticAnnotationProfile : semanticAnnotationProfiles) {
+ OntProperty predicate = semanticAnnotationProfile
+ .getPredicate();
+ if (predicate == null) {
+ unresolvablePredicates.add(semanticAnnotationProfile);
+ continue;
+ }
+
+ Set<Statement> statementsWithPredicate = listStatements(predicate);
+ profileStatements.put(semanticAnnotationProfile,
+ statementsWithPredicate);
+ statements.removeAll(statementsWithPredicate);
+ }
+ }
+
+ @Override
+ protected void done() {
+ panel.removeAll();
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.anchor = NORTHWEST;
+ gbc.fill = HORIZONTAL;
+ gbc.gridx = 0;
+ gbc.weightx = 1;
+ gbc.weighty = 0;
+ gbc.insets = new Insets(5, 5, 5, 5);
+
+ try {
+ get();
+ populateViewWithPredicates(gbc, profileStatements, statements,
+ unresolvablePredicates);
+ } catch (ExecutionException | InterruptedException e) {
+ logger.error(e);
+ panel.add(new JLabel("Unable to read semantic annotations"),
+ gbc);
+ }
+
+ revalidate();
+ initView();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotateSemanticsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotateSemanticsMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotateSemanticsMenuAction.java
new file mode 100644
index 0000000..1543533
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotateSemanticsMenuAction.java
@@ -0,0 +1,117 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.FlowLayout.TRAILING;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author alanrw
+ */
+public class AnnotateSemanticsMenuAction extends AbstractContextualMenuAction {
+ private static final String ANNOTATE_SEMANTICS = "Annotate semantics...";
+ private static final URI configureSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/configure");
+ private FileManager fileManager;
+ private ComponentFactory factory;
+
+ public AnnotateSemanticsMenuAction() {
+ super(configureSection, 45);
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fileManager = fm;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ Object selection = getContextualSelection().getSelection();
+ Object dataflowSource = fileManager.getDataflowSource(fileManager
+ .getCurrentDataflow());
+ if (dataflowSource instanceof Version.ID)
+ return (selection instanceof AbstractNamed)
+ && !(selection instanceof Activity || selection instanceof ActivityPort);
+ return false;
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ return new AbstractAction(ANNOTATE_SEMANTICS) {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showAnnotateSemanticsPanel();
+ }
+ };
+ }
+
+ private void showAnnotateSemanticsPanel() {
+ SemanticAnnotationContextualView view = new SemanticAnnotationContextualView(
+ fileManager, factory, (AbstractNamed) getContextualSelection()
+ .getSelection());
+
+ final JDialog dialog = new JDialog((Frame) null, "Annotate semantics");
+ dialog.setLayout(new BorderLayout());
+ dialog.add(new JScrollPane(view), CENTER);
+
+ JPanel buttonPanel = new JPanel(new FlowLayout(TRAILING));
+ buttonPanel.add(new DeselectingButton("OK", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ dialog.setVisible(false);
+ }
+ }));
+
+ dialog.add(buttonPanel, SOUTH);
+ dialog.setSize(new Dimension(400, 300));
+ dialog.setLocationRelativeTo(null);
+ dialog.setModal(true);
+ dialog.setVisible(true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotationPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotationPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotationPropertyPanelFactory.java
new file mode 100644
index 0000000..0dfaf0a
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/AnnotationPropertyPanelFactory.java
@@ -0,0 +1,73 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.annotation;
+
+import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
+import static java.lang.Integer.MIN_VALUE;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ *
+ *
+ * @author Alan Williams
+ */
+public class AnnotationPropertyPanelFactory extends PropertyPanelFactorySPI {
+ @Override
+ public JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return getDefaultInputComponent(semanticAnnotationProfile, statement);
+ }
+
+ @Override
+ public RDFNode getNewTargetNode(Statement originalStatement,
+ JComponent component) {
+ String newText = ((JTextArea) component).getText();
+ if ((originalStatement == null)
+ || !getObjectName(originalStatement).equals(newText))
+ return createTypedLiteral(newText);
+ return null;
+ }
+
+ @Override
+ public int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ OntProperty property = semanticAnnotationProfile.getPredicate();
+ if ((property != null) && property.isAnnotationProperty())
+ return 100;
+ return MIN_VALUE;
+ }
+
+ @Override
+ public JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DatatypePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DatatypePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DatatypePropertyPanelFactory.java
new file mode 100644
index 0000000..bd7ebcc
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DatatypePropertyPanelFactory.java
@@ -0,0 +1,76 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
+import static java.lang.Integer.MIN_VALUE;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ * @author Alan Williams
+ */
+public class DatatypePropertyPanelFactory extends PropertyPanelFactorySPI {
+ public DatatypePropertyPanelFactory() {
+ super();
+ }
+
+ @Override
+ public JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return getDefaultInputComponent(semanticAnnotationProfile, statement);
+ }
+
+ @Override
+ public RDFNode getNewTargetNode(Statement originalStatement,
+ JComponent component) {
+ JTextArea inputText = (JTextArea) component;
+ String newText = inputText.getText();
+ if ((originalStatement == null)
+ || !getObjectName(originalStatement).equals(newText))
+ return createTypedLiteral(newText);
+ return null;
+ }
+
+ @Override
+ public int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ OntProperty property = semanticAnnotationProfile.getPredicate();
+ if ((property != null) && property.isDatatypeProperty())
+ return 100;
+ return MIN_VALUE;
+ }
+
+ @Override
+ public JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DateTimePropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DateTimePropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DateTimePropertyPanelFactory.java
new file mode 100644
index 0000000..e9dbda7
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/DateTimePropertyPanelFactory.java
@@ -0,0 +1,136 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static org.apache.jena.datatypes.xsd.XSDDatatype.XSDdateTime;
+import static org.apache.jena.rdf.model.ResourceFactory.createTypedLiteral;
+import static java.lang.Integer.MIN_VALUE;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.swing.JComponent;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerDateModel;
+import javax.swing.text.DefaultCaret;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.datatypes.xsd.XSDDateTime;
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ *
+ *
+ * @author Alan Williams
+ */
+public class DateTimePropertyPanelFactory extends PropertyPanelFactorySPI {
+
+ private static String DateTimeString = XSDdateTime.getURI();
+
+ public DateTimePropertyPanelFactory() {
+ super();
+ }
+
+ @Override
+ public JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ Date now = new Date();
+ SpinnerDateModel dateModel = new SpinnerDateModel(now, null, now,
+ Calendar.DAY_OF_MONTH);
+ JSpinner s = new JSpinner(dateModel);
+ JSpinner.DateEditor de = new JSpinner.DateEditor(s,
+ "yyyy-MM-dd-HH-mm-ss");
+
+ /*
+ * Suggested hack from
+ * http://www.coderanch.com/t/345684/GUI/java/JSpinner-DateEditor-Set-default-focus
+ */
+
+ de.getTextField().setCaret(new DefaultCaret() {
+ private static final long serialVersionUID = 6779256780590610172L;
+ private boolean diverted = false;
+
+ @Override
+ public void setDot(int dot) {
+ diverted = (dot == 0);
+ if (diverted)
+ dot = getComponent().getDocument().getLength();
+ super.setDot(dot);
+ }
+
+ @Override
+ public void moveDot(int dot) {
+ if (diverted) {
+ super.setDot(0);
+ diverted = false;
+ }
+ super.moveDot(dot);
+ }
+ });
+ s.setEditor(de);
+ if (statement != null) {
+ Object o = statement.getObject().asLiteral().getValue();
+ if (o instanceof XSDDateTime)
+ dateModel.setValue(((XSDDateTime) o).asCalendar().getTime());
+ }
+ return s;
+ }
+
+ @Override
+ public RDFNode getNewTargetNode(Statement originalStatement,
+ JComponent component) {
+ JSpinner spinner = (JSpinner) component;
+ Date d = (Date) spinner.getValue();
+ if ((originalStatement == null)
+ || !originalStatement.getObject().asLiteral().getValue()
+ .equals(d)) {
+ Calendar cal = GregorianCalendar.getInstance();
+ cal.setTime(d);
+ return createTypedLiteral(cal);
+ }
+ return null;
+ }
+
+ @Override
+ public int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ OntProperty property = semanticAnnotationProfile.getPredicate();
+ if ((property != null) && property.isDatatypeProperty()
+ && DateTimeString.equals(semanticAnnotationProfile
+ .getClassString()))
+ return 200;
+ return MIN_VALUE;
+ }
+
+ @Override
+ public JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ JComponent result = getInputComponent(semanticAnnotationProfile,
+ statement);
+ result.setEnabled(false);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/FallbackPropertyPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/FallbackPropertyPanelFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/FallbackPropertyPanelFactory.java
new file mode 100644
index 0000000..efc3b42
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/FallbackPropertyPanelFactory.java
@@ -0,0 +1,60 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ * @author alanrw
+ */
+public class FallbackPropertyPanelFactory extends PropertyPanelFactorySPI {
+ @Override
+ public JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return new JLabel("Unable to handle "
+ + semanticAnnotationProfile.getPredicateString());
+ }
+
+ @Override
+ public RDFNode getNewTargetNode(Statement originalStatement,
+ JComponent component) {
+ return null;
+ }
+
+ @Override
+ public int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ return 0;
+ }
+
+ @Override
+ public JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return getDefaultDisplayComponent(semanticAnnotationProfile, statement);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/GreyBorder.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/GreyBorder.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/GreyBorder.java
new file mode 100644
index 0000000..d5e4fbe
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/GreyBorder.java
@@ -0,0 +1,36 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+
+import javax.swing.border.AbstractBorder;
+
+@SuppressWarnings("serial")
+class GreyBorder extends AbstractBorder {
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height) {
+ g.setColor(Color.GRAY);
+ g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
new file mode 100644
index 0000000..fefe5c0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/ObjectPropertyWithIndividualsPanelFactory.java
@@ -0,0 +1,196 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.FlowLayout.RIGHT;
+import static java.awt.GridBagConstraints.EAST;
+import static java.awt.GridBagConstraints.NORTHWEST;
+import static java.lang.Integer.MIN_VALUE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showInputDialog;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.localworld.LocalWorld;
+
+import org.apache.jena.ontology.Individual;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+/**
+ * @author David Withers
+ * @author Alan Williams
+ */
+public class ObjectPropertyWithIndividualsPanelFactory extends
+ PropertyPanelFactorySPI {
+ /*
+ * TODO Consider what sort of sharing model is appropriate for the local
+ * world
+ */
+ private static LocalWorld localWorld = LocalWorld.getInstance();
+
+ @Override
+ public int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ OntProperty property = semanticAnnotationProfile.getPredicate();
+ if ((property != null) && property.isObjectProperty()
+ /*
+ * && !semanticAnnotationProfile.getIndividuals().isEmpty()
+ */)
+ return 100;
+ return MIN_VALUE;
+ }
+
+ @Override
+ public JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ return new ComboBoxWithAdd(semanticAnnotationProfile, statement);
+ }
+
+ @Override
+ public RDFNode getNewTargetNode(Statement originalStatement,
+ JComponent component) {
+ ComboBoxWithAdd panel = (ComboBoxWithAdd) component;
+ RDFNode newNode = panel.getSelectedItem();
+ if ((originalStatement == null)
+ || !originalStatement.getObject().equals(newNode))
+ return newNode;
+ return null;
+ }
+
+
+ private static class ComboBoxWithAdd extends JPanel {
+ private static final long serialVersionUID = -9156213096428945270L;
+ private static DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
+ OntClass rangeClass = null;
+ JComboBox<Individual> resources;
+
+ public ComboBoxWithAdd(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ super(new GridBagLayout());
+
+ rangeClass = semanticAnnotationProfile.getRangeClass();
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.anchor = NORTHWEST;
+ List<Individual> individuals = semanticAnnotationProfile
+ .getIndividuals();
+ if (rangeClass != null)
+ individuals
+ .addAll(localWorld.getIndividualsOfClass(rangeClass));
+
+ resources = new JComboBox<Individual>(new Vector<>(individuals));
+ resources.setRenderer(new ListCellRenderer<Individual>() {
+ @Override
+ public Component getListCellRendererComponent(
+ JList<? extends Individual> list, Individual value,
+ int index, boolean isSelected, boolean cellHasFocus) {
+ return defaultRenderer.getListCellRendererComponent(list,
+ getDisplayName(value), index, isSelected,
+ cellHasFocus);
+ }
+ });
+ resources.setEditable(false);
+ if (statement != null) {
+ Object origResource = statement.getObject();
+ if (origResource != null)
+ resources.setSelectedItem(origResource);
+ }
+ this.add(resources, gbc);
+
+ gbc.gridy++;
+
+ JPanel buttonPanel = new JPanel(new FlowLayout(RIGHT));
+ buttonPanel.add(new DeselectingButton("Add external",
+ new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ addExternal();
+ }
+ }));
+ buttonPanel.add(new DeselectingButton("Add local",
+ new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ addLocal();
+ }
+ }));
+ gbc.anchor = EAST;
+ this.add(buttonPanel, gbc);
+ }
+
+ private void addExternal() {
+ String answer = showInputDialog("Please enter the URL for the resource");
+ resources.addItem(localWorld.createIndividual(answer, rangeClass));
+ }
+
+ private void addLocal() {
+ TurtleInputPanel turtlePanel = new TurtleInputPanel(rangeClass);
+ if (showConfirmDialog(null, turtlePanel, "Turtle input",
+ OK_CANCEL_OPTION, QUESTION_MESSAGE) == OK_OPTION) {
+ OntModel addedModel = turtlePanel.getContentAsModel();
+ for (Individual i : addedModel.listIndividuals(rangeClass)
+ .toList())
+ resources.addItem(i);
+ localWorld.addModelFromString(turtlePanel.getContentAsString());
+ }
+ }
+
+ public RDFNode getSelectedItem() {
+ return (RDFNode) resources.getSelectedItem();
+ }
+ }
+
+ @Override
+ public JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ JComponent result = getDefaultDisplayComponent(
+ semanticAnnotationProfile, statement);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/PropertyPanelFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/PropertyPanelFactorySPI.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/PropertyPanelFactorySPI.java
new file mode 100644
index 0000000..2b8dd7d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/PropertyPanelFactorySPI.java
@@ -0,0 +1,82 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.Color.WHITE;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ * @author David Withers
+ */
+public abstract class PropertyPanelFactorySPI {
+ public abstract JComponent getInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement);
+
+ /**
+ * Returns null if the target node is the same as the original statement
+ *
+ * @param origStatement
+ * @param inputComponent
+ * @return
+ */
+ public abstract RDFNode getNewTargetNode(Statement origStatement,
+ JComponent inputComponent);
+
+ public abstract int getRatingForSemanticAnnotation(
+ SemanticAnnotationProfile semanticAnnotationProfile);
+
+ public abstract JComponent getDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement);
+
+ public static JComponent getDefaultInputComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ JTextArea inputText = new JTextArea(20, 80);
+ if (statement != null)
+ inputText.setText(getObjectName(statement));
+ inputText.setLineWrap(true);
+ inputText.setWrapStyleWord(true);
+ return inputText;
+ }
+
+ public static JComponent getDefaultDisplayComponent(
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Statement statement) {
+ JTextArea value = new JTextArea(getObjectName(statement));
+ value.setLineWrap(true);
+ value.setWrapStyleWord(true);
+ value.setEditable(false);
+ value.setBackground(WHITE);
+ value.setOpaque(true);
+ value.setBorder(new EmptyBorder(2, 4, 2, 4));
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualView.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualView.java
new file mode 100644
index 0000000..4aa2b4e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualView.java
@@ -0,0 +1,144 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.lang.String.format;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * @author David Withers
+ */
+public class SemanticAnnotationContextualView extends
+ AbstractSemanticAnnotationContextualView {
+ private static final long serialVersionUID = -322165507536778154L;
+ public static final String VIEW_TITLE = "Semantic Annotations";
+ private static Logger logger = getLogger(SemanticAnnotationContextualView.class);
+
+ private final FileManager fileManager;
+ private final ComponentFactory factory;
+
+ public SemanticAnnotationContextualView(FileManager fileManager,
+ ComponentFactory factory, AbstractNamed selection) {
+ super(fileManager, true);
+ this.fileManager = fileManager;
+ this.factory = factory;
+ super.setAnnotated(selection);
+ List<SemanticAnnotationProfile> profiles = new ArrayList<>();
+ try {
+ Profile componentProfile = getComponentProfile();
+ if (componentProfile != null) {
+ if (selection instanceof Workflow
+ || selection instanceof WorkflowBundle)
+ profiles = componentProfile.getSemanticAnnotations();
+ else if (selection instanceof InputWorkflowPort)
+ profiles = componentProfile
+ .getInputSemanticAnnotationProfiles();
+ else if (selection instanceof OutputWorkflowPort)
+ profiles = componentProfile
+ .getOutputSemanticAnnotationProfiles();
+ else if (selection instanceof Processor)
+ profiles = componentProfile
+ .getActivitySemanticAnnotationProfiles();
+ }
+ } catch (ComponentException e) {
+ logger.error("failed to look up semantic annotations", e);
+ }
+ super.setSemanticAnnotationProfiles(profiles);
+ super.initialise();
+ }
+
+ private Profile getComponentProfile() {
+ Object dataflowSource = fileManager.getDataflowSource(fileManager
+ .getCurrentDataflow());
+ if (dataflowSource instanceof Version.ID) {
+ Version.ID identification = (Version.ID) dataflowSource;
+ try {
+ Registry componentRegistry = factory.getRegistry(identification
+ .getRegistryBase());
+ Family componentFamily = componentRegistry
+ .getComponentFamily(identification.getFamilyName());
+ return componentFamily.getComponentProfile();
+ } catch (ComponentException e) {
+ logger.warn(
+ format("No component profile found for component family %s at component registry %s",
+ identification.getFamilyName(),
+ identification.getRegistryBase()), e);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return VIEW_TITLE;
+ }
+
+/*
+ public static void main(String[] args) throws Exception {
+ JFrame frame = new JFrame();
+ frame.setSize(400, 200);
+ ComponentVersionIdentification identification = new ComponentVersionIdentification(
+ new URL("http://sandbox.myexperiment.org"),
+ "SCAPE Migration Action Components", "Image To Tiff", 2);
+ Dataflow dataflow = fileManager.openDataflow(new ComponentFileType(),
+ identification);
+
+ Processor processor = edits.createProcessor("processor");
+ try {
+ editManager.doDataflowEdit(dataflow,
+ edits.getAddProcessorEdit(dataflow, processor));
+ } catch (EditException e) {
+ e.printStackTrace();
+ }
+ final SemanticAnnotationContextualView view = new SemanticAnnotationContextualView(
+ processor);
+ editManager.addObserver(new Observer<EditManager.EditManagerEvent>() {
+ @Override
+ public void notify(Observable<EditManagerEvent> arg0,
+ EditManagerEvent arg1) throws Exception {
+ view.refreshView();
+ view.repaint();
+ }
+ });
+ frame.add(view);
+ frame.setVisible(true);
+ }
+*/
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualViewFactory.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
new file mode 100644
index 0000000..8ec838f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationContextualViewFactory.java
@@ -0,0 +1,67 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+/**
+ * @author David Withers
+ */
+public class SemanticAnnotationContextualViewFactory implements
+ ContextualViewFactory<AbstractNamed> {
+ private FileManager fileManager;
+ private ComponentFactory factory;
+
+ private WorkflowBundle bundle;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fileManager = fm;
+ }
+
+ @Override
+ public boolean canHandle(Object selection) {
+ bundle = fileManager.getCurrentDataflow();
+ return fileManager.getDataflowSource(bundle) instanceof Version.ID
+ && selection instanceof AbstractNamed
+ && !(selection instanceof Activity || selection instanceof ActivityPort);
+ }
+
+ @Override
+ public List<ContextualView> getViews(AbstractNamed selection) {
+ return Arrays.asList(new SemanticAnnotationContextualView(fileManager,
+ factory, selection), new TurtleContextualView(selection, bundle));
+ }
+}
[26/27] incubator-taverna-plugin-component git commit: package rename
folders
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationPanel.java
new file mode 100644
index 0000000..536a87d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationPanel.java
@@ -0,0 +1,271 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.Color.WHITE;
+import static java.awt.Font.BOLD;
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.EAST;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.SOUTHEAST;
+import static java.lang.Integer.MIN_VALUE;
+import static java.lang.String.format;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.taverna.lang.ui.DeselectingButton;
+
+public class SemanticAnnotationPanel extends JPanel {
+ private static final long serialVersionUID = -5949183295606132775L;
+
+ private List<PropertyPanelFactorySPI> propertyPanelFactories; //FIXME beaninject
+ private final AbstractSemanticAnnotationContextualView semanticAnnotationContextualView;
+ private final SemanticAnnotationProfile semanticAnnotationProfile;
+ private final Set<Statement> statements;
+ private final boolean allowChange;
+ private final PropertyPanelFactorySPI bestFactory;
+
+ public SemanticAnnotationPanel(
+ AbstractSemanticAnnotationContextualView semanticAnnotationContextualView,
+ SemanticAnnotationProfile semanticAnnotationProfile,
+ Set<Statement> statements, boolean allowChange) {
+ this.semanticAnnotationContextualView = semanticAnnotationContextualView;
+ this.semanticAnnotationProfile = semanticAnnotationProfile;
+ this.statements = statements;
+ this.allowChange = allowChange;
+ this.bestFactory = findBestPanelFactory();
+ initialise();
+ }
+
+ private void initialise() {
+ setLayout(new GridBagLayout());
+ // setBorder(new AbstractBorder() {
+ // @Override
+ // public void paintBorder(Component c, Graphics g, int x, int y, int
+ // width, int height) {
+ // g.setColor(Color.GRAY);
+ // g.drawLine(x, y+height-1, x+width-1, y+height-1);
+ // }
+ // });
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = SOUTHEAST;
+ c.fill = BOTH;
+ c.weightx = 1;
+ c.gridx = 0;
+
+ OntProperty predicate = semanticAnnotationProfile.getPredicate();
+ c.gridwidth = 3;
+ JLabel label = new JLabel(format("Annotation type : %s",
+ getDisplayName(predicate)));
+ label.setBorder(new EmptyBorder(5, 5, 5, 5));
+ label.setBackground(WHITE);
+ label.setOpaque(true);
+ add(label, c);
+
+ c.insets = new Insets(7, 0, 0, 0);
+ c.anchor = EAST;
+ c.fill = HORIZONTAL;
+ if (statements.isEmpty()) {
+ c.gridwidth = 2;
+ // c.weightx = 1;
+ // c.gridy++;
+ add(new JLabel("No semantic annotations"), c);
+ } else {
+ c.gridwidth = 1;
+ for (Statement statement : statements) {
+ c.gridx = 0;
+ c.weightx = 1;
+ if (bestFactory != null) {
+ add(bestFactory.getDisplayComponent(
+ semanticAnnotationProfile, statement), c);
+ } else {
+ JTextArea value = new JTextArea(getObjectName(statement));
+ value.setLineWrap(true);
+ value.setWrapStyleWord(true);
+ value.setEditable(false);
+ value.setBackground(WHITE);
+ value.setOpaque(true);
+ value.setBorder(new EmptyBorder(2, 4, 2, 4));
+ add(value, c);
+ }
+ if (allowChange) {
+ c.gridx = 1;
+ c.weightx = 0;
+ add(createChangeButton(statement), c);
+
+ c.gridx = 2;
+ add(createDeleteButton(statement), c);
+ }
+ }
+ }
+
+ if (allowChange
+ && !enoughAlready(statements,
+ semanticAnnotationProfile.getMaxOccurs())) {
+ c.gridx = 0;
+ c.gridwidth = 3;
+ c.anchor = SOUTHEAST;
+ c.fill = NONE;
+ add(createAddButton(), c);
+ }
+ }
+
+ private boolean enoughAlready(Set<Statement> statements, Integer maxOccurs) {
+ return (maxOccurs != null) && (statements.size() >= maxOccurs);
+ }
+
+ private JButton createChangeButton(final Statement statement) {
+ return new DeselectingButton("Change", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ addOrChangeAnnotation(statement);
+ }
+ });
+ }
+
+ private JButton createDeleteButton(final Statement statement) {
+ return new DeselectingButton("Delete", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ semanticAnnotationContextualView.removeStatement(statement);
+ }
+ });
+ }
+
+ private JButton createAddButton() {
+ return new DeselectingButton("Add Annotation", new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ addOrChangeAnnotation(null);
+ }
+ });
+ }
+
+ private void addOrChangeAnnotation(Statement statement) {
+ JPanel annotationPanel = null;
+ JComponent inputComponent = null;
+
+ if (bestFactory != null) {
+ inputComponent = bestFactory.getInputComponent(
+ semanticAnnotationProfile, statement);
+ annotationPanel = getPropertyPanel(
+ getDisplayName(semanticAnnotationProfile.getPredicate()),
+ inputComponent);
+ }
+
+ if (annotationPanel == null) {
+ showMessageDialog(null, format("Unable to handle %s",
+ semanticAnnotationProfile.getPredicateString()),
+ "Annotation problem", ERROR_MESSAGE);
+ return;
+ }
+
+ int answer = showConfirmDialog(null, annotationPanel,
+ "Add/change annotation", OK_CANCEL_OPTION);
+ if (answer == OK_OPTION) {
+ RDFNode response = bestFactory.getNewTargetNode(statement,
+ inputComponent);
+ if (response == null)
+ return;
+ if (statement != null)
+ semanticAnnotationContextualView.changeStatement(statement,
+ semanticAnnotationProfile.getPredicate(), response);
+ else
+ semanticAnnotationContextualView.addStatement(
+ semanticAnnotationProfile.getPredicate(), response);
+ }
+ }
+
+ private PropertyPanelFactorySPI findBestPanelFactory() {
+ PropertyPanelFactorySPI result = null;
+ int currentRating = MIN_VALUE;
+ for (PropertyPanelFactorySPI factory : propertyPanelFactories) {
+ int ratingForSemanticAnnotation = factory
+ .getRatingForSemanticAnnotation(semanticAnnotationProfile);
+ if (ratingForSemanticAnnotation > currentRating) {
+ currentRating = ratingForSemanticAnnotation;
+ result = factory;
+ }
+ }
+ return result;
+ }
+
+ public static JPanel getPropertyPanel(String displayName,
+ Component inputComponent) {
+ JPanel result = new JPanel();
+ result.setLayout(new BorderLayout());
+ JPanel messagePanel = new JPanel(new BorderLayout());
+ messagePanel.setBorder(new EmptyBorder(5, 5, 0, 0));
+ messagePanel.setBackground(WHITE);
+ result.add(messagePanel, NORTH);
+
+ JLabel inputLabel = new JLabel("Enter a value for the annotation");
+ inputLabel.setBackground(WHITE);
+ Font baseFont = inputLabel.getFont();
+ inputLabel.setFont(baseFont.deriveFont(BOLD));
+ messagePanel.add(inputLabel, NORTH);
+
+ JTextArea messageText = new JTextArea(format(
+ "Enter a value for the annotation '%s'", displayName));
+ messageText.setMargin(new Insets(5, 10, 10, 10));
+ messageText.setMinimumSize(new Dimension(0, 30));
+ messageText.setFont(baseFont.deriveFont(11f));
+ messageText.setEditable(false);
+ messageText.setFocusable(false);
+ messagePanel.add(messageText, CENTER);
+
+ result.add(new JScrollPane(inputComponent), CENTER);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationUtils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationUtils.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationUtils.java
new file mode 100644
index 0000000..68050c0
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/SemanticAnnotationUtils.java
@@ -0,0 +1,190 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static org.apache.jena.rdf.model.ModelFactory.createDefaultModel;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+import org.apache.jena.ontology.OntProperty;
+import org.apache.jena.ontology.OntResource;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ * @author David Withers
+ */
+public class SemanticAnnotationUtils {
+ protected static final String ENCODING = "TURTLE";
+ /* Pretend-base for making relative URIs */
+ private static String BASE = "widget://4aa8c93c-3212-487c-a505-3e337adf54a3/";
+ private static Logger logger = getLogger(SemanticAnnotationUtils.class);
+
+ public static String getObjectName(Statement statement) {
+ return getDisplayName(statement.getObject());
+ }
+
+ public static String getDisplayName(RDFNode node) {
+ if (node == null)
+ return "unknown";
+ else if (node.isAnon())
+ return "anon";
+ else if (node.isLiteral())
+ return node.asLiteral().getLexicalForm();
+ else if (node.isResource()) {
+ Resource resource = node.asResource();
+ if (resource instanceof OntResource) {
+ String label = ((OntResource) resource).getLabel(null);
+ if (label != null)
+ return label;
+ }
+ String localName = resource.getLocalName();
+ if ((localName != null) && !localName.isEmpty())
+ return localName;
+ return resource.toString();
+ } else
+ return "unknown";
+ }
+
+ public static Annotation findSemanticAnnotation(AbstractNamed annotated) {
+ for (Annotation annotation : annotated.getAnnotations())
+ return annotation;
+ return null;
+ }
+
+ public static String getStrippedAnnotationContent(Annotation annotation)
+ throws IOException {
+ AbstractNamed target = (AbstractNamed) annotation.getTarget();
+ return annotation.getRDFContent().replace(
+ target.getRelativeURI(annotation).toASCIIString(), BASE);
+ }
+
+ public static Annotation createSemanticAnnotation(WorkflowBundle bundle,
+ AbstractNamed target, Model model) throws IOException {
+ Calendar now = new GregorianCalendar();
+ Annotation annotation = new Annotation();
+ annotation.setParent(bundle);
+ String path = annotation.getResourcePath();
+ annotation.setTarget(target);
+ // annotation.setAnnotatedBy(annotatedBy);
+ annotation.setAnnotatedAt(now);
+ // annotation.setSerializedBy(serializedBy);
+ annotation.setSerializedAt(now);
+ bundle.getResources().addResource(
+ "@base<" + target.getRelativeURI(annotation).toASCIIString()
+ + "> .\n" + createTurtle(model), path, "text/rdf+n3");
+ return annotation;
+ }
+
+ /**
+ * @param model
+ * @return
+ */
+ public static String createTurtle(Model model) {
+ StringWriter stringWriter = new StringWriter();
+ model.write(stringWriter, ENCODING, BASE);
+ // Workaround for https://issues.apache.org/jira/browse/JENA-132
+ return stringWriter.toString().replace(BASE, "");
+ }
+
+ public static Model populateModel(WorkflowBundle annotated) {
+ Model result = createDefaultModel();
+ try {
+ for (Annotation a : annotated.getAnnotations())
+ populateModelFromString(result, a.getRDFContent());
+ } catch (Exception e) {
+ logger.error("failed to construct semantic annotation model", e);
+ }
+ return result;
+ }
+
+ public static void populateModel(Model result, Annotation annotation)
+ throws IOException {
+ AbstractNamed target = (AbstractNamed) annotation.getTarget();
+ String content = annotation.getRDFContent().replace(
+ target.getRelativeURI(annotation).toASCIIString(), BASE);
+ populateModelFromString(result, content);
+ }
+
+ public static void populateModelFromString(Model result, String content) {
+ result.read(new StringReader(content), BASE, ENCODING);
+ }
+
+ public static Resource createBaseResource(Model model) {
+ return model.createResource(BASE);
+ }
+
+ /**
+ * Check if a profile is satisfied by a component.
+ *
+ * @param bundle
+ * The component definition.
+ * @param componentProfile
+ * The profile definition.
+ * @return The set of failed constraints. If empty, the profile is satisfied
+ * by the component.
+ */
+ public static Set<SemanticAnnotationProfile> checkComponent(
+ WorkflowBundle bundle, Profile componentProfile) {
+ // TODO Check port presence by name
+ Set<SemanticAnnotationProfile> problemProfiles = new HashSet<>();
+ Model model = populateModel(bundle);
+ Set<Statement> statements = model.listStatements().toSet();
+ try {
+ for (SemanticAnnotationProfile saProfile : componentProfile
+ .getSemanticAnnotations()) {
+ OntProperty predicate = saProfile.getPredicate();
+ if (predicate == null)
+ continue;
+ int count = 0;
+ for (Statement statement : statements)
+ if (statement.getPredicate().equals(predicate))
+ count++;
+ if (count < saProfile.getMinOccurs())
+ problemProfiles.add(saProfile);
+ if (saProfile.getMaxOccurs() != null
+ && count > saProfile.getMaxOccurs())
+ // The UI should prevent this, but check anyway
+ problemProfiles.add(saProfile);
+ }
+ } catch (ComponentException e) {
+ logger.error("failed to look up profiles for semantic annotations", e);
+ }
+ return problemProfiles;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleContextualView.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleContextualView.java
new file mode 100644
index 0000000..8489fe6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleContextualView.java
@@ -0,0 +1,93 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.awt.BorderLayout.CENTER;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.findSemanticAnnotation;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getStrippedAnnotationContent;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.awt.BorderLayout;
+import java.io.IOException;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+
+import org.slf4j.Logger;
+
+import org.apache.taverna.scufl2.api.annotation.Annotation;
+import org.apache.taverna.scufl2.api.common.AbstractNamed;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * @author alanrw
+ */
+public class TurtleContextualView extends ContextualView {
+ private static final long serialVersionUID = -3401885589263647202L;
+ private static final Logger log = getLogger(TurtleContextualView.class);
+ private JPanel panel;
+ private String annotationContent = "";
+
+ public TurtleContextualView(AbstractNamed selection, WorkflowBundle bundle) {
+ Annotation annotation = findSemanticAnnotation(selection);
+ try {
+ if (annotation != null)
+ annotationContent = getStrippedAnnotationContent(annotation);
+ } catch (IOException e) {
+ log.info("failed to read semantic annotation; using empty string", e);
+ }
+ initialise();
+ initView();
+ }
+
+ @Override
+ public JComponent getMainFrame() {
+ return panel;
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ return 512;
+ }
+
+ @Override
+ public String getViewTitle() {
+ return "Turtle representation";
+ }
+
+ @Override
+ public void refreshView() {
+ initialise();
+ }
+
+ protected final void initialise() {
+ if (panel == null)
+ panel = new JPanel(new BorderLayout());
+ else
+ panel.removeAll();
+ JTextArea textArea = new JTextArea(20, 80);
+ textArea.setEditable(false);
+ textArea.setText(annotationContent);
+ panel.add(textArea, CENTER);
+ revalidate();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleInputPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleInputPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleInputPanel.java
new file mode 100644
index 0000000..7356cc9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/TurtleInputPanel.java
@@ -0,0 +1,105 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.EAST;
+import static java.awt.BorderLayout.SOUTH;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import org.apache.jena.ontology.Individual;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.lang.ui.ReadOnlyTextArea;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class TurtleInputPanel extends JPanel {
+ JTextArea turtleTextArea = new JTextArea(30, 80);
+ ReadOnlyTextArea errors = new ReadOnlyTextArea(1, 80);
+ private OntClass clazz;
+
+ public TurtleInputPanel(OntClass clazz) {
+ super(new BorderLayout());
+ this.clazz = clazz;
+
+ add(new JScrollPane(turtleTextArea), CENTER);
+
+ turtleTextArea.setText("<#changeme> a <" + clazz.getURI() + ">\n\n\n.");
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BorderLayout());
+ JButton validateButton = new DeselectingButton(new AbstractAction(
+ "Validate") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ getContentAsModel();
+ }
+ });
+ buttonPanel.add(errors, CENTER);
+ errors.setOpaque(false);
+ buttonPanel.add(validateButton, EAST);
+ add(buttonPanel, SOUTH);
+ }
+
+ public OntModel getContentAsModel() {
+ OntModel result = createOntologyModel();
+ try {
+ populateModelFromString(result, getContentAsString());
+
+ // Check it is not still called changeme
+ List<Individual> individuals = result.listIndividuals(clazz)
+ .toList();
+ if (individuals.isEmpty()) {
+ errors.setText("No valid individuals");
+ return null;
+ }
+ for (Individual i : individuals)
+ if (i.getURI().endsWith("changeme")) {
+ errors.setText("Name has not been changed");
+ return null;
+ }
+
+ errors.setText("No errors found");
+ return result;
+ } catch (Throwable ex) { // syntax error?
+ errors.setText(ex.getMessage());
+ return null;
+ }
+ }
+
+ public String getContentAsString() {
+ return turtleTextArea.getText();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnrecognizedStatementPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnrecognizedStatementPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnrecognizedStatementPanel.java
new file mode 100644
index 0000000..67d806d
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnrecognizedStatementPanel.java
@@ -0,0 +1,43 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.lang.String.format;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.jena.rdf.model.Statement;
+
+/**
+ * @author alanrw
+ *
+ */
+@SuppressWarnings("serial")
+public class UnrecognizedStatementPanel extends JPanel {
+ public UnrecognizedStatementPanel(Statement statement) {
+ setLayout(new BorderLayout());
+ setBorder(new GreyBorder());
+ add(new JLabel(format("Unable to find %s in the profile",
+ statement.getPredicate())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnresolveablePredicatePanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnresolveablePredicatePanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnresolveablePredicatePanel.java
new file mode 100644
index 0000000..a7e2c89
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/annotation/UnresolveablePredicatePanel.java
@@ -0,0 +1,43 @@
+/*
+* 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 io.github.taverna_extras.component.ui.annotation;
+
+import static java.lang.String.format;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public class UnresolveablePredicatePanel extends JPanel {
+ public UnresolveablePredicatePanel(
+ SemanticAnnotationProfile semanticAnnotationProfile) {
+ setLayout(new BorderLayout());
+ setBorder(new GreyBorder());
+ add(new JLabel(format("Unable to resolve %s in the ontology",
+ semanticAnnotationProfile.getPredicateString())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigurationPanel.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigurationPanel.java
new file mode 100644
index 0000000..712b861
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigurationPanel.java
@@ -0,0 +1,171 @@
+/*
+* 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 io.github.taverna_extras.component.ui.config;
+
+import static java.awt.event.ItemEvent.SELECTED;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.util.Utils.SHORT_STRING;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.util.SortedMap;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.ComponentListCellRenderer;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+
+@SuppressWarnings("serial")
+public class ComponentConfigurationPanel extends ActivityConfigurationPanel {
+ private static Logger logger = getLogger(ComponentConfigurationPanel.class);
+
+ private ComponentFactory factory;//FIXME beaninject
+ private ServiceRegistry sr;
+
+ private final JComboBox<Object> componentVersionChoice = new JComboBox<>();
+
+ public ComponentConfigurationPanel(Activity activity,
+ ComponentFactory factory, ServiceRegistry serviceRegistry) {
+ super(activity);
+ sr = serviceRegistry;
+ this.factory = factory;
+ componentVersionChoice.setPrototypeDisplayValue(SHORT_STRING);
+ initGui();
+ }
+
+ private Version getSelectedVersion() {
+ return (Version) componentVersionChoice.getSelectedItem();
+ }
+ private URI getRegistryBase() {
+ return URI.create(getProperty(REGISTRY_BASE));
+ }
+ private String getFamilyName() {
+ return getProperty(FAMILY_NAME);
+ }
+ private String getComponentName() {
+ return getProperty(COMPONENT_NAME);
+ }
+ private Integer getComponentVersion() {
+ return Integer.parseInt(getProperty(COMPONENT_VERSION));
+ }
+
+ protected void initGui() {
+ removeAll();
+ setLayout(new GridLayout(0, 2));
+
+ componentVersionChoice.setRenderer(new ComponentListCellRenderer<>());
+ componentVersionChoice.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent event) {
+ if (event.getStateChange() == SELECTED)
+ updateToolTipText();
+ }
+ });
+ updateComponentVersionChoice();
+
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.insets = new Insets(0, 5, 0, 5);
+ gbc.gridx = 0;
+ gbc.anchor = GridBagConstraints.WEST;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ gbc.gridy = 2;
+ this.add(new JLabel("Component version:"), gbc);
+ gbc.gridx = 1;
+ gbc.weightx = 1;
+ this.add(componentVersionChoice, gbc);
+
+ // Populate fields from activity configuration bean
+ refreshConfiguration();
+ }
+
+ /**
+ * Check that user values in UI are valid
+ */
+ @Override
+ public boolean checkValues() {
+ return true;
+ }
+
+ /**
+ * Check if the user has changed the configuration from the original
+ */
+ @Override
+ public boolean isConfigurationChanged() {
+ return !getSelectedVersion().getVersionNumber().equals(
+ getComponentVersion());
+ }
+
+ /**
+ * Prepare a new configuration bean from the UI, to be returned with
+ * getConfiguration()
+ */
+ @Override
+ public void noteConfiguration() {
+ setProperty(COMPONENT_VERSION, getSelectedVersion().getVersionNumber()
+ .toString());
+ //FIXME is this right at all???
+ configureInputPorts(sr);
+ configureOutputPorts(sr);
+ }
+
+ private void updateComponentVersionChoice() {
+ Component component;
+ componentVersionChoice.removeAllItems();
+ componentVersionChoice.setToolTipText(null);
+ try {
+ component = factory.getComponent(getRegistryBase().toURL(),
+ getFamilyName(), getComponentName());
+ } catch (ComponentException | MalformedURLException e) {
+ logger.error("failed to get component", e);
+ return;
+ }
+ SortedMap<Integer, Version> componentVersionMap = component
+ .getComponentVersionMap();
+ for (Version v : componentVersionMap.values())
+ componentVersionChoice.addItem(v);
+ componentVersionChoice.setSelectedItem(componentVersionMap
+ .get(getComponentVersion()));
+ updateToolTipText();
+ }
+
+ private void updateToolTipText() {
+ Version selectedVersion = (Version) componentVersionChoice
+ .getSelectedItem();
+ componentVersionChoice.setToolTipText(selectedVersion.getDescription());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigureAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigureAction.java
new file mode 100644
index 0000000..81c9d2f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/config/ComponentConfigureAction.java
@@ -0,0 +1,69 @@
+/*
+* 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 io.github.taverna_extras.component.ui.config;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+
+@SuppressWarnings("serial")
+public class ComponentConfigureAction extends ActivityConfigurationAction {
+ private EditManager editManager;
+ private FileManager fileManager;
+ private ServiceRegistry serviceRegistry;
+ private ComponentFactory factory;
+
+ public ComponentConfigureAction(Activity activity, Frame owner,
+ ComponentFactory factory, ActivityIconManager activityIconManager,
+ ServiceDescriptionRegistry serviceDescriptionRegistry,
+ EditManager editManager, FileManager fileManager,
+ ServiceRegistry serviceRegistry) {
+ super(activity, activityIconManager, serviceDescriptionRegistry);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ this.serviceRegistry = serviceRegistry;
+ this.factory = factory;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ActivityConfigurationDialog currentDialog = getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+
+ ComponentConfigurationPanel configView = new ComponentConfigurationPanel(
+ activity, factory, serviceRegistry);
+ ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(
+ getActivity(), configView, editManager);
+ setDialog(getActivity(), dialog, fileManager);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthCheckExplainer.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthCheckExplainer.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthCheckExplainer.java
new file mode 100644
index 0000000..7a2442f
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthCheckExplainer.java
@@ -0,0 +1,91 @@
+/*
+* 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 io.github.taverna_extras.component.ui.file;
+
+import static java.util.Collections.sort;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.JComponent;
+import javax.swing.JTextArea;
+
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
+import org.apache.taverna.visit.VisitKind;
+import org.apache.taverna.visit.VisitReport;
+
+//import net.sf.taverna.t2.workbench.report.explainer.VisitExplainer;
+
+/**
+ * @author alanrw
+ */
+public class ComponentDataflowHealthCheckExplainer implements VisitExplainer {
+ private static final Comparator<SemanticAnnotationProfile> comparator = new Comparator<SemanticAnnotationProfile>() {
+ @Override
+ public int compare(SemanticAnnotationProfile a,
+ SemanticAnnotationProfile b) {
+ return getDisplayName(a.getPredicate()).compareTo(
+ getDisplayName(b.getPredicate()));
+ }
+ };
+
+ @Override
+ public boolean canExplain(VisitKind vk, int resultId) {
+ return vk instanceof ComponentHealthCheck
+ && resultId == FAILS_PROFILE;
+ }
+
+ @Override
+ public JComponent getExplanation(VisitReport vr) {
+ @SuppressWarnings("unchecked")
+ Set<SemanticAnnotationProfile> problemProfiles = (Set<SemanticAnnotationProfile>) vr
+ .getProperty("problemProfiles");
+ List<SemanticAnnotationProfile> sortedList = new ArrayList<>(
+ problemProfiles);
+ sort(sortedList, comparator);
+ StringBuilder text = new StringBuilder();
+ for (SemanticAnnotationProfile profile : sortedList)
+ text.append(getSemanticProfileExplanation(profile)).append("\n");
+ return new JTextArea(text.toString());
+ }
+
+ @Override
+ public JComponent getSolution(VisitReport vr) {
+ return new JTextArea("Correct the semantic annotation");
+ }
+
+ private static String getSemanticProfileExplanation(
+ SemanticAnnotationProfile p) {
+ Integer minOccurs = p.getMinOccurs();
+ Integer maxOccurs = p.getMaxOccurs();
+ String displayName = getDisplayName(p.getPredicate());
+ if (maxOccurs == null)
+ return displayName + " must have at least " + minOccurs + " value";
+ if (minOccurs.equals(maxOccurs))
+ return displayName + " must have " + minOccurs + " value(s)";
+ return displayName + " must have between " + minOccurs + " and "
+ + maxOccurs + " value(s)";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthChecker.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthChecker.java
new file mode 100644
index 0000000..7ce0c1b
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentDataflowHealthChecker.java
@@ -0,0 +1,114 @@
+/*
+* 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 io.github.taverna_extras.component.ui.file;
+
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
+import static io.github.taverna_extras.component.ui.util.ComponentHealthCheck.FAILS_PROFILE;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.util.ComponentHealthCheck;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.visit.VisitReport;
+import static org.apache.taverna.visit.VisitReport.Status.SEVERE;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workflowmodel.Dataflow;
+import org.apache.taverna.workflowmodel.health.HealthChecker;
+
+/**
+ * @author alanrw
+ */
+public class ComponentDataflowHealthChecker implements HealthChecker<Dataflow> {
+ private static final String PROFILE_UNSATISFIED_MSG = "Workflow does not satisfy component profile";
+ private static Logger logger = getLogger(ComponentDataflowHealthChecker.class);
+
+ private FileManager fm;
+ private ComponentHealthCheck visitType = ComponentHealthCheck.getInstance(); //FIXME beaninject?
+ private ComponentFactory factory;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ private Version.ID getSource(Object o) {
+ return (Version.ID) fm.getDataflowSource((WorkflowBundle) o);
+ }
+
+ public void checkProfileSatisfied(WorkflowBundle bundle) {
+ //FIXME
+ }
+ @Override
+ public boolean canVisit(Object o) {
+ try {
+ return getSource(o) != null;
+ } catch (IllegalArgumentException e) {
+ // Not open?
+ } catch (ClassCastException e) {
+ // Not dataflow? Not component?
+ }
+ return false;
+ }
+
+ @Override
+ public VisitReport visit(WorkflowBundle dataflow, List<Object> ancestry) {
+ try {
+ Version.ID ident = getSource(dataflow);
+ Family family = factory.getFamily(ident.getRegistryBase(),
+ ident.getFamilyName());
+
+ Set<SemanticAnnotationProfile> problemProfiles = checkComponent(
+ dataflow, family.getComponentProfile());
+ if (problemProfiles.isEmpty())
+ return null;
+
+ VisitReport visitReport = new VisitReport(visitType, dataflow,
+ PROFILE_UNSATISFIED_MSG, FAILS_PROFILE, SEVERE);
+ visitReport.setProperty("problemProfiles", problemProfiles);
+ return visitReport;
+ } catch (ComponentException e) {
+ logger.error(
+ "failed to comprehend profile while checking for match", e);
+ return null;
+ }
+ }
+//
+// @Override
+// public VisitReport visit(Dataflow o, List<Object> ancestry) {
+// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+// }
+//
+// @Override
+// public boolean isTimeConsuming() {
+// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentOpener.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentOpener.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentOpener.java
new file mode 100644
index 0000000..f2e16e6
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentOpener.java
@@ -0,0 +1,88 @@
+/*
+* 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 io.github.taverna_extras.component.ui.file;
+
+import static org.apache.log4j.Logger.getLogger;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+
+/**
+ * @author alanrw
+ */
+public class ComponentOpener extends AbstractDataflowPersistenceHandler
+ implements DataflowPersistenceHandler {
+ private static Logger logger = getLogger(ComponentOpener.class);
+
+ private ComponentFactory factory;
+ private FileType fileType;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileType(FileType fileType) {
+ this.fileType = fileType;
+ }
+
+ @Override
+ public DataflowInfo openDataflow(FileType fileType, Object source)
+ throws OpenException {
+ if (!getOpenFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+ if (!(source instanceof Version.ID))
+ throw new IllegalArgumentException("Unsupported source type "
+ + source.getClass().getName());
+
+ WorkflowBundle d;
+ try {
+ d = factory.getVersion((ID) source).getImplementation();
+ } catch (ComponentException e) {
+ logger.error("Unable to read dataflow", e);
+ throw new OpenException("Unable to read dataflow", e);
+ }
+ return new DataflowInfo(fileType, source, d, new Date());
+ }
+
+ @Override
+ public List<FileType> getOpenFileTypes() {
+ return Arrays.<FileType> asList(fileType);
+ }
+
+ @Override
+ public List<Class<?>> getOpenSourceTypes() {
+ return Arrays.<Class<?>> asList(Version.ID.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentSaver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentSaver.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentSaver.java
new file mode 100644
index 0000000..19b52d9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/ComponentSaver.java
@@ -0,0 +1,185 @@
+/*
+* 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 io.github.taverna_extras.component.ui.file;
+
+import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
+import static javax.swing.JOptionPane.OK_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.checkComponent;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import org.apache.log4j.Logger;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.validation.ValidationReport;
+import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+
+/**
+ * @author alanrw
+ */
+public class ComponentSaver extends AbstractDataflowPersistenceHandler
+ implements DataflowPersistenceHandler {
+ private static final String UNSATISFIED_PROFILE_WARNING = "The component does not satisfy the profile.\n"
+ + "See validation report.\nDo you still want to save?";
+ private static final Logger logger = getLogger(ComponentSaver.class);
+
+ private ComponentFactory factory;
+ private ComponentServiceProvider provider;
+ private FileType cft;
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ public void setFileType(FileType fileType) {
+ this.cft = fileType;
+ }
+
+ public void setServiceProvider(ComponentServiceProvider provider) {
+ this.provider = provider;
+ }
+
+ @Override
+ public DataflowInfo saveDataflow(WorkflowBundle bundle, FileType fileType,
+ Object destination) throws SaveException {
+ if (!getSaveFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+ if (!(destination instanceof Version.ID))
+ throw new IllegalArgumentException("Unsupported destination type "
+ + destination.getClass().getName());
+
+ ValidationReport structuralValidity = new StructuralValidator()
+ .validate(bundle);
+ if (structuralValidity.detectedProblems())
+ throw new SaveException(
+ "Cannot save a structurally invalid workflow as a component",
+ structuralValidity.getException());
+
+ /*
+ * Saving an invalid dataflow is OK. Validity check is done to get
+ * predicted depth for output (if possible)
+ */
+
+ Version.ID ident = (Version.ID) destination;
+
+ if (ident.getComponentVersion() == -1) {
+ Version.ID newIdent = new Version.Identifier(
+ ident.getRegistryBase(), ident.getFamilyName(),
+ ident.getComponentName(), 0);
+ return new DataflowInfo(cft, newIdent, bundle);
+ }
+
+ Family family;
+ try {
+ Registry registry = factory.getRegistry(ident.getRegistryBase());
+ family = registry.getComponentFamily(ident.getFamilyName());
+ } catch (ComponentException e) {
+ throw new SaveException("Unable to read component", e);
+ }
+
+ Version newVersion = null;
+ try {
+ List<SemanticAnnotationProfile> problemProfiles = new ArrayList<>(
+ checkComponent(bundle, family.getComponentProfile()));
+
+ if (!problemProfiles.isEmpty()) {
+ int answer = showConfirmDialog(null,
+ UNSATISFIED_PROFILE_WARNING, "Profile problem",
+ OK_CANCEL_OPTION);
+ if (answer != OK_OPTION)
+ throw new SaveException("Saving cancelled");
+ }
+
+ JTextArea descriptionArea = new JTextArea(10, 60);
+ descriptionArea.setLineWrap(true);
+ descriptionArea.setWrapStyleWord(true);
+ final JScrollPane descriptionScrollPane = new JScrollPane(
+ descriptionArea);
+ if (ident.getComponentVersion() == 0) {
+ int answer = showConfirmDialog(null, descriptionScrollPane,
+ "Component description", OK_CANCEL_OPTION);
+ if (answer != OK_OPTION)
+ throw new SaveException("Saving cancelled");
+ newVersion = family.createComponentBasedOn(
+ ident.getComponentName(), descriptionArea.getText(),
+ bundle);
+ } else {
+ Component component = family.getComponent(ident
+ .getComponentName());
+ int answer = showConfirmDialog(null, descriptionScrollPane,
+ "Version description", OK_CANCEL_OPTION);
+ if (answer != OK_OPTION)
+ throw new SaveException("Saving cancelled");
+ newVersion = component.addVersionBasedOn(bundle,
+ descriptionArea.getText());
+ }
+ } catch (ComponentException e) {
+ logger.error("Unable to save new version of component", e);
+ throw new SaveException("Unable to save new version of component",
+ e);
+ }
+
+ Version.ID newIdent = new Version.Identifier(ident.getRegistryBase(),
+ ident.getFamilyName(), ident.getComponentName(),
+ newVersion.getVersionNumber());
+ provider.refreshProvidedComponent(ident);
+ return new DataflowInfo(cft, newIdent, bundle);
+ }
+
+ @Override
+ public List<FileType> getSaveFileTypes() {
+ return Arrays.<FileType> asList(cft);
+ }
+
+ @Override
+ public List<Class<?>> getSaveDestinationTypes() {
+ return Arrays.<Class<?>> asList(Version.ID.class);
+ }
+
+ @Override
+ public boolean wouldOverwriteDataflow(WorkflowBundle dataflow,
+ FileType fileType, Object destination, DataflowInfo lastDataflowInfo) {
+ if (!getSaveFileTypes().contains(fileType))
+ throw new IllegalArgumentException("Unsupported file type "
+ + fileType);
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/FileManagerObserver.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/FileManagerObserver.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/FileManagerObserver.java
new file mode 100644
index 0000000..8ee99b9
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/file/FileManagerObserver.java
@@ -0,0 +1,146 @@
+/*
+* 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 io.github.taverna_extras.component.ui.file;
+
+import static java.awt.Color.WHITE;
+import static java.awt.Font.BOLD;
+import static javax.swing.SwingUtilities.invokeLater;
+import static javax.swing.SwingUtilities.isEventDispatchThread;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+import javax.swing.border.Border;
+
+import org.apache.batik.swing.JSVGCanvas;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.util.Utils;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.workbench.StartupSPI;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
+import org.apache.taverna.workbench.views.graph.GraphViewComponent;
+
+public class FileManagerObserver implements StartupSPI {
+ private static final Color COLOR = new Color(230, 147, 210);
+
+ private FileManager fileManager;
+ private ColourManager colours;
+ private GraphViewComponent graphView;
+ private Utils utils;
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setColourManager(ColourManager colours) {
+ this.colours = colours;
+ }
+
+ public void setGraphView(GraphViewComponent graphView) {
+ this.graphView = graphView;
+ }
+
+ public void setUtils(Utils utils) {
+ this.utils = utils;
+ }
+
+ @Override
+ public boolean startup() {
+ colours.setPreferredColour(
+ "io.github.taverna_extras.component.registry.Component", COLOR);
+ colours.setPreferredColour(
+ "io.github.taverna_extras.component.ComponentActivity", COLOR);
+ fileManager.addObserver(new Observer<FileManagerEvent>() {
+ @Override
+ public void notify(Observable<FileManagerEvent> observable,
+ FileManagerEvent event) throws Exception {
+ FileManagerObserverRunnable runnable = new FileManagerObserverRunnable();
+ if (isEventDispatchThread())
+ runnable.run();
+ else
+ invokeLater(runnable);
+ }
+ });
+ return true;
+ }
+
+ @Override
+ public int positionHint() {
+ return 200;
+ }
+
+ public class FileManagerObserverRunnable implements Runnable {
+ @Override
+ public void run() {
+ WorkflowBundle currentDataflow = fileManager.getCurrentDataflow();
+ if (currentDataflow == null)
+ return;
+ SVGGraphController graphController = (SVGGraphController) graphView
+ .getGraphController(currentDataflow.getMainWorkflow());
+ if (graphController == null)
+ return;
+ JSVGCanvas svgCanvas = graphController.getSVGCanvas();
+ Object dataflowSource = fileManager
+ .getDataflowSource(currentDataflow);
+ if (utils.currentDataflowIsComponent())
+ svgCanvas.setBorder(new ComponentBorder(
+ (Version.ID) dataflowSource));
+ else
+ svgCanvas.setBorder(null);
+ svgCanvas.repaint();
+ }
+ }
+
+ static class ComponentBorder implements Border {
+ private final Insets insets = new Insets(25, 0, 0, 0);
+ private final String text;
+
+ public ComponentBorder(Version.ID identification) {
+ text = "Component : " + identification.getComponentName();
+ }
+
+ @Override
+ public Insets getBorderInsets(java.awt.Component c) {
+ return insets;
+ }
+
+ @Override
+ public boolean isBorderOpaque() {
+ return true;
+ }
+
+ @Override
+ public void paintBorder(java.awt.Component c, Graphics g, int x, int y,
+ int width, int height) {
+ g.setColor(COLOR);
+ g.fillRect(x, y, width, 20);
+ g.setFont(g.getFont().deriveFont(BOLD));
+ g.setColor(WHITE);
+ g.drawString(text, x + 5, y + 15);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/localworld/LocalWorld.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/localworld/LocalWorld.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/localworld/LocalWorld.java
new file mode 100644
index 0000000..a35ab61
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/localworld/LocalWorld.java
@@ -0,0 +1,107 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.localworld;
+
+import static org.apache.jena.rdf.model.ModelFactory.createOntologyModel;
+import static org.apache.log4j.Logger.getLogger;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.createTurtle;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.populateModelFromString;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.apache.jena.ontology.Individual;
+import org.apache.jena.ontology.OntClass;
+import org.apache.jena.ontology.OntModel;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * @author alanrw
+ */
+public class LocalWorld {
+ private static final String FILENAME = "localWorld.ttl";
+ private static final Logger logger = getLogger(LocalWorld.class);
+ protected static final String ENCODING = "TURTLE";
+ private static LocalWorld instance = null;
+
+ private OntModel model;
+
+ public synchronized static LocalWorld getInstance() {
+ if (instance == null)
+ instance = new LocalWorld();
+ return instance;
+ }
+
+ private LocalWorld() {
+ File modelFile = new File(calculateComponentsDirectory(), FILENAME);
+ model = createOntologyModel();
+ if (modelFile.exists())
+ try (Reader in = new InputStreamReader(new FileInputStream(
+ modelFile), "UTF-8")) {
+ model.read(in, null, ENCODING);
+ } catch (IOException e) {
+ logger.error("failed to construct local annotation world", e);
+ }
+ }
+
+ ApplicationConfiguration config;//FIXME beaninject
+
+ public File calculateComponentsDirectory() {
+ return new File(config.getApplicationHomeDir(), "components");
+ }
+
+ public Individual createIndividual(String urlString, OntClass rangeClass) {
+ try {
+ return model.createIndividual(urlString, rangeClass);
+ } finally {
+ saveModel();
+ }
+ }
+
+ private void saveModel() {
+ File modelFile = new File(calculateComponentsDirectory(), FILENAME);
+ try (OutputStream out = new FileOutputStream(modelFile)) {
+ out.write(createTurtle(model).getBytes("UTF-8"));
+ } catch (IOException e) {
+ logger.error("failed to save local annotation world", e);
+ }
+ }
+
+ public List<Individual> getIndividualsOfClass(Resource clazz) {
+ return model.listIndividuals(clazz).toList();
+ }
+
+ public void addModelFromString(String addedModel) {
+ try {
+ populateModelFromString(model, addedModel);
+ } finally {
+ saveModel();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/AbstractContextComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/AbstractContextComponentMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/AbstractContextComponentMenuAction.java
new file mode 100644
index 0000000..0911a66
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/AbstractContextComponentMenuAction.java
@@ -0,0 +1,58 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import java.net.URI;
+
+import io.github.taverna_extras.component.api.config.ComponentConfig;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+
+public abstract class AbstractContextComponentMenuAction extends AbstractContextualMenuAction {
+ public AbstractContextComponentMenuAction(URI parentId, int positionHint) {
+ super(parentId, positionHint);
+ }
+
+ public AbstractContextComponentMenuAction(URI parentId, int positionHint, URI id) {
+ super(parentId, positionHint, id);
+ }
+
+ protected boolean isComponentActivity(Activity act) {
+ if (act == null)
+ return false;
+ return act.getType().equals(ComponentConfig.URI);
+ }
+
+ protected Activity findActivity() {
+ if (getContextualSelection() == null)
+ return null;
+ Object selection = getContextualSelection().getSelection();
+ if (selection instanceof Processor) {
+ Processor processor = (Processor) selection;
+ return processor.getParent().getParent().getMainProfile()
+ .getProcessorBindings().getByName(processor.getName())
+ .getBoundActivity();
+ } else if (selection instanceof Activity)
+ return (Activity) selection;
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentConfigureMenuAction.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentConfigureMenuAction.java
new file mode 100644
index 0000000..0feb63e
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentConfigureMenuAction.java
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package io.github.taverna_extras.component.ui.menu;
+
+import static javax.swing.Action.NAME;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
+
+import javax.swing.Action;
+
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.services.ServiceRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+public class ComponentConfigureMenuAction extends
+ AbstractConfigureActivityMenuAction {
+ public ComponentConfigureMenuAction() {
+ super(ACTIVITY_URI);
+ }
+
+ private ActivityIconManager aim;
+ private ServiceDescriptionRegistry sdr;
+ private EditManager em;
+ private FileManager fm;
+ private ServiceRegistry str;
+ private ComponentFactory factory;
+
+ public void setActivityIconManager(ActivityIconManager aim) {
+ this.aim = aim;
+ }
+
+ public void setServiceDescriptionRegistry(ServiceDescriptionRegistry sdr) {
+ this.sdr = sdr;
+ }
+
+ public void setEditManager(EditManager em) {
+ this.em = em;
+ }
+
+ public void setFileManager(FileManager fm) {
+ this.fm = fm;
+ }
+
+ public void setServiceTypeRegistry(ServiceRegistry str) {
+ this.str = str;
+ }
+
+ public void setComponentFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ @Override
+ protected Action createAction() {
+ Action result = new ComponentConfigureAction(findActivity(),
+ getParentFrame(), factory, aim, sdr, em, fm, str);
+ result.putValue(NAME, "Configure component");
+ addMenuDots(result);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentMenu.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentMenu.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentMenu.java
new file mode 100644
index 0000000..99cec65
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentMenu.java
@@ -0,0 +1,41 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenu;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+/**
+ * @author alanrw
+ */
+public class ComponentMenu extends AbstractMenu {
+ public static final URI COMPONENT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#component");
+ public static final String TITLE = "Components";
+
+ public ComponentMenu() {
+ super(DEFAULT_MENU_BAR, 950, COMPONENT, makeAction());
+ }
+
+ public static DummyAction makeAction() {
+ return new DummyAction(TITLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/b7b61e71/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentSection.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentSection.java b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentSection.java
new file mode 100644
index 0000000..337ee73
--- /dev/null
+++ b/taverna-component-activity-ui/src/main/java/io/github/taverna_extras/component/ui/menu/ComponentSection.java
@@ -0,0 +1,44 @@
+/*
+* 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 io.github.taverna_extras.component.ui.menu;
+
+import java.net.URI;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * @author alanrw
+ *
+ */
+public class ComponentSection extends AbstractMenuSection {
+ public static final String COMPONENT_SECTION = "Components";
+ public static final URI componentSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/components");
+ public static final URI editSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/edit");
+
+ public ComponentSection() {
+ super(editSection, 100, componentSection);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ }
+}
[04/27] incubator-taverna-plugin-component git commit: package name
-> io.github.taverna_extras.component.*
Posted by st...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
index 3cb5b37..b9ba05e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/LocalRegistryPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NONE;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
index 10e7a34..c3b5f04 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RegistryTableModel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import static java.lang.String.format;
@@ -27,7 +27,7 @@ import java.util.TreeMap;
import javax.swing.table.DefaultTableModel;
-import org.apache.taverna.component.api.Registry;
+import io.github.taverna_extras.component.api.Registry;
/**
* @author alanrw
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
index 7f9e692..1f98933 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/preference/RemoteRegistryPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.preference;
+package io.github.taverna_extras.component.ui.preference;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.NONE;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
index f7991c4..03b2eda 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceDesc.java
@@ -17,15 +17,15 @@
* under the License.
*/
-package org.apache.taverna.component.ui.serviceprovider;
+package io.github.taverna_extras.component.ui.serviceprovider;
import static java.util.Arrays.asList;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.taverna.component.ui.ComponentConstants.ACTIVITY_URI;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
import java.net.URI;
import java.net.URL;
@@ -35,11 +35,11 @@ import java.util.List;
import javax.swing.Icon;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.Version.ID;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.configurations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
index dcd999a..16e0d5f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceIcon.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.serviceprovider;
+package io.github.taverna_extras.component.ui.serviceprovider;
-import static org.apache.taverna.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
+import static io.github.taverna_extras.component.ui.serviceprovider.Service.COMPONENT_ACTIVITY_URI;
import java.net.URI;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
index c0d0d7c..d5350d0 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProvider.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.serviceprovider;
+package io.github.taverna_extras.component.ui.serviceprovider;
import static java.util.Arrays.asList;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.showConfirmDialog;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.taverna.component.ui.ComponentConstants.ACTIVITY_URI;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
import java.net.MalformedURLException;
import java.net.URI;
@@ -38,15 +38,15 @@ import java.util.SortedMap;
import javax.swing.Icon;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.panel.RegistryAndFamilyChooserPanel;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.util.Utils;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.panel.RegistryAndFamilyChooserPanel;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.util.Utils;
import org.apache.taverna.scufl2.api.common.Visitor;
import org.apache.taverna.scufl2.api.configurations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
index e7c050f..72b7458 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/ComponentServiceProviderConfig.java
@@ -17,16 +17,16 @@
* under the License.
*/
-package org.apache.taverna.component.ui.serviceprovider;
+package io.github.taverna_extras.component.ui.serviceprovider;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
-import static org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider.providerId;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider.providerId;
import java.net.URL;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.scufl2.api.configurations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
index 6aafa69..32c606e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/serviceprovider/Service.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.serviceprovider;
+package io.github.taverna_extras.component.ui.serviceprovider;
import java.net.URI;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
index 1f6b08d..ba4801e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentFileType.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.util;
+package io.github.taverna_extras.component.ui.util;
import org.apache.taverna.workbench.file.FileType;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
index 2a9573d..a3585f4 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/ComponentHealthCheck.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.util;
+package io.github.taverna_extras.component.ui.util;
import static org.apache.log4j.Logger.getLogger;
@@ -25,10 +25,10 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.common.Visitor;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
index 4a568e2..e81cbf6 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/util/Utils.java
@@ -17,18 +17,18 @@
* under the License.
*/
-package org.apache.taverna.component.ui.util;
+package io.github.taverna_extras.component.ui.util;
-import static org.apache.taverna.component.ui.ComponentConstants.ACTIVITY_URI;
+import static io.github.taverna_extras.component.ui.ComponentConstants.ACTIVITY_URI;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.preference.ComponentPreference;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon;
-import org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.preference.ComponentPreference;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon;
+import io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.common.Named;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
index b457807..c27278f 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivityContextViewFactory.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
-import static org.apache.taverna.component.api.config.ComponentConfig.URI;
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
import java.awt.Frame;
import java.net.MalformedURLException;
@@ -28,8 +28,8 @@ import java.util.List;
import javax.swing.Action;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.ui.config.ComponentConfigureAction;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.ui.config.ComponentConfigureAction;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
index 10359ed..fcb6e4a 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationContextViewFactory.java
@@ -17,21 +17,21 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentConfig.URI;
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.profile.Profile;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
-import org.apache.taverna.component.ui.annotation.AbstractSemanticAnnotationContextualView;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.profile.Profile;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.ui.annotation.AbstractSemanticAnnotationContextualView;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.core.Workflow;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
index bfb7f37..d3580a8 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentActivitySemanticAnnotationPanel.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
import static java.awt.Color.GRAY;
import static java.awt.Color.WHITE;
@@ -26,8 +26,8 @@ import static java.awt.GridBagConstraints.EAST;
import static java.awt.GridBagConstraints.HORIZONTAL;
import static java.awt.GridBagConstraints.SOUTHEAST;
import static java.lang.String.format;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
-import static org.apache.taverna.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getDisplayName;
+import static io.github.taverna_extras.component.ui.annotation.SemanticAnnotationUtils.getObjectName;
import java.awt.Component;
import java.awt.Graphics;
@@ -42,7 +42,7 @@ import javax.swing.JTextArea;
import javax.swing.border.AbstractBorder;
import javax.swing.border.EmptyBorder;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
import org.apache.jena.ontology.OntProperty;
import org.apache.jena.rdf.model.Statement;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
index d8bbc58..938a32e 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextViewFactory.java
@@ -17,14 +17,14 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
-import static org.apache.taverna.component.api.config.ComponentConfig.URI;
+import static io.github.taverna_extras.component.api.config.ComponentConfig.URI;
import java.util.Arrays;
import java.util.List;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.scufl2.api.activity.Activity;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
index 980e37c..c763d06 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ComponentContextualView.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
import static java.lang.String.format;
@@ -26,7 +26,7 @@ import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.lang.ui.HtmlUtils;
import org.apache.taverna.workbench.configuration.colour.ColourManager;
import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
@@ -58,7 +58,7 @@ public class ComponentContextualView extends ContextualView {
public String getBackgroundColour() {
Color colour = colourManager.getPreferredColour(
- "org.apache.taverna.component.registry.Component");
+ "io.github.taverna_extras.component.registry.Component");
return format("#%1$2x%2$2x%3$2x", colour.getRed(), colour.getGreen(),
colour.getBlue());
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
index bcdbacc..5764f6c 100644
--- a/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
+++ b/taverna-component-activity-ui/src/main/java/org/apache/taverna/component/ui/view/ViewUtil.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.taverna.component.ui.view;
+package io.github.taverna_extras.component.ui.view;
import static java.lang.String.format;
import static org.apache.log4j.Logger.getLogger;
@@ -27,11 +27,11 @@ import java.net.URL;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentFactory;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.ui.ComponentActivityConfigurationBean;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentFactory;
+import io.github.taverna_extras.component.api.Family;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.ui.ComponentActivityConfigurationBean;
import org.apache.taverna.scufl2.api.configurations.Configuration;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer b/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer
index 829fdbc..fa575d0 100644
--- a/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer
+++ b/taverna-component-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.report.explainer.VisitExplainer
@@ -1 +1 @@
-org.apache.taverna.component.ui.file.ComponentDataflowHealthCheckExplainer
+io.github.taverna_extras.component.ui.file.ComponentDataflowHealthCheckExplainer
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.component.ui.annotation.PropertyPanelFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.component.ui.annotation.PropertyPanelFactorySPI b/taverna-component-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.component.ui.annotation.PropertyPanelFactorySPI
index c025707..f26b07e 100644
--- a/taverna-component-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.component.ui.annotation.PropertyPanelFactorySPI
+++ b/taverna-component-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.component.ui.annotation.PropertyPanelFactorySPI
@@ -1,5 +1,5 @@
-org.apache.taverna.component.ui.annotation.AnnotationPropertyPanelFactory
-org.apache.taverna.component.ui.annotation.DatatypePropertyPanelFactory
-org.apache.taverna.component.ui.annotation.ObjectPropertyWithIndividualsPanelFactory
-org.apache.taverna.component.ui.annotation.DateTimePropertyPanelFactory
-org.apache.taverna.component.ui.annotation.FallbackPropertyPanelFactory
\ No newline at end of file
+io.github.taverna_extras.component.ui.annotation.AnnotationPropertyPanelFactory
+io.github.taverna_extras.component.ui.annotation.DatatypePropertyPanelFactory
+io.github.taverna_extras.component.ui.annotation.ObjectPropertyWithIndividualsPanelFactory
+io.github.taverna_extras.component.ui.annotation.DateTimePropertyPanelFactory
+io.github.taverna_extras.component.ui.annotation.FallbackPropertyPanelFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity-ui/src/main/resources/META-INF/spring/component-activity-context.xml
----------------------------------------------------------------------
diff --git a/taverna-component-activity-ui/src/main/resources/META-INF/spring/component-activity-context.xml b/taverna-component-activity-ui/src/main/resources/META-INF/spring/component-activity-context.xml
index d6d425d..8112bf5 100644
--- a/taverna-component-activity-ui/src/main/resources/META-INF/spring/component-activity-context.xml
+++ b/taverna-component-activity-ui/src/main/resources/META-INF/spring/component-activity-context.xml
@@ -46,16 +46,16 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/beans/spring-util.xsd">
<context:annotation-config />
- <bean id="prefs" class="org.apache.taverna.component.ui.preference.ComponentPreference">
+ <bean id="prefs" class="io.github.taverna_extras.component.ui.preference.ComponentPreference">
<constructor-arg name="cm" ref="configManager" />
<constructor-arg name="factory" ref="componentFactory" />
</bean>
- <bean id="preferencePanel" class="org.apache.taverna.component.ui.preference.ComponentPreferencePanel">
+ <bean id="preferencePanel" class="io.github.taverna_extras.component.ui.preference.ComponentPreferencePanel">
<constructor-arg name="componentFactory" ref="componentFactory" />
<constructor-arg name="preferences" ref="prefs" />
</bean>
<bean id="componentSupport"
- class="org.apache.taverna.component.ui.menu.component.ComponentCreatorSupport">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentCreatorSupport">
<property name="componentFactory" ref="componentFactory" />
<property name="preferences" ref="prefs" />
<property name="fileManager" ref="fileManager" />
@@ -63,9 +63,9 @@
<property name="fileType" ref="fileType" />
<property name="selectionManager" ref="selectionManager" />
</bean>
- <bean id="fileType" class="org.apache.taverna.component.ui.util.ComponentFileType" />
- <bean id="icon" class="org.apache.taverna.component.ui.serviceprovider.ComponentServiceIcon" />
- <bean id="utils" class="org.apache.taverna.component.ui.util.Utils">
+ <bean id="fileType" class="io.github.taverna_extras.component.ui.util.ComponentFileType" />
+ <bean id="icon" class="io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceIcon" />
+ <bean id="utils" class="io.github.taverna_extras.component.ui.util.Utils">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
@@ -79,7 +79,7 @@
<entry key="name" value="componentServiceProvider" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.serviceprovider.ComponentServiceProvider">
+ class="io.github.taverna_extras.component.ui.serviceprovider.ComponentServiceProvider">
<constructor-arg ref="componentFactory" index="0" />
<constructor-arg ref="prefs" index="1" />
<constructor-arg ref="icon" index="2" />
@@ -92,7 +92,7 @@
<!-- === Startup === -->
<osgi:service interface="net.sf.taverna.t2.workbench.StartupSPI">
- <bean class="org.apache.taverna.component.ui.file.FileManagerObserver">
+ <bean class="io.github.taverna_extras.component.ui.file.FileManagerObserver">
<property name="colourManager" ref="colourManager" />
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
@@ -102,13 +102,13 @@
<!-- === Dataflow persistence handlers === -->
<osgi:service interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler">
- <bean class="org.apache.taverna.component.ui.file.ComponentOpener">
+ <bean class="io.github.taverna_extras.component.ui.file.ComponentOpener">
<property name="componentFactory" ref="componentFactory" />
<property name="fileType" ref="fileType" />
</bean>
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler">
- <bean class="org.apache.taverna.component.ui.file.ComponentSaver">
+ <bean class="io.github.taverna_extras.component.ui.file.ComponentSaver">
<property name="componentFactory" ref="componentFactory" />
<property name="fileType" ref="fileType" />
</bean>
@@ -116,7 +116,7 @@
<!-- === Health checkers === -->
<osgi:service interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker">
- <bean class="org.apache.taverna.component.ui.file.ComponentDataflowHealthChecker">
+ <bean class="io.github.taverna_extras.component.ui.file.ComponentDataflowHealthChecker">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -128,7 +128,7 @@
<entry key="name" value="componentConfigurationUI" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.preference.ComponentPreferenceUIFactory">
+ class="io.github.taverna_extras.component.ui.preference.ComponentPreferenceUIFactory">
<property name="configPanel" ref="preferencePanel" />
<property name="preferences" ref="prefs" />
</bean>
@@ -141,7 +141,7 @@
<entry key="name" value="componentActivityContextView" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.view.ComponentActivityContextViewFactory">
+ class="io.github.taverna_extras.component.ui.view.ComponentActivityContextViewFactory">
<property name="colourManager" ref="colourManager" />
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -157,7 +157,7 @@
<osgi:service-properties>
<entry key="name" value="componentContextView" />
</osgi:service-properties>
- <bean class="org.apache.taverna.component.ui.view.ComponentContextViewFactory">
+ <bean class="io.github.taverna_extras.component.ui.view.ComponentContextViewFactory">
<property name="fileManager" ref="fileManager" />
</bean>
</osgi:service>
@@ -167,7 +167,7 @@
<entry key="name" value="componentActivitySemanticAnnotationContextView" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.view.ComponentActivitySemanticAnnotationContextViewFactory">
+ class="io.github.taverna_extras.component.ui.view.ComponentActivitySemanticAnnotationContextViewFactory">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -178,7 +178,7 @@
<entry key="name" value="semanticAnnotationContextView" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.annotation.SemanticAnnotationContextualViewFactory">
+ class="io.github.taverna_extras.component.ui.annotation.SemanticAnnotationContextualViewFactory">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -190,7 +190,7 @@
<entry key="name" value="componentConfigureAction" />
</osgi:service-properties>
<bean id="componentConfigureMenuAction"
- class="org.apache.taverna.component.ui.menu.ComponentConfigureMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.ComponentConfigureMenuAction">
<property name="activityIconManager" ref="iconManager" />
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -200,7 +200,7 @@
</bean>
</osgi:service>
<bean id="componentServiceCreatorMenuAction"
- class="org.apache.taverna.component.ui.menu.component.ComponentServiceCreatorMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentServiceCreatorMenuAction">
<description>Don't publish this bean yet.</description>
<property name="icon" ref="icon" />
<property name="selectionManager" ref="selectionManager" />
@@ -211,7 +211,7 @@
<entry key="name" value="nestedWorkflowCreatorAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.NestedWorkflowCreatorMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.NestedWorkflowCreatorMenuAction">
<property name="editManager" ref="editManager" />
<property name="graphView" ref="graphView" />
<property name="selectionManager" ref="selectionManager" />
@@ -222,7 +222,7 @@
<entry key="name" value="componentReplaceAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.ReplaceByComponentMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.ReplaceByComponentMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
<property name="icon" ref="icon" />
@@ -235,7 +235,7 @@
<entry key="name" value="componentOpenAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.OpenComponentFromComponentActivityMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.OpenComponentFromComponentActivityMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
@@ -245,19 +245,19 @@
</bean>
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
- <bean class="org.apache.taverna.component.ui.menu.ComponentMenu" />
+ <bean class="io.github.taverna_extras.component.ui.menu.ComponentMenu" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="org.apache.taverna.component.ui.menu.registry.ComponentRegistryMenuSection" />
+ class="io.github.taverna_extras.component.ui.menu.registry.ComponentRegistryMenuSection" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<osgi:service-properties>
<entry key="name" value="componentRegistryManageAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.registry.ComponentRegistryManageMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.registry.ComponentRegistryManageMenuAction">
<property name="configurationFrame"><!-- FIXME --></property>
<property name="icon" ref="icon" />
</bean>
@@ -265,14 +265,14 @@
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="org.apache.taverna.component.ui.menu.profile.ComponentProfileMenuSection" />
+ class="io.github.taverna_extras.component.ui.menu.profile.ComponentProfileMenuSection" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<osgi:service-properties>
<entry key="name" value="componentProfileImportAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.profile.ComponentProfileImportMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.profile.ComponentProfileImportMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -283,27 +283,27 @@
<entry key="name" value="componentProfileCopyAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.profile.ComponentProfileCopyMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.profile.ComponentProfileCopyMenuAction">
<property name="preferences" ref="prefs" />
<property name="icon" ref="icon" />
</bean>
</osgi:service>
<bean id="componentProfileDeleteMenuAction"
- class="org.apache.taverna.component.ui.menu.profile.ComponentProfileDeleteMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.profile.ComponentProfileDeleteMenuAction">
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
</bean>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="org.apache.taverna.component.ui.menu.family.ComponentFamilyMenuSection" />
+ class="io.github.taverna_extras.component.ui.menu.family.ComponentFamilyMenuSection" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<osgi:service-properties>
<entry key="name" value="componentFamilyCreateAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.family.ComponentFamilyCreateMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.family.ComponentFamilyCreateMenuAction">
<property name="preferences" ref="prefs" />
<property name="icon" ref="icon" />
</bean>
@@ -313,7 +313,7 @@
<entry key="name" value="componentFamilyDeleteAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.family.ComponentFamilyDeleteMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.family.ComponentFamilyDeleteMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -323,14 +323,14 @@
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentMenuSection" />
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentMenuSection" />
</osgi:service>
<osgi:service interface="net.sf.taverna.t2.ui.menu.MenuComponent">
<osgi:service-properties>
<entry key="name" value="componentCreateAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentWorkflowCreatorMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentWorkflowCreatorMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="graphView" ref="graphView" />
<property name="icon" ref="icon" />
@@ -343,7 +343,7 @@
<entry key="name" value="componentOpenAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.FileOpenFromComponentMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.FileOpenFromComponentMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="fileType" ref="fileType" />
<property name="graphView" ref="graphView" />
@@ -356,7 +356,7 @@
<entry key="name" value="componentCopyAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentCopyMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentCopyMenuAction">
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
<property name="utils" ref="utils" />
@@ -367,7 +367,7 @@
<entry key="name" value="componentDeleteAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentDeleteMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentDeleteMenuAction">
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
@@ -379,7 +379,7 @@
<entry key="name" value="componentMergeAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentMergeMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentMergeMenuAction">
<property name="icon" ref="icon" />
<property name="preferences" ref="prefs" />
</bean>
@@ -389,7 +389,7 @@
<entry key="name" value="componentCloseAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentCloseMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentCloseMenuAction">
<property name="closeWorkflowAction"><!-- FIXME net.sf.taverna.t2.workbench.file.impl.actions.CloseWorkflowAction --></property>
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
@@ -401,7 +401,7 @@
<entry key="name" value="componentSaveAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.menu.component.ComponentSaveMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentSaveMenuAction">
<property name="saveWorkflowAction"><!-- FIXME net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction --></property>
<property name="fileManager" ref="fileManager" />
<property name="icon" ref="icon" />
@@ -409,7 +409,7 @@
</bean>
</osgi:service>
<bean id="componentSearchMenuAction"
- class="org.apache.taverna.component.ui.menu.component.ComponentSearchMenuAction">
+ class="io.github.taverna_extras.component.ui.menu.component.ComponentSearchMenuAction">
<description>Don't publish this bean yet.</description>
<property name="componentFactory" ref="componentFactory" />
<property name="editManager" ref="editManager" />
@@ -425,7 +425,7 @@
<entry key="name" value="annotateSemanticsAction" />
</osgi:service-properties>
<bean
- class="org.apache.taverna.component.ui.annotation.AnnotateSemanticsMenuAction">
+ class="io.github.taverna_extras.component.ui.annotation.AnnotateSemanticsMenuAction">
<property name="componentFactory" ref="componentFactory" />
<property name="fileManager" ref="fileManager" />
</bean>
@@ -433,16 +433,16 @@
<!--
<bean id="ComponentLocalHealthChecker"
- class="org.apache.taverna.component.ComponentActivityLocalChecker" />
+ class="io.github.taverna_extras.component.ComponentActivityLocalChecker" />
<bean id="ComponentUpgradeHealthChecker"
- class="org.apache.taverna.component.ComponentActivityUpgradeChecker">
+ class="io.github.taverna_extras.component.ComponentActivityUpgradeChecker">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="baseProfileLocator" class="org.apache.taverna.component.profile.BaseProfileLocator">
+ <bean id="baseProfileLocator" class="io.github.taverna_extras.component.profile.BaseProfileLocator">
<property name="appConfig" ref="app-config" />
</bean>
- <bean id="componentActivityFactory" class="org.apache.taverna.component.ComponentActivityFactory">
+ <bean id="componentActivityFactory" class="io.github.taverna_extras.component.ComponentActivityFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="dataflowCache" ref="cache" />
<property name="edits" ref="edits" />
@@ -450,32 +450,32 @@
</bean>
<bean id="networkRegistry"
- class="org.apache.taverna.component.registry.standard.NewComponentRegistryFactory">
+ class="io.github.taverna_extras.component.registry.standard.NewComponentRegistryFactory">
<property name="credentialManager" ref="credentialManager" />
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
<property name="annotationUtils" ref="annotationUtil" />
</bean>
<bean id="fileRegistry"
- class="org.apache.taverna.component.registry.local.LocalComponentRegistryFactory">
+ class="io.github.taverna_extras.component.registry.local.LocalComponentRegistryFactory">
<property name="componentUtil" ref="componentUtil" />
<property name="systemUtils" ref="systemUtil" />
</bean>
- <bean id="componentUtil" class="org.apache.taverna.component.registry.ComponentUtil">
+ <bean id="componentUtil" class="io.github.taverna_extras.component.registry.ComponentUtil">
<property name="networkLocator" ref="networkRegistry" />
<property name="fileLocator" ref="fileRegistry" />
<property name="baseLocator" ref="baseProfileLocator" />
</bean>
- <bean id="cache" class="org.apache.taverna.component.registry.ComponentImplementationCache">
+ <bean id="cache" class="io.github.taverna_extras.component.registry.ComponentImplementationCache">
<property name="componentUtil" ref="componentUtil" />
</bean>
- <bean id="systemUtil" class="org.apache.taverna.component.utils.SystemUtils">
+ <bean id="systemUtil" class="io.github.taverna_extras.component.utils.SystemUtils">
<property name="appConfig" ref="app-config" />
<property name="workflowBundler" ref="workflowBundleIO" />
<property name="compilers" ref="compilers" />
</bean>
- <bean id="annotationUtil" class="org.apache.taverna.component.utils.AnnotationUtils" />
+ <bean id="annotationUtil" class="io.github.taverna_extras.component.utils.AnnotationUtils" />
<osgi:service ref="ComponentLocalHealthChecker"
interface="net.sf.taverna.t2.workflowmodel.health.HealthChecker" />
@@ -484,7 +484,7 @@
<osgi:service ref="componentActivityFactory"
interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" />
<osgi:service ref="componentUtil"
- interface="org.apache.taverna.component.api.ComponentFactory" />
+ interface="io.github.taverna_extras.component.api.ComponentFactory" />
<osgi:reference id="app-config"
interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
@@ -497,7 +497,7 @@
<osgi:reference id="iconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
<osgi:reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
- <osgi:reference id="componentFactory" interface="org.apache.taverna.component.api.ComponentFactory" />
+ <osgi:reference id="componentFactory" interface="io.github.taverna_extras.component.api.ComponentFactory" />
<osgi:reference id="configManager" interface="uk.org.taverna.configuration.ConfigurationManager" />
<osgi:reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
<osgi:reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
index d73e082..9619297 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivity.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,12 +24,12 @@ import java.net.MalformedURLException;
import java.util.Map;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-import org.apache.taverna.component.registry.ComponentImplementationCache;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.AnnotationUtils;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.taverna.activities.dataflow.DataflowActivity;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
index c882e41..6819b3f 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityConfigurationBean.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,10 +19,10 @@ package org.apache.taverna.component.activity;
*/
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.FAMILY_NAME;
-import static org.apache.taverna.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.COMPONENT_VERSION;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.FAMILY_NAME;
+import static io.github.taverna_extras.component.api.config.ComponentPropertyNames.REGISTRY_BASE;
import java.io.Serializable;
import java.net.MalformedURLException;
@@ -36,11 +36,11 @@ import java.util.List;
//import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-import org.apache.taverna.component.registry.ComponentImplementationCache;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.registry.ComponentVersionIdentification;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.registry.ComponentVersionIdentification;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
@@ -74,7 +74,7 @@ public class ComponentActivityConfigurationBean extends
this.cache = cache;
try {
getPorts();
- } catch (org.apache.taverna.component.api.ComponentException e) {
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
logger.error("failed to get component realization", e);
}
}
@@ -125,7 +125,7 @@ public class ComponentActivityConfigurationBean extends
.getComponentProfile().getExceptionHandling();
if (eh != null)
outputs.add(makeOutputDefinition(1, ERROR_CHANNEL));
- } catch (org.apache.taverna.component.api.ComponentException e) {
+ } catch (io.github.taverna_extras.component.api.ComponentException e) {
logger.error("failed to get exception handling for family", e);
}
return result;
@@ -156,7 +156,7 @@ public class ComponentActivityConfigurationBean extends
/**
* @return the ports
*/
- public ActivityPortsDefinitionBean getPorts() throws org.apache.taverna.component.api.ComponentException{
+ public ActivityPortsDefinitionBean getPorts() throws io.github.taverna_extras.component.api.ComponentException{
if (ports == null)
ports = getPortsDefinition(cache.getImplementation(this));
return ports;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
index 0ba4aa9..c90ea1a 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityFactory.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,12 +24,12 @@ import java.net.URI;
import java.util.HashSet;
import java.util.Set;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version.ID;
-import org.apache.taverna.component.registry.ComponentImplementationCache;
-import org.apache.taverna.component.registry.ComponentUtil;
-import org.apache.taverna.component.utils.AnnotationUtils;
-import org.apache.taverna.component.utils.SystemUtils;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version.ID;
+import io.github.taverna_extras.component.registry.ComponentImplementationCache;
+import io.github.taverna_extras.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.utils.AnnotationUtils;
+import io.github.taverna_extras.component.utils.SystemUtils;
import org.springframework.beans.factory.annotation.Required;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
index 720c3c9..d874241 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityLocalChecker.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,7 +18,7 @@ package org.apache.taverna.component.activity;
* under the License.
*/
-import static org.apache.taverna.component.activity.ComponentHealthCheck.NON_SHAREABLE;
+import static io.github.taverna_extras.component.activity.ComponentHealthCheck.NON_SHAREABLE;
import java.util.List;
import org.apache.taverna.visit.VisitKind;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
index 31e2052..4d45b60 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentActivityUpgradeChecker.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,13 +19,13 @@ package org.apache.taverna.component.activity;
*/
import static org.apache.log4j.Logger.getLogger;
-import static org.apache.taverna.component.activity.ComponentHealthCheck.OUT_OF_DATE;
+import static io.github.taverna_extras.component.activity.ComponentHealthCheck.OUT_OF_DATE;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.registry.ComponentUtil;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.registry.ComponentUtil;
import org.apache.taverna.visit.VisitKind;
import org.apache.taverna.visit.VisitReport;
import static org.apache.taverna.visit.VisitReport.Status.WARNING;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
index 5fb86bc..243fe84 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentExceptionFactory.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
index c8d0b3d..0381de1 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentHealthCheck.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
index 1a59c5a..7ef77f7 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ComponentImplementationException.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
index c62ad63..3a04af3 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/ProxyCallback.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.activity;
+package io.github.taverna_extras.component.activity;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -31,9 +31,9 @@ import java.util.Set;
import javax.xml.ws.Holder;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-import org.apache.taverna.component.api.profile.ExceptionReplacement;
-import org.apache.taverna.component.api.profile.HandleException;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.api.profile.ExceptionReplacement;
+import io.github.taverna_extras.component.api.profile.HandleException;
import org.apache.taverna.invocation.InvocationContext;
import org.apache.taverna.reference.ErrorDocument;
import org.apache.taverna.reference.ErrorDocumentService;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
index 02e1b7d..086a49b 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/activity/package-info.java
@@ -16,4 +16,4 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.taverna.component.activity;
\ No newline at end of file
+package io.github.taverna_extras.component.activity;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
index 5e11ff0..a948cd4 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ActivityProfileImpl.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.profile;
+package io.github.taverna_extras.component.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,11 +21,11 @@ package org.apache.taverna.component.profile;
import java.util.ArrayList;
import java.util.List;
-import org.apache.taverna.component.api.profile.ActivityProfile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.ActivityProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.api.profile.doc.Activity;
-import org.apache.taverna.component.api.profile.doc.SemanticAnnotation;
+import io.github.taverna_extras.component.api.profile.doc.Activity;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
/**
* Specifies the semantic annotations that an activity must have.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
index a45caf7..989f411 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/BaseProfileLocator.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.profile;
+package io.github.taverna_extras.component.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -39,7 +39,7 @@ import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
+import io.github.taverna_extras.component.api.ComponentException;
import org.apache.taverna.configuration.app.ApplicationConfiguration;
public class BaseProfileLocator {
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
index 26e2a1d..6c7a5b0 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/ComponentProfileImpl.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.profile;
+package io.github.taverna_extras.component.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -50,18 +50,18 @@ import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.profile.ActivityProfile;
-import org.apache.taverna.component.api.profile.ExceptionHandling;
-import org.apache.taverna.component.api.profile.PortProfile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
-
-import org.apache.taverna.component.api.profile.doc.Activity;
-import org.apache.taverna.component.api.profile.doc.Ontology;
-import org.apache.taverna.component.api.profile.doc.Port;
-import org.apache.taverna.component.api.profile.doc.Profile;
-import org.apache.taverna.component.api.profile.doc.SemanticAnnotation;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.profile.ActivityProfile;
+import io.github.taverna_extras.component.api.profile.ExceptionHandling;
+import io.github.taverna_extras.component.api.profile.PortProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
+
+import io.github.taverna_extras.component.api.profile.doc.Activity;
+import io.github.taverna_extras.component.api.profile.doc.Ontology;
+import io.github.taverna_extras.component.api.profile.doc.Port;
+import io.github.taverna_extras.component.api.profile.doc.Profile;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
@@ -76,7 +76,7 @@ import org.apache.taverna.workflowmodel.health.RemoteHealthChecker;
* @author David Withers
*/
public class ComponentProfileImpl implements
- org.apache.taverna.component.api.profile.Profile {
+ io.github.taverna_extras.component.api.profile.Profile {
private static final Logger logger = getLogger(ComponentProfileImpl.class);
private static final Map<String, OntModel> ontologyModels = new HashMap<>();
private static final JAXBContext jaxbContext;
@@ -90,7 +90,7 @@ public class ComponentProfileImpl implements
"Failed to initialize profile deserialization engine", e);
}
}
- private org.apache.taverna.component.api.profile.Profile parent;
+ private io.github.taverna_extras.component.api.profile.Profile parent;
private Profile profileDoc;
private ExceptionHandling exceptionHandling;
private Registry parentRegistry = null;
@@ -289,7 +289,7 @@ public class ComponentProfileImpl implements
return o == null || o == this;
}
- private synchronized org.apache.taverna.component.api.profile.Profile parent()
+ private synchronized io.github.taverna_extras.component.api.profile.Profile parent()
throws ComponentException {
if (parent == null) {
try {
@@ -459,8 +459,8 @@ public class ComponentProfileImpl implements
}
@Override
- public List<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
- List<org.apache.taverna.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
+ public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
+ List<io.github.taverna_extras.component.api.profile.ActivityProfile> activityProfiles = new ArrayList<>();
try {
for (Activity activity : getProfileDocument().getComponent()
.getActivity())
@@ -590,7 +590,7 @@ public class ComponentProfileImpl implements
* @author Donal Fellows
*/
final class EmptyProfile implements
- org.apache.taverna.component.api.profile.Profile {
+ io.github.taverna_extras.component.api.profile.Profile {
@Override
public String getName() {
return "";
@@ -657,7 +657,7 @@ final class EmptyProfile implements
}
@Override
- public List<org.apache.taverna.component.api.profile.ActivityProfile> getActivityProfiles() {
+ public List<io.github.taverna_extras.component.api.profile.ActivityProfile> getActivityProfiles() {
return emptyList();
}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
index 8207a6f..53a1190 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/PortProfileImpl.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.profile;
+package io.github.taverna_extras.component.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,11 +21,11 @@ package org.apache.taverna.component.profile;
import java.util.ArrayList;
import java.util.List;
-import org.apache.taverna.component.api.profile.PortProfile;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.PortProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.api.profile.doc.Port;
-import org.apache.taverna.component.api.profile.doc.SemanticAnnotation;
+import io.github.taverna_extras.component.api.profile.doc.Port;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
/**
* Specifies the semantic annotations that a port must have.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
index a5cb000..a3b5afa 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/profile/SemanticAnnotationProfileImpl.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.profile;
+package io.github.taverna_extras.component.profile;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,9 +28,9 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.profile.SemanticAnnotationProfile;
+import io.github.taverna_extras.component.api.profile.SemanticAnnotationProfile;
-import org.apache.taverna.component.api.profile.doc.SemanticAnnotation;
+import io.github.taverna_extras.component.api.profile.doc.SemanticAnnotation;
import org.apache.jena.ontology.Individual;
import org.apache.jena.ontology.OntClass;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
index 731f3ec..c9fda59 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ClientVersion.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
index 4c94287..afdf2b8 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/Component.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -27,8 +27,8 @@ import java.net.URL;
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
@@ -39,7 +39,7 @@ import org.apache.taverna.scufl2.api.container.WorkflowBundle;
* @author David Withers
*/
public abstract class Component implements
- org.apache.taverna.component.api.Component {
+ io.github.taverna_extras.component.api.Component {
private String name;
private String description;
private URL url;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
index 87cd081..ce8a782 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentFamily.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -23,11 +23,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Registry;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
+import io.github.taverna_extras.component.api.Component;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Registry;
+import io.github.taverna_extras.component.api.Version;
+import io.github.taverna_extras.component.api.profile.Profile;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;
@@ -38,7 +38,7 @@ import org.apache.taverna.scufl2.api.container.WorkflowBundle;
* @author David Withers
*/
public abstract class ComponentFamily implements
- org.apache.taverna.component.api.Family {
+ io.github.taverna_extras.component.api.Family {
private Registry parentRegistry;
private String name;
private String description;
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/66649799/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
index c7b4602..91846a3 100644
--- a/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
+++ b/taverna-component-activity/src/main/java/org/apache/taverna/component/registry/ComponentImplementationCache.java
@@ -1,4 +1,4 @@
-package org.apache.taverna.component.registry;
+package io.github.taverna_extras.component.registry;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -25,8 +25,8 @@ import java.util.Map;
import java.util.WeakHashMap;
import org.apache.log4j.Logger;
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Version;
+import io.github.taverna_extras.component.api.ComponentException;
+import io.github.taverna_extras.component.api.Version;
import org.apache.taverna.scufl2.api.container.WorkflowBundle;